- Create your own Browserbase tools: useful if you want to build simple actions on webpages with manual browser control.
- Use Browserbase’s Stagehand library as tools: a better approach for autonomous browsing and resilient scraping.
Building AgentKit tools using Browserbase
Creating AgentKit tools using the Browserbase TypeScript SDK is straightforward.1
Install AgentKit
Within an existing project, install AgentKit, Browserbase and Playwright core:
Don't have an existing project?
Don't have an existing project?
To create a new project, create a new directory then initialize using your package manager:
2
2. Setup an AgentKit Newtork with an Agent
Create a Agent and its associated Network, for example a Reddit Search Agent:
3
Create a Browserbase tool
Let’s configure the Browserbase SDK and create a tool that can search Reddit:
Configure your
BROWSERBASE_API_KEY
and BROWSERBASE_PROJECT_ID
in the
.env
file. You can find your API key and project ID from the Browserbase
dashboard.We recommend building tools using Browserbase using Inngest’s
step.run()
function. This ensures that the tool will only run once across multiple runs.More information about using step.run()
can be found in the Multi steps tools page.Example: Reddit Search Agent using Browserbase
You will find a complete example of a Reddit search agent using Browserbase in the Reddit Search Agent using Browserbase example:Reddit Search Agent using Browserbase
This examples shows how to build tools using Browserbase to power a Reddit search agent.
AgentsToolsNetworkIntegrations
AgentsToolsNetworkIntegrations
Enable autonomous browsing with Stagehand
Building AgentKit tools using Stagehand gives more autonomy to your agents. Stagehand comes with 4 primary API that can be directly used as tools:goto()
: navigate to a specific URLobserve()
: observe the current pageextract()
: extract data from the current pageact()
: take action on the current page
These 4 AgentKit tools using Stagehand enables the Web Search Agent to browse the web autonomously.The
getStagehand()
helper function is used to retrieve the persisted instance created for the network execution (see full code below).Simple Search Agent using Stagehand
This examples shows how to build tools using Stagehand to power a simple search agent.
AgentsToolsNetworkIntegrations
AgentsToolsNetworkIntegrations