# Agent Start Source: https://docs.notte.cc/api-reference/agents/agent-start https://api.notte.cc/openapi.json post /agents/start # Agent Stop Source: https://docs.notte.cc/api-reference/agents/agent-stop https://api.notte.cc/openapi.json delete /agents/{agent_id}/stop # Get Script Source: https://docs.notte.cc/api-reference/agents/get-script https://api.notte.cc/openapi.json get /agents/{agent_id}/workflow/code # Anything Start Source: https://docs.notte.cc/api-reference/anything/anything-start https://api.notte.cc/openapi.json post /anything/start # Authentication Source: https://docs.notte.cc/api-reference/authentication Authenticate with the Notte API STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md). Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch. Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages. Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code. SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior. STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md). Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch. Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages. Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code. SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior. All API requests require a Bearer token in the `Authorization` header. ## Get your API key 1. Sign in to the [Notte Console](https://console.notte.cc) 2. Navigate to your account settings 3. Generate or copy your API key ## Using the API key Set your API key locally before calling the REST API or using the Python SDK: ```bash theme={null} export NOTTE_API_KEY=your_api_key_here ``` ```python theme={null} from notte_sdk import NotteClient client = NotteClient() # reads NOTTE_API_KEY automatically ``` If you want the full machine-readable API contract, the OpenAPI spec is available at: ```text theme={null} https://api.notte.cc/openapi.json ``` ```bash theme={null} curl https://api.notte.cc/sessions \ -H "Authorization: Bearer $NOTTE_API_KEY" ``` ## Request headers | Header | Required | Description | | --------------- | -------- | ------------------------------------------ | | `Authorization` | Yes | Bearer token with your API key | | `Content-Type` | Yes | `application/json` for POST/PATCH requests | # API Error Codes Source: https://docs.notte.cc/api-reference/errors API error responses and status codes STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md). Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch. Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages. Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code. SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior. STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md). Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch. Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages. Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code. SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior. The API uses standard HTTP status codes and returns structured error responses. ## HTTP status codes | Status | Description | | ------ | ---------------------------------------------------------- | | `200` | Success | | `401` | Authentication failed — invalid or missing API key | | `422` | Validation error — malformed request or invalid parameters | | `429` | Rate limit exceeded | | `500` | Internal server error | | `529` | Cluster overloaded - Too many sessions | ## Error response format ```json theme={null} { "message": "Description of what went wrong", "detail": "Additional context about the error" } ``` ## Common errors ### Authentication (401) ```json theme={null} { "message": "Authentication failed. Please check your credentials." } ``` ### Validation (422) ```json theme={null} { "message": "Validation error", "detail": [ { "loc": ["body", "url"], "msg": "field required", "type": "value_error.missing" } ] } ``` ### Execution errors Returned when an operation fails. Includes the `x-error-class: NotteApiExecutionError` header. ```json theme={null} { "message": "Error executing the requested operation" } ``` # Function Fork Source: https://docs.notte.cc/api-reference/functions/function-fork https://api.notte.cc/openapi.json post /functions/{function_id}/fork # Function Run Start Source: https://docs.notte.cc/api-reference/functions/function-run-start https://api.notte.cc/openapi.json post /functions/{function_id}/runs/start # Function Schedule Delete Source: https://docs.notte.cc/api-reference/functions/function-schedule-delete https://api.notte.cc/openapi.json delete /functions/{function_id}/schedule # Function Schedule Set Source: https://docs.notte.cc/api-reference/functions/function-schedule-set https://api.notte.cc/openapi.json post /functions/{function_id}/schedule # Persona Emails List Source: https://docs.notte.cc/api-reference/personas/persona-emails-list https://api.notte.cc/openapi.json get /personas/{persona_id}/emails # Persona Get Source: https://docs.notte.cc/api-reference/personas/persona-get https://api.notte.cc/openapi.json get /personas/{persona_id} # Persona Sms List Source: https://docs.notte.cc/api-reference/personas/persona-sms-list https://api.notte.cc/openapi.json get /personas/{persona_id}/sms # Profile Cookies Get Source: https://docs.notte.cc/api-reference/profiles/profile-cookies-get https://api.notte.cc/openapi.json get /profiles/{profile_id}/cookies # Profile Cookies Set Source: https://docs.notte.cc/api-reference/profiles/profile-cookies-set https://api.notte.cc/openapi.json post /profiles/{profile_id}/cookies # Profile Create Source: https://docs.notte.cc/api-reference/profiles/profile-create https://api.notte.cc/openapi.json post /profiles/create # Profile Delete Source: https://docs.notte.cc/api-reference/profiles/profile-delete https://api.notte.cc/openapi.json delete /profiles/{profile_id} # Profile Duplicate Source: https://docs.notte.cc/api-reference/profiles/profile-duplicate https://api.notte.cc/openapi.json post /profiles/{profile_id}/duplicate # Profile Get Source: https://docs.notte.cc/api-reference/profiles/profile-get https://api.notte.cc/openapi.json get /profiles/{profile_id} # Profile List Source: https://docs.notte.cc/api-reference/profiles/profile-list https://api.notte.cc/openapi.json get /profiles # Rate Limits Source: https://docs.notte.cc/api-reference/rate-limits API rate limiting and response headers STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md). Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch. Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages. Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code. SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior. STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md). Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch. Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages. Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code. SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior. The API implements rate limiting to ensure fair usage and platform stability. ## Rate limit headers Every response includes headers with your current rate limit status: | Header | Description | | ----------------------- | ------------------------------------- | | `X-RateLimit-Limit` | Maximum requests allowed per window | | `X-RateLimit-Remaining` | Requests remaining in current window | | `X-RateLimit-Reset` | Unix timestamp when the window resets | ## Rate limit exceeded (429) ```json theme={null} { "message": "Rate limit exceeded", "detail": "Please wait before making more requests" } ``` ## Checking your limits ```bash theme={null} curl -I https://api.notte.cc/health \ -H "Authorization: Bearer $NOTTE_API_KEY" ``` Response headers: ``` X-RateLimit-Limit: 100 X-RateLimit-Remaining: 95 X-RateLimit-Reset: 1704067200 ``` ## Increasing limits Need higher limits? [Contact us](https://cal.com/team/notte/demo) to discuss enterprise options. # Get Secret Source: https://docs.notte.cc/api-reference/secrets/get-secret https://api.notte.cc/openapi.json get /secrets/{name} # List Secrets Source: https://docs.notte.cc/api-reference/secrets/list-secrets https://api.notte.cc/openapi.json get /secrets # Store Secret Source: https://docs.notte.cc/api-reference/secrets/store-secret https://api.notte.cc/openapi.json post /secrets # Get Session Script Source: https://docs.notte.cc/api-reference/sessions/get-session-script https://api.notte.cc/openapi.json get /sessions/{session_id}/workflow/code # Page Execute Source: https://docs.notte.cc/api-reference/sessions/page-execute https://api.notte.cc/openapi.json post /sessions/{session_id}/page/execute # Page Observe Source: https://docs.notte.cc/api-reference/sessions/page-observe https://api.notte.cc/openapi.json post /sessions/{session_id}/page/observe # Page Scrape Source: https://docs.notte.cc/api-reference/sessions/page-scrape https://api.notte.cc/openapi.json post /sessions/{session_id}/page/scrape # Page Screenshot Source: https://docs.notte.cc/api-reference/sessions/page-screenshot https://api.notte.cc/openapi.json post /sessions/{session_id}/page/screenshot # Session Cookies Get Source: https://docs.notte.cc/api-reference/sessions/session-cookies-get https://api.notte.cc/openapi.json get /sessions/{session_id}/cookies # Session Cookies Set Source: https://docs.notte.cc/api-reference/sessions/session-cookies-set https://api.notte.cc/openapi.json post /sessions/{session_id}/cookies # Session Network Logs Source: https://docs.notte.cc/api-reference/sessions/session-network-logs https://api.notte.cc/openapi.json get /sessions/{session_id}/network/logs # Session Replay Source: https://docs.notte.cc/api-reference/sessions/session-replay https://api.notte.cc/openapi.json get /sessions/{session_id}/replay # Session Start Source: https://docs.notte.cc/api-reference/sessions/session-start https://api.notte.cc/openapi.json post /sessions/start # Session Stop Source: https://docs.notte.cc/api-reference/sessions/session-stop https://api.notte.cc/openapi.json delete /sessions/{session_id}/stop # File Download Source: https://docs.notte.cc/api-reference/storage/file-download https://api.notte.cc/openapi.json get /storage/{session_id}/downloads/{filename} # File Download Uploaded File Source: https://docs.notte.cc/api-reference/storage/file-download-uploaded-file https://api.notte.cc/openapi.json get /storage/uploads/{filename} # File Upload Source: https://docs.notte.cc/api-reference/storage/file-upload https://api.notte.cc/openapi.json post /storage/uploads/{filename} # Session Replay Source: https://docs.notte.cc/api-reference/using-session-replay Use mp4_url from GET /sessions/{session_id}/replay to download recordings STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md). Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch. Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages. Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code. SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior. STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md). Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch. Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages. Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code. SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior. `GET /sessions/{session_id}/replay` returns presigned URLs for the session recording after the session has ended. The field most clients need is **`mp4_url`**: a time-limited presigned URL for the MP4 file. Use it to download or share the recording from any HTTP client (webhooks, CI, non-Python SDKs). Check `expires_at` for when the URL stops working. ```bash theme={null} curl "https://api.notte.cc/sessions/{session_id}/replay" \ -H "Authorization: Bearer $NOTTE_API_KEY" ``` Example response: ```json theme={null} { "mp4_url": "https://storage.example.com/replays/session_abc.mp4?X-Amz-Signature=...", "playlist_content": "#EXTM3U\n...", "expires_at": "2026-08-06T18:00:00+00:00", "video_start_ms": 0, "video_duration_ms": 45200 } ``` ## Response fields Presigned URL for downloading the session recording as an MP4. Prefer this when you need the video file itself. HLS playlist content with presigned segment URLs, for streaming playback. When the presigned URLs expire. Download promptly if you need a durable copy. Video start offset in milliseconds. Video duration in milliseconds. From the Python SDK, the same payload is returned by `session.replay()` as a [`ReplayResponse`](/sdk-reference/misc/replayresponse)[`ReplayResponse`](/sdk-reference/misc/replayresponse.md). Use `replay.mp4_url` or `replay.download("session.mp4")`. Interactive OpenAPI playground for this endpoint is available under the API tab (Sessions → Session Replay), generated from [https://api.notte.cc/openapi.json](https://api.notte.cc/openapi.json). See also [Session recordings](/features/sessions/recordings). # Vault Create Source: https://docs.notte.cc/api-reference/vaults/vault-create https://api.notte.cc/openapi.json post /vaults/create # Vault Credentials Get Source: https://docs.notte.cc/api-reference/vaults/vault-credentials-get https://api.notte.cc/openapi.json get /vaults/{vault_id}/credentials # Browser Agents Source: https://docs.notte.cc/concepts/agents AI-powered agents that autonomously complete browser tasks STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md). Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch. Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages. Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code. SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior. STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md). Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch. Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages. Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code. SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior. Browser Agents are AI-powered systems that can autonomously navigate websites, complete tasks, and extract information using natural language instructions. ## What is a Browser Agent? A Browser Agent combines: * **Large Language Models (LLMs)** for reasoning and decision-making * **Browser Sessions** for executing actions * **Vision capabilities** to understand web pages * **Autonomous planning** to complete multi-step tasks Unlike scripted automation, agents can adapt to changes, handle unexpected scenarios, and complete tasks without predefined workflows. ## Quick Start Create and run an agent in a few lines: ```python Python theme={null} from notte_sdk import NotteClient client = NotteClient() with client.Session(open_viewer=True) as session: agent = client.Agent(session=session, max_steps=5) response = agent.run( task="Browse on Notte docs and book a demo for me", url="https://docs.notte.cc" ) print(response) ``` ```javascript JavaScript theme={null} import { NotteClient } from 'notte-sdk'; const client = new NotteClient({ apiKey: process.env.NOTTE_API_KEY, }); await client.Session({ open_viewer: true }).use(async (session) => { const agent = client.Agent({ session, max_steps: 5 }); const response = await agent.run({ task: 'Browse on Notte docs and book a demo for me', url: 'https://docs.notte.cc', }); console.log(response); }); ``` Agents run within [browser sessions](/concepts/sessions). Use context managers to ensure sessions are automatically stopped when done. This prevents orphaned sessions and unexpected costs. ## How Agents Work ### 1. Observation The agent observes the current page state: * Visible elements and their properties * Interactive components (buttons, forms, links) * Text content and structure * Current URL and page metadata ### 2. Reasoning Using the LLM, the agent: * Understands the current page * Plans the next action to complete the task * Decides which element to interact with * Determines when the task is complete ### 3. Action The agent executes browser actions: * Navigate to URLs * Click buttons and links * Fill forms * Extract data * Scroll and interact with dynamic content ### 4. Iteration This cycle repeats until: * The task is successfully completed * Maximum steps are reached * An error occurs that can't be resolved ## Agents vs Scripted Automation Both agents and scripted automation run on [browser sessions](/concepts/sessions)—the cloud browser infrastructure. The difference is how you control what happens in that session. | Aspect | Scripted Automation | Agent | | --------------- | ----------------------- | ------------------------------- | | **Control** | You write the code | AI decides each step | | **Flexibility** | Fixed workflow | Adapts to changes | | **Speed** | Fast (direct execution) | Slower (LLM reasoning per step) | | **Cost** | Browser minutes only | Browser minutes + LLM calls | | **Reliability** | Deterministic | Can vary based on page state | | **Use Case** | Known, stable workflows | Unknown or dynamic workflows | **Use scripted automation when:** * You know the exact steps to take * Speed and cost are critical * The target pages rarely change **Use agents when:** * You don't know the exact steps * Pages change frequently * You need intelligent decision-making You can combine both approaches: use an agent to figure out a workflow, then [convert it to a function](/features/agents/workflows) for faster, cheaper repeated execution. ## Agent Capabilities Agents come with powerful built-in capabilities: Get type-safe responses using Pydantic models Use credentials and identities in automations Analyze images and visual page elements Debug with MP4 replays of agent execution Automatic recovery from script failures ## Key Concepts ### Natural Language Tasks Give instructions in plain English: ```python Python theme={null} from notte_sdk import NotteClient client = NotteClient() with client.Session() as session: agent = client.Agent(session=session) agent.run(task="Find the cheapest laptop under $1000 and add it to cart") ``` ```javascript JavaScript theme={null} import { NotteClient } from 'notte-sdk'; const client = new NotteClient({ apiKey: process.env.NOTTE_API_KEY, }); await client.Session().use(async (session) => { const agent = client.Agent({ session }); await agent.run({ task: 'Find the cheapest laptop under $1000 and add it to cart', }); }); ``` ### Structured Output Get responses in a specific format: ```python Python theme={null} from notte_sdk import NotteClient from pydantic import BaseModel client = NotteClient() class ContactInfo(BaseModel): email: str phone: str | None with client.Session() as session: agent = client.Agent(session=session) result = agent.run(task="Extract contact information", response_format=ContactInfo) ``` ```javascript JavaScript theme={null} import { z } from 'zod'; import { NotteClient } from 'notte-sdk'; const client = new NotteClient({ apiKey: process.env.NOTTE_API_KEY, }); const ContactInfo = z.object({ email: z.string(), phone: z.string().nullable(), }); await client.Session().use(async (session) => { const agent = client.Agent({ session }); const result = await agent.run({ task: 'Extract contact information', response_format: ContactInfo, }); }); ``` ### Starting URL Begin at a specific page: ```python Python theme={null} agent = client.Agent(session=session) agent.run(task="Find pricing information", url="https://example.com/products") ``` ```javascript JavaScript theme={null} const agent = client.Agent({ session }); await agent.run({ task: 'Find pricing information', url: 'https://example.com/products', }); ``` ### Step Limits Control maximum actions: ```python Python theme={null} from notte_sdk import NotteClient client = NotteClient() with client.Session() as session: agent = client.Agent(session=session) agent.run( task="Find and summarize the top 5 AI news from today", max_steps=20, # Limit to 20 actions ) ``` ```javascript JavaScript theme={null} import { NotteClient } from 'notte-sdk'; const client = new NotteClient({ apiKey: process.env.NOTTE_API_KEY, }); await client.Session().use(async (session) => { const agent = client.Agent({ session }); await agent.run({ task: 'Find and summarize the top 5 AI news from today', max_steps: 20, // Limit to 20 actions }); }); ``` ## Error Handling Agents can fail for various reasons. Always check the result: ```python Python theme={null} agent = client.Agent(session=session) result = agent.run(task="Complete task") if result.success: print(result.answer) else: print(f"Agent failed: {result.answer}") ``` ```javascript JavaScript theme={null} const agent = client.Agent({ session }); const result = await agent.run({ task: 'Complete task' }); if (result.success) { console.log(result.answer); } else { console.log(`Agent failed: ${result.answer}`); } ``` ## Next Steps Create, manage, and stop agents All configuration options Get typed responses from agents Turn agent runs into reusable code # File Storage Source: https://docs.notte.cc/concepts/file-storage Upload and download files for your automations STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md). Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch. Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages. Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code. SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior. STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md). Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch. Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages. Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code. SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior. File Storage provides a cloud bucket for uploading files to use in your automations and downloading files that agents retrieve from websites. ## Quick Start ```python quickstart.py theme={null} from notte_sdk import NotteClient client = NotteClient() storage = client.FileStorage() # Upload a file before the session storage.upload("document.pdf") # Create session with storage attached with client.Session(storage=storage) as session: agent = client.Agent(session=session) result = agent.run( task="Upload document.pdf to the portal and download the receipt", url="https://example.com/upload" ) # Download files the agent retrieved for file in storage.list_downloaded_files(): storage.download(file_name=file.name, local_dir="./downloads") ``` ## How It Works File Storage has two buckets: | Bucket | Purpose | API | | ------------- | ----------------------------------- | -------------------- | | **Uploads** | Files you upload for agents to use | `storage.upload()` | | **Downloads** | Files agents download from websites | `storage.download()` | ``` ┌─────────────┐ ┌──────────────┐ │ Local Files │ ── upload() ─────> │ Uploads │ └─────────────┘ └──────┬───────┘ │ v ┌──────────────┐ │ Session │ │ / Agent │ └──────┬───────┘ │ v ┌─────────────┐ ┌──────────────┐ │ Local Files │ <── download() ─── │ Downloads │ └─────────────┘ └──────────────┘ ``` ## Uploading Files Upload files from your local machine to make them available in sessions: ```python uploading_files.py theme={null} from notte_sdk import NotteClient client = NotteClient() storage = client.FileStorage() # Upload a file (uses the original filename) storage.upload("report.pdf") # Upload with a custom name storage.upload("report.pdf", upload_file_name="quarterly_report.pdf") # List uploaded files files = storage.list_uploaded_files() print(f"Uploaded: {files}") ``` Each uploaded file must be under **100 MB**. For larger files, contact the team at [support@notte.cc](mailto:support@notte.cc). ## Downloading Files Download files that agents retrieved from websites: ```python downloading_files.py theme={null} from notte_sdk import NotteClient client = NotteClient() storage = client.FileStorage() with client.Session(storage=storage) as session: agent = client.Agent(session=session) agent.run(task="Download the invoice from the account page") # List downloaded files downloaded = storage.list_downloaded_files() print(f"Downloaded: {downloaded}") # Download to local directory for file in downloaded: storage.download(file_name=file.name, local_dir="./invoices") ``` ### Force Overwrite Overwrite existing local files: ```python force_overwrite.py theme={null} from notte_sdk import NotteClient client = NotteClient() storage = client.FileStorage() storage.download( file_name="report.pdf", local_dir="./downloads", force=True, # Overwrite if exists ) ``` ## Using with Agents Agents can interact with files on websites when storage is attached: ```python using_with_agents.py theme={null} from notte_sdk import NotteClient client = NotteClient() storage = client.FileStorage() # Upload files for the agent to use storage.upload("contract.pdf") storage.upload("signature.png") with client.Session(storage=storage) as session: agent = client.Agent(session=session, max_steps=15) result = agent.run( task=""" 1. Upload contract.pdf to the document portal 2. Add signature.png to the signature field 3. Submit the form 4. Download the signed confirmation """, url="https://example.com/documents", ) # Get the confirmation the agent downloaded for file in storage.list_downloaded_files(): storage.download(file_name=file.name, local_dir="./signed") ``` ## Using with Sessions Use file storage with scripted automation: ```python using_with_sessions.py theme={null} from notte_sdk import NotteClient client = NotteClient() storage = client.FileStorage() # Upload file storage.upload("data.csv") with client.Session(storage=storage) as session: session.execute(type="goto", url="https://example.com/import") # Upload using the upload_file action session.execute(type="upload_file", selector='input[type="file"]', file_path="data.csv") session.execute(type="click", selector="button.submit") # Download any files for file in storage.list_downloaded_files(): storage.download(file_name=file.name, local_dir="./results") ``` ## API Reference ### FileStorage Methods | Method | Description | | --------------------------------------------- | ---------------------------------- | | `upload(file_path, upload_file_name=None)` | Upload a local file to storage | | `download(file_name, local_dir, force=False)` | Download a file to local directory | | `list_uploaded_files()` | List files you've uploaded | | `list_downloaded_files()` | List files downloaded by agents | ### Parameters **upload()** * `file_path` - Path to the local file to upload * `upload_file_name` - Optional custom name for the uploaded file **download()** * `file_name` - Name of the file in storage * `local_dir` - Local directory to save the file * `force` - Overwrite existing file (default: False) ## Supported File Types File storage supports all common file types: * **Documents**: PDF, DOCX, XLSX, TXT, CSV * **Images**: PNG, JPG, JPEG, GIF, WEBP * **Archives**: ZIP, RAR, TAR, GZ * **Media**: MP4, MP3 * **Data**: JSON, XML ## Best Practices ### 1. Attach Storage Before Starting Always create and attach storage before starting the session: ```python attach_before_starting.py theme={null} from notte_sdk import NotteClient client = NotteClient() # Correct storage = client.FileStorage() storage.upload("file.pdf") with client.Session(storage=storage) as session: # Storage is available pass ``` ### 2. Use Descriptive Filenames ```python descriptive_filenames.py theme={null} from datetime import datetime from notte_sdk import NotteClient client = NotteClient() storage = client.FileStorage() timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") storage.upload("report.pdf", upload_file_name=f"report_{timestamp}.pdf") ``` ### 3. Check Downloads After Session Always check for downloaded files after the session ends: ```python check_downloads.py theme={null} from notte_sdk import NotteClient client = NotteClient() storage = client.FileStorage() with client.Session(storage=storage) as session: agent = client.Agent(session=session) agent.run(task="Download all invoices") # Check what was downloaded files = storage.list_downloaded_files() if not files: print("No files were downloaded") else: for f in files: _ = storage.download(file_name=f.name, local_dir="./invoices") ``` ## Next Steps Use agents with file operations Learn about browser sessions Store credentials securely Create browser identities # Functions Source: https://docs.notte.cc/concepts/functions Deploy browser automations as serverless API endpoints STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md). Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch. Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages. Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code. SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior. STOP. Do not read past this section until you have read and followed [/quickstart.md](/quickstart.md). Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch. Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live `observe()` call, CLI `notte page observe` output, or generated workflow code. Guessed browser targets fail on real pages. Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with `notte sessions workflow-code` before using SDK docs or SDK code. SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior.