Run Hyperbrowser with Instant
Hyperbrowser runs the open-source browser-use agent or HyperAgent in a browser you open, with a live view and a saved profile. This page is part of Run browser agents with Instant. Before you start, follow Set up the project there: turn on Instant, install the SDK, and set COMPOSIO_API_KEY and COMPOSIO_USER_ID.
The script opens a browser for one user, runs a small task on https://example.com, prints the result, and then cleans up everything it created. Every script starts with a run() helper that executes one tool on the user's Instant account and raises if the call fails; the API scripts use an equivalent call helper and a trap that cleans up on exit. If a call fails, read Errors you may see.
HYPERBROWSER_CREATE_SESSION opens a browser for the user's profile and returns its live_url immediately. Run tasks on it with session_id and keep_browser_open, then poll HYPERBROWSER_GET_BROWSER_USE_TASK_STATUS until it ends; its last response holds the answer. HYPERBROWSER_STOP_SESSION closes the browser and saves its cookies into the profile.
What the example contains
| Part | What it does |
|---|---|
ProfileHYPERBROWSER_CREATE_PROFILE | Stores the user's cookies. Create it once per user and keep its id. |
BrowserHYPERBROWSER_CREATE_SESSION | Opens a browser with the profile loaded. timeout_minutes is required and sets how long the browser can run. persist_changes: true saves cookies back when the browser stops. Returns id and live_url. |
| Live view | live_url is available as soon as the browser opens. Embed it in an iframe. |
TaskHYPERBROWSER_START_BROWSER_USE_TASK | Runs the open-source browser-use agent on your task in that browser. max_steps caps the agent's steps; keep_browser_open lets you run more tasks on the same browser. Returns the task id. |
Status loopHYPERBROWSER_GET_BROWSER_USE_TASK_STATUS | Reads status until it is completed, failed, or stopped. |
| Result | When the status is final, the same status response holds the answer in data.final_result and the agent's steps in data.steps. |
CleanupHYPERBROWSER_STOP_SESSION, HYPERBROWSER_DELETE_PROFILE | Stopping the browser saves cookies into the profile. Stop before you delete the profile. |
import os
import time
from composio import Composio
composio = Composio()
session = composio.create(
user_id=os.environ["COMPOSIO_USER_ID"], toolkits=["hyperbrowser"]
)
def run(slug: str, arguments: dict) -> dict:
result = session.execute(
slug, arguments=arguments, account="instant_account"
)
if result.result_type != "completed":
raise RuntimeError(f"{slug} failed: {result.error}")
return result.data
# Once per end user: a profile keeps their sign-ins between browsers.
profile_id = run("HYPERBROWSER_CREATE_PROFILE", {})["id"]
try:
browser = run(
"HYPERBROWSER_CREATE_SESSION",
{
"timeout_minutes": 5,
"profile": {"id": profile_id, "persist_changes": True},
},
)
print("Live view:", browser["live_url"])
try:
task = run(
"HYPERBROWSER_START_BROWSER_USE_TASK",
{
"task": "Open https://example.com and return the page title.",
"session_id": browser["id"],
"keep_browser_open": True,
"max_steps": 5,
},
)
while True:
status = run(
"HYPERBROWSER_GET_BROWSER_USE_TASK_STATUS",
{"run_id": task["id"]},
)
if status["status"] in ("completed", "failed", "stopped"):
break
time.sleep(3)
print(status["status"], status["data"]["final_result"])
finally:
# Stopping the browser saves its cookies into the profile.
run("HYPERBROWSER_STOP_SESSION", {"session_id": browser["id"]})
finally:
run("HYPERBROWSER_DELETE_PROFILE", {"profile_id": profile_id})HYPERBROWSER_START_HYPER_AGENT_TASK and its status and result tools follow the same pattern with HyperAgent. max_steps caps the agent's steps, so keep it small.
All tools in this toolkit
Every Hyperbrowser tool you can call with the Instant account. Proxies, CAPTCHA solving, extensions, and custom model keys are refused on Instant. Required arguments are listed; open a tool in the toolkit catalog for every argument and response field.
Agent tasks
| Tool | What it does | Required arguments |
|---|---|---|
HYPERBROWSER_GET_BROWSER_USE_TASK_RESULT | Deprecated. Use HYPERBROWSER_GET_BROWSER_USE_TASK_STATUS, which also returns the answer. | run_id |
HYPERBROWSER_GET_BROWSER_USE_TASK_STATUS | Retrieve the current status of a browser-use task. | run_id |
HYPERBROWSER_GET_HYPER_AGENT_TASK_RESULT | Retrieve the status and results of a HyperAgent task. | run_id |
HYPERBROWSER_GET_HYPER_AGENT_TASK_STATUS | Get the current status of a HyperAgent task. | run_id |
HYPERBROWSER_START_BROWSER_USE_TASK | Start an asynchronous browser-use task. | task |
HYPERBROWSER_START_HYPER_AGENT_TASK | Start an asynchronous HyperAgent browser task. | task |
HYPERBROWSER_STOP_BROWSER_USE_TASK | Stop a running browser-use task. | run_id |
HYPERBROWSER_STOP_HYPER_AGENT_TASK | Stop a running HyperAgent task. | run_id |
Browser sessions
| Tool | What it does | Required arguments |
|---|---|---|
HYPERBROWSER_CREATE_SESSION | Create a new browser session with custom stealth, proxy, and privacy settings. | None |
HYPERBROWSER_GET_SESSION_DETAILS | Retrieve details of a Hyperbrowser session by ID, including status and configuration. | session_id |
HYPERBROWSER_GET_SESSION_DOWNLOADS_URL | Retrieve the downloads URL for a session. | session_id |
HYPERBROWSER_GET_SESSION_RECORDING | Retrieve a browser session's rrweb recording status and, when available, a pre-signed download URL. | session_id |
HYPERBROWSER_GET_SESSION_VIDEO_RECORDING_URL | Retrieve a browser session's video recording status and, when available, a pre-signed download URL. | session_id |
HYPERBROWSER_STOP_SESSION | Stop a running session by ID. | session_id |
Profiles
| Tool | What it does | Required arguments |
|---|---|---|
HYPERBROWSER_CREATE_PROFILE | Creates a new persistent Hyperbrowser profile for storing browser state (cookies, sessions, etc.). | None |
HYPERBROWSER_DELETE_PROFILE | Delete a profile. | profile_id |
HYPERBROWSER_FORK_PROFILE | Copy an existing browser profile and its stored browser state into a new profile. | id |
HYPERBROWSER_GET_PROFILE | Retrieves details of a specific Hyperbrowser profile by its UUID. | profile_id |
HYPERBROWSER_LIST_PROFILES | List profiles. | None |
Scrape, crawl and search
| Tool | What it does | Required arguments |
|---|---|---|
HYPERBROWSER_CREATE_SCRAPE_JOB | Initiate a new scrape job. | url |
HYPERBROWSER_FETCH_WEB_PAGE | Fetch a web page and return content in various formats (HTML, Markdown, JSON, screenshot, etc.). | url |
HYPERBROWSER_GET_SCRAPE_JOB_RESULT | Retrieves the status and results of a scrape job. | id |
HYPERBROWSER_GET_SCRAPE_JOB_STATUS | Retrieve the current status of a specific scrape job. | id |
HYPERBROWSER_GET_WEB_CRAWL_RESULT | Retrieve the status and results of a web crawl job. | id |
HYPERBROWSER_GET_WEB_CRAWL_STATUS | Retrieve just the status of a web crawl job without the full results. | id |
HYPERBROWSER_SEARCH_WEB | Perform a web search and retrieve results with titles, URLs, and descriptions. | query |
HYPERBROWSER_START_WEB_CRAWL | Start an asynchronous web crawl job from a starting URL, with options to follow links and configure content extraction. | url |
Try it with your own task
Replace the task in the script with your own. For example:
Search https://en.wikipedia.org for "Ada Lovelace" and return the first sentence of the article.Next steps
- Compare the other browser toolkits in Run browser agents with Instant.
- To move an app from Browser Use, follow Browser Use to Hyperbrowser.
- Read how to clean up.