Skip to main content

1. Install AgentKit

Install AgentKit, Browserbase, and Playwright core:
Don’t have an existing project? Create a new one with your preferred package manager before continuing.

2. Set up an AgentKit network with an agent

Create an agent and its associated network, for example a Reddit search agent:
Node.js

3. Create a Browserbase tool

Configure the Browserbase SDK and create a tool that can search Reddit:
Node.js
Configure your BROWSERBASE_API_KEY in the .env file. You can find your API key in the Browserbase dashboard.
Build tools using Browserbase with Inngest’s step.run() function. This ensures the tool only runs once across multiple runs. See the multi-step tools page for more on step.run().

4. Put it all together

Here’s the full example:
Node.js
For a complete working example, check out the Reddit search agent using Browserbase example.

Expected output

The browser tool logs the search URL and a JSON array of extracted titles and content. The final line prints execution.output, which depends on the query and model response; inspect the returned sources to verify the result.

Cleanup

The browser tool closes its connection in finally. Stop any local development server with Ctrl+C, and confirm that sessions ended in the Sessions dashboard if you interrupted a run.

Next steps

AgentKit docs

Full AgentKit SDK reference and examples

Stagehand

Autonomous browser automation SDK