Skip to content

Usage

Minimal example: Python SDK agent (cloud sessions)

The simplest Notte operation is spinning up a cloud browser session and running an AI agent against it with a natural-language task description.

python
import os
from notte_sdk import NotteClient

client = NotteClient(api_key=os.getenv("NOTTE_API_KEY"))

with client.Session(open_viewer=True) as session:
    agent = client.Agent(
        session=session,
        reasoning_model="gemini/gemini-2.5-flash",
        max_steps=30,
    )
    response = agent.run(task="Extract the top 5 story titles from news.ycombinator.com")
    print(response)

open_viewer=True opens a live replay link so you can watch the session in your browser. Set it to False for headless production runs.

CLI workflow: navigate, observe, act

The CLI enforces a strict loop: always observe live DOM elements first, then act using the IDs returned by observe. Never guess selectors.

bash
# 1. Authenticate (one time)
notte auth login

# 2. Start a cloud browser session
notte sessions start

# 3. Navigate to a page
notte page goto "https://news.ycombinator.com"

# 4. Observe the live DOM to get valid element IDs
notte page observe

# 5. Scrape structured data using natural language
notte page scrape --instructions "Extract the top 5 story titles and their point counts"

# 6. Stop the session when done
notte sessions stop

Key rules

  • Always stop sessions when done. Leaving sessions running consumes credits. Use try/finally in Python code to guarantee cleanup even on errors.
  • CLI: never guess element IDs. Always run notte page observe first and act only on IDs it returns. The docs call this the required workflow loop.
  • MCP usage: the MCP server wires Notte directly into Claude or Cursor. The host LLM calls Notte tools without you writing any session management code.
  • Credentials: store secrets in Notte Secret Vaults rather than passing them as plain text in prompts. Vault credentials are injected into sessions without being forwarded to the LLM.

Benchmarks

Notte reports 79.0% LLM evaluation accuracy with 47-second average task completion on standard web agent benchmarks, outperforming competing open-source frameworks at time of publication.