Skip to content

Commit 9b91d69

Browse files
authored
kill headless from sdk and add open_viewer (#615)
1 parent b28353d commit 9b91d69

File tree

28 files changed

+127
-53
lines changed

28 files changed

+127
-53
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ import os
6565

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

68-
with client.Session(headless=False) as session:
68+
with client.Session(open_viewer=True) as session:
6969
agent = client.Agent(session=session, reasoning_model='gemini/gemini-2.5-flash', max_steps=30)
7070
response = agent.run(task="doom scroll cat memes on google images")
7171
```
@@ -103,7 +103,7 @@ class TopPosts(BaseModel):
103103
posts: list[HackerNewsPost]
104104

105105
client = NotteClient()
106-
with client.Session(headless=False, browser_type="firefox") as session:
106+
with client.Session(open_viewer=True, browser_type="firefox") as session:
107107
agent = client.Agent(session=session, reasoning_model='gemini/gemini-2.5-flash', max_steps=15)
108108
response = agent.run(
109109
task="Go to Hacker News (news.ycombinator.com) and extract the top 5 posts with their titles, URLs, points, authors, and comment counts.",
@@ -120,7 +120,7 @@ from notte_sdk import NotteClient
120120

121121
client = NotteClient()
122122

123-
with client.Vault() as vault, client.Session(headless=False) as session:
123+
with client.Vault() as vault, client.Session(open_viewer=True) as session:
124124
vault.add_credentials(
125125
url="https://x.com",
126126
username="your-email",
@@ -143,7 +143,7 @@ from notte_sdk import NotteClient
143143
client = NotteClient()
144144

145145
with client.Persona(create_phone_number=False) as persona:
146-
with client.Session(browser_type="firefox", headless=False) as session:
146+
with client.Session(browser_type="firefox", open_viewer=True) as session:
147147
agent = client.Agent(session=session, persona=persona, max_steps=15)
148148
response = agent.run(
149149
task="Open the Google form and RSVP yes with your name",
@@ -169,7 +169,7 @@ with client.Session(
169169
solve_captchas=True,
170170
proxies=True, # US-based proxy
171171
browser_type="firefox",
172-
headless=False
172+
open_viewer=True
173173
) as session:
174174
agent = client.Agent(session=session, max_steps=5)
175175
response = agent.run(
@@ -278,7 +278,7 @@ from notte_sdk import NotteClient
278278

279279
client = NotteClient()
280280

281-
with client.Session(headless=False, perception_type="fast") as session:
281+
with client.Session(open_viewer=True, perception_type="fast") as session:
282282
# Script execution for deterministic navigation
283283
session.execute({"type": "goto", "url": "https://www.quince.com/women/organic-stretch-cotton-chino-short"})
284284
session.observe()

docs/src/intro/quickstart.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ In this quickstart guide, we'll create a simple web agent that can browse and in
2828
client = NotteClient(api_key="your-key-here")
2929

3030
# create a browser session resource
31-
with client.Session(headless=False) as session:
31+
with client.Session(open_viewer=True) as session:
3232

3333
# attach an agent to session
3434
agent = client.Agent(

docs/src/snippets/personas/create_account.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ url = "https://console.notte.cc"
1212
# create credentials for the persona (automatically generates a password and stores it in the vault)
1313
persona.add_credentials(url=url)
1414

15-
with notte.Session(headless=False) as session:
15+
with notte.Session(open_viewer=True) as session:
1616
agent = notte.Agent(session=session, persona=persona)
1717
response = agent.run(task=f"Go to {url} and create an account. Go create an API key and return the API key.", url=url)
1818
print(response.answer)

examples/auth-vault-agent/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def main():
1212
# - GITHUB_COM_PASSWORD: your github password
1313
notte = NotteClient()
1414

15-
with notte.Vault() as vault, notte.Session(headless=False) as session:
15+
with notte.Vault() as vault, notte.Session(open_viewer=True) as session:
1616
vault.add_credentials_from_env("github.com")
1717
agent = notte.Agent(vault=vault, session=session)
1818
output = agent.run(task="Go to github.com, and login with your provided credentials")

examples/cli_agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
def main(
1212
task: Annotated[str, typer.Option(..., help="Task to perform")],
1313
reasoning_model: Annotated[str, typer.Option(help="Reasoning model to use")] = LlmModel.default(), # type: ignore[reportArgumentType]
14-
headless: Annotated[bool, typer.Option(help="Run in headless mode")] = False,
14+
open_viewer: Annotated[bool, typer.Option(help="Open live viewer")] = False,
1515
) -> AgentResponse:
16-
with notte.Session(headless=headless) as session:
16+
with notte.Session(open_viewer=open_viewer) as session:
1717
agent = notte.Agent(reasoning_model=reasoning_model, session=session)
1818
return agent.run(task=task)
1919

examples/email-notifier-agent/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def main():
2121
receiver_email=str(os.environ["EMAIL_RECEIVER"]),
2222
)
2323
)
24-
with notte.Session(headless=False) as session:
24+
with notte.Session(open_viewer=True) as session:
2525
notifier_agent = notte.Agent(notifier=notifier, session=session)
2626

2727
response = notifier_agent.run(task="Make a summary of the financial times latest news")

examples/order-on-ubereats/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def main():
4141
card_full_expiration="CREDIT_CARD_EXPIRATION",
4242
)
4343

44-
with notte.Session(headless=False) as session:
44+
with notte.Session(open_viewer=True) as session:
4545
with notte.Vault() as vault:
4646
vault.add_credentials(url="uber.com", **load_env_vars(cred_env_vars))
4747
vault.set_credit_card(**load_env_vars(cc_env_vars))

examples/quickstart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717

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

20-
with client.Session(headless=False) as session:
20+
with client.Session(open_viewer=True) as session:
2121
agent = client.Agent(reasoning_model=reasoning_model, max_steps=max_steps, session=session)
2222
response = agent.run(task=task)

examples/quickstart_launcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
def run_notte_quickstart(task: str, max_steps: int, reasoning_model: str):
2020
client = NotteClient(api_key=os.getenv("NOTTE_API_KEY"))
2121

22-
with client.Session(headless=False) as session:
22+
with client.Session(open_viewer=True) as session:
2323
agent = client.Agent(reasoning_model=reasoning_model, max_steps=max_steps, session=session)
2424
agent.run(task=task)
2525

examples/scrape-nike-products/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def scrape_nike_products():
112112
run_dir = RESULT_DIR / timestamp
113113
run_dir.mkdir(exist_ok=True, parents=True)
114114

115-
with notte.Session(headless=False) as session:
115+
with notte.Session(open_viewer=True) as session:
116116
categories = scrape_categories(session)
117117
_ = (run_dir / "categories.json").write_text(categories.model_dump_json())
118118
outputs: list[list[ShoppingItem]] = []

0 commit comments

Comments
 (0)