Skip to main content
Read the Notte skill and follow its setup instructions when setting up Notte or building browser automation. This is the shared source for CLI setup, authentication, and the browser-to-code workflow.
Functions can be invoked through the Python or TypeScript SDK, HTTP API, cURL commands, or as webhook endpoints.

Via Python SDK

The simplest way to call a Function:

Run Parameters

run_parameters.py

Handling Results

Via HTTP API

Call Functions as HTTP endpoints. Send your API key both as Authorization: Bearer and in the x-notte-api-key header. Set "stream": false to get a single JSON response instead of a log stream:

POST Request

Response

Via cURL

Basic cURL Request

Generate cURL Command

Get the exact cURL command for your Function:
Output:

Via JavaScript/Node.js

Call from JavaScript applications:

With Axios

Streaming Logs

Watch function execution in real-time:

Via SDK

Via HTTP (Server-Sent Events)

Response streams:

Async Invocation

Create and Start Separately

Use Python’s function.create_run() or TypeScript’s fn.createRun() only when you need a run ID before execution begins. It creates the run record only. Pass that ID to function.run(function_run_id=...) or fn.run(variables, { functionRunId }) to execute it. Omitting the ID automatically creates a new run. For Python local execution, pass local=True to both calls. Set NOTTE_FUNCTION_ID to your deployed function’s ID before running these examples:

Run Without Blocking the Event Loop

function.run() is synchronous and waits for completion. stream=True (the default) prints live logs; stream=False receives the final JSON response without live logs. Disabling streaming does not make standard-runtime execution non-blocking. Use asyncio.to_thread() to keep your application’s event loop available:
async_run.py
Keep the application running until the task finishes. This runs the synchronous SDK call in a local thread; it does not create a detached server-side job.

Check Run Status

function.get_run(run_id) fetches the current status and result without waiting for execution to finish. From async code, use await asyncio.to_thread(function.get_run, run_id). In TypeScript, use await fn.getRun(runId); fn.retrieve(runId) remains a compatible alias.

Stop a Running Function

stop_running.py

Webhook Integration

As Webhook Endpoint

Use Functions as webhook receivers:
webhook_handler.py
Configure webhook in external service:

Testing Webhooks

Test webhook locally:

Error Handling

SDK Error Handling

sdk_error_handling.py

Disable Raise on Failure

HTTP Error Handling

Batch Invocations

Run Multiple Functions

Sequential Invocations

Local vs Cloud Execution

Cloud Execution (Default)

Advantages:
  • Scalable
  • No local resources needed
  • Built-in logging
  • Session replays available

Local Execution

local_execution.py
Advantages:
  • Debugging
  • Development/testing
  • No cloud execution costs
Requirements:
  • Access to the function’s code (you own it or it is shared with you)
  • Notte-managed functions also need their decryption key, passed as decryption_key when creating the Function instance

Rate Limits

Rate-Limited Runs

Running a published function that you do not own is rate limited per caller. When you exceed the limit, the API answers with HTTP 429.

Handling Rate Limits

Retry with backoff when a run is rejected with 429:

Best Practices

1. Use Appropriate Timeout

In Python, timeout is how many seconds the SDK waits for data from the server before giving up (default 300); a long run that keeps streaming logs is not cut off. In TypeScript, timeoutMs is a deadline for the whole call (default 5 minutes) and throws NotteTimeoutError when it elapses. Both only control how long your code waits for the result.

2. Stream Logs for Debugging

stream_debug.py

3. Handle Errors Gracefully

graceful_errors.py

4. Use Variables for Dynamic Data

use_variables.py

Next Steps

Schedules

Schedule Functions automatically

Management

Update and monitor Functions

Creating Functions

Learn to write Functions

API Reference

Full API documentation