The problem
Downloading a webpage does not let your agent press buttons, follow a multi-step flow or wait for content to appear. Tasks that depend on those interactions need an actual browser the agent can control.
How NativePort helps
NativePort connects your agent to Browserbase to open a browser session it can use to navigate a website. Your agent can follow links, interact with the page and read the result of each step.
For example, it can open a quotes website, follow an author’s biography link and read the author’s name from the destination page. You can start with a small, visible task before building a longer workflow.
Let your agent build it
You don’t need to write this code yourself. Copy the prompt and paste it into your agent. It will follow NativePort’s setup guide, help you use an existing account or create one, read this page, and ask what you’d like to do next.
View prompt
Help me use NativePort for this use case. 1. Read https://nativeport.ai/SKILL.md and follow its instructions to learn how to use NativePort. Save or update the skill if your environment supports it. 2. Check whether I already have a working NativePort connection or account. Reuse it if available. Otherwise, help me sign in or create an account by following the skill's setup instructions. Guide me through any steps that require me to use a browser, then help connect my agent. Keep credentials private. 3. Follow the skill to learn how to find the right tools, check their prices and instructions, and use them through NativePort. 4. Read this entire use-case page, including the instructions for agents inside the accordion: https://nativeport.ai/use-cases/navigate-websites-with-your-agent/ Once setup is complete and you have read the page, briefly explain what you can help me do and ask me what I would like to do next. Wait for my answer before implementing the example or running paid tools.
Instructions for the agents - You don't need to read this
Technical implementation
Use Python 3. Install requests with python -m pip install requests and set NATIVEPORT_API_KEY to your NativePort key in your server environment. Keep the key out of browser code.
Install playwright with python -m pip install playwright. No local browser download is needed for this remote connection. NativePort creates and releases the session over HTTP; Playwright connects directly to the returned Browserbase connectUrl over CDP. Treat that URL as a credential and do not log it. See the NativePort Browserbase reference.
import os
import requests
from playwright.sync_api import sync_playwright
BASE = "https://api.nativeport.ai/browserbase/v1/sessions"
HEADERS = {"Authorization": f"Bearer {os.environ['NATIVEPORT_API_KEY']}"}
response = requests.post(BASE, headers=HEADERS, json={}, timeout=60)
response.raise_for_status()
session = response.json()
try:
with sync_playwright() as playwright:
browser = playwright.chromium.connect_over_cdp(session["connectUrl"])
try:
context = browser.contexts[0]
page = context.pages[0] if context.pages else context.new_page()
page.set_default_timeout(30000)
page.goto("https://quotes.toscrape.com/", wait_until="domcontentloaded")
page.locator(".quote a[href*='/author/']").first.click()
print({"source_url": page.url,
"author": page.locator(".author-title").inner_text()})
finally:
browser.close()
finally:
release = requests.post(f"{BASE}/{session['id']}", headers=HEADERS,
json={"projectId": session["projectId"], "status": "REQUEST_RELEASE"}, timeout=60)
release.raise_for_status()Use selectors verified for the target site and check the destination after each meaningful action. The gateway exposes session creation, update and detail, not Browserbase’s full platform. This example does not log in, submit a form or make a purchase; those workflows need their own user instructions and checks. Release failures should be surfaced so the agent can reconcile the session.
Tool costs
| Tool used in the example | Price per call |
|---|---|
| Browserbase — one session creation and one release (two calls) | $0.01055 / call |
The example uses two requests at the displayed per-call price: one to create the browser session and one to release it. This route uses a flat price per request; browser time over the direct connection is not represented as a per-click price. Extra session-detail requests add usage.
Prices in USD. Usage-based tools have no fixed per-call price. View pricing.