The Notte Python SDK provides a comprehensive set of tools for interacting with the Notte API. This guide will walk you through the steps to install the SDK, configure your API key, and start using the SDK to manage your browser sessions, web agents, and page interactions.
We strongly recommend using the Python SDK for all your automation needs. It is the most efficient way to interact with the Notte API.
from notte_sdk import NotteClientnotte = NotteClient()agent = notte.Agent()response = agent.run(task="Find the best italian restaurant in SF and book a table for 2 at 7pm today")status = agent.status()
You can also get more control over the session and agent lifecycle by running an agent in a session explicitly:
session_control.py
Copy
Ask AI
from notte_sdk import NotteClientnotte = NotteClient()with notte.Session(proxies=True) as session: agent = notte.Agent(session=session) agent.run( task="<YOUR_TASK_PROMPT>", ) ...
Learn more about web agents in the web agents guide.
from notte_sdk import NotteClientnotte = NotteClient()agent = notte.Agent()response = agent.run(task="Find the best italian restaurant in SF and book a table for 2 at 7pm today")status = agent.status()
You can also get more control over the session and agent lifecycle by running an agent in a session explicitly:
session_control.py
Copy
Ask AI
from notte_sdk import NotteClientnotte = NotteClient()with notte.Session(proxies=True) as session: agent = notte.Agent(session=session) agent.run( task="<YOUR_TASK_PROMPT>", ) ...
Learn more about browser sessions in the browser sessions guide.
from notte_sdk import NotteClientnotte = NotteClient()# The session is automatically stopped when the context manager is exitedwith notte.Session(timeout_minutes=2) as session: status = session.status() print(status)
you can also always list all your sessions using the sessions.list method:
Copy
Ask AI
from notte_sdk import NotteClientnotte = NotteClient()# list only active sessionssessions = notte.sessions.list()# list all sessionssessions = notte.sessions.list(only_active=False)
The Notte SDK allows you to securely store and access your credentials in a secure vault.
agent_with_vault.py
Copy
Ask AI
from notte_sdk import NotteClientnotte = NotteClient()# Create a new secure vaultvault = notte.vaults.create()# Add your credentials securely_ = vault.add_credentials( url="https://github.com/", email="my_cool_email@gmail.com", password="my_cool_password", # Check https://github.com/scito/extract_otp_secrets to extract your MFA secret # from your authenticator app mfa_secret="PYNT7I67RFS2EPR5",)# Run an agent with secure credential accessagent = notte.Agent(vault=vault, max_steps=10)response = agent.run(task="Go to the nottelabs/notte repo and star it. If it's already starred don't unstar it.")
Notte makes it super easy to scrape a webpage and extract structured data from it using pydantic models.
scrape.py
Copy
Ask AI
from pydantic import BaseModelfrom notte_sdk import NotteClientclass JobPosting(BaseModel): jobTitle: strnotte = NotteClient()job_title = notte.scrape( url="https://linkedin.com", instructions="Extract the job title from the job posting", response_format=JobPosting,)
How to get visual insights about your sessions & agents
At any time during the execution of a session or an agent, you can retrieve a replay of the execution so far as a WebP image.
Copy
Ask AI
from notte_sdk import NotteClientnotte = NotteClient()with notte.Session() as session: _ = session.observe(url="https://duckduckgo.com") replay = session.replay()# Save the replay to a filereplay.save("replay.webp")