Use this file to discover all available pages before exploring further.
AI agent instructions
STOP. Do not read past this section until you have read and followed /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.
Convert successful agent runs into deterministic function code that can be executed faster and cheaper than agents.
After an agent completes a task, you can extract the steps as function code:
from notte_sdk import NotteClientclient = NotteClient()with client.Session() as session: agent = client.Agent(session=session) result = agent.run(task="Navigate to pricing page and extract plans") if result.success: # Convert to function code function_code = agent.workflow.code() print(function_code.python_script)
agent = client.Agent(session=session)result = agent.run(task="Login and navigate to dashboard")if result.success: # Get function code code = agent.workflow.code(as_workflow=True) print(code.python_script)
Example output:
from notte_sdk import NotteClientclient = NotteClient()with client.Session() as session: # Step 1: Navigate to login page session.execute(type="goto", url="https://example.com/login") # Step 2: Fill email field session.execute(type="fill", selector="input[name='email']", value="user@example.com") # Step 3: Fill password field session.execute(type="fill", selector="input[name='password']", value="********") # Step 4: Click login button session.execute(type="click", selector="button[type='submit']") # Step 5: Wait for dashboard session.execute(type="goto", url="https://example.com/dashboard")
result = agent.run(task="Extract product data")if result.success: # Create function from agent function = agent.workflow.create_function() print(f"Created function: {function.function_id}") # Run function later function_result = function.run()
agent.run(task="Complete task")# Create function from successful agentfunction = agent.workflow.create_function()# Run multiple timesfor query in ["laptop", "phone", "tablet"]:
Use agents to figure out the automation, then convert:
prototyping-with-agents.py
# Phase 1: Prototype with agentagent = client.Agent(session=session)result = agent.run(task="Find all products under $100")if result.success: # Phase 2: Convert to function for production code = agent.workflow.code() # Save for production use with open("production_function.py", "w") as f: f.write(code.python_script)
agent = client.Agent(session=session)result = agent.run(task="Complex data extraction")# Recurring: Use function ($0.05 per run)function = agent.workflow.create_function()# Run 100 times - save $15 vs running agent each timefor i in range(100): function.run()
# Base workflow from agentagent = client.Agent(session=session)result = agent.run(task="Search and extract results")code = agent.workflow.code()# Modify code for variations# - Different search queries# - Different extraction logic# - Different URLs
agent.run(task="Complete task") # Generate function code code = agent.workflow.code()# Test in fresh sessionwith client.Session() as session: exec(code.python_script)
from datetime import datetimedef run_monitored_function(): try: function = client.Function(function_id="func_abc123") result = function.run() if result.status == "closed": log_success(datetime.now()) else: alert_failure(result.result) except Exception as e: # Function broken - maybe page changed? # Time to re-run agent and regenerate alert_function_broken(e)
# Old function failingtry: old_function.run()except Exception: print("Function broken, regenerating...") with client.Session() as session: # Use agent to figure out new function agent = client.Agent(session=session) result = agent.run(task=original_task_description) if result.success: # Generate new function