Documentation menu
Documentation

Browser tools

Give an agent a sandboxed browser tool set without hand-writing every binding.

Start from a fresh project

This guide is self-contained. Create an empty Ayjnt project, then replace the starter agent with the files shown below. Run commands from the new project directory unless a step says otherwise.

terminal
bunx ayjnt new try-browser --empty
cd try-browser
bun install

# remove agents/alive once you are ready to add the guide's files

One runtime helper

Importing ayjnt/browser signals code generation to add the Browser Rendering, Worker Loader, AI, and compatibility configuration needed by Cloudflare’s browser tools.

example
import { browserTools } from "ayjnt/browser";

const result = await generateText({
  model,
  messages,
  tools: browserTools(this),
});

Local endpoint

When a Browser binding is unavailable locally, pass a CDP URL for a Chromium instance. Browser tools are agent-runtime capabilities; they are different from Bun host tools.

Run it and verify the result

Run the example request and inspect the returned page title or extracted text instead of a raw browser session.

terminal
bun run build
bun run dev

# the local app is now available at http://localhost:8787