Overview

Sessions are the heart of our ecosystem. They maintain browser states and provide a reliable foundation for executing web-based operations. Every operation in the Notte ecosystem is performed on behalf of a session (agent, scrape, vault, etc.)

Session Management

This shows how to manage your browser sessions using the Notte Python SDK
from notte_sdk import NotteClient

notte = NotteClient()

# The session is automatically stopped when the context manager is exited
with notte.Session(timeout_minutes=2) as session:
	status = session.status()
	print(status)
We strongly recommend using the API using a with statement to manage the session lifecycle and ensure it is stopped when the context manager is exited.

Key points

  • Timeouts: Use the timeout_minutes parameter to specify when a session should be stopped if no actions are performed on it (no activity). Note that by default, sessions are stopped after 3 minutes of inactivity.
  • Session IDs: Each session is uniquely identified, e.g. 5767be3c-aef5-47f8-bcb0-4f9f80fa66a3 and is tied to an API Key.

Session Features

For more information on the additional features that are available for sessions, see the following guides:

Operations

Operations provide granular control on the browser session:
  • observe() To get the current state of a page and its available actions
  • execute() To execute an action you’ve previously observed on a page
  • scrape() To extract structured data from a page
from notte_sdk import NotteClient

notte = NotteClient()

with notte.Session() as page:
    url="https://www.linkedin.com/"

    # observe page and take a step
    page.execute({"type": "goto", "url": url})
    obs = page.observe(instructions="click 'jobs'")
    res = page.execute(obs.space.first())
    print(res.message)

    # another one
    obs = page.observe(instructions="dismiss the sign in check")
    res = page.execute(obs.space.first())
    print(res.message)