Web Agent

Web research agent with search, answer, deep research, browser automation (Anchor), and websets via Exa.

Try a capability

Search & citeDeep researchBrowserWebset

Install the agent in your project, then configure environment variables in the Installation section below.

pnpm dlx agentcn@latest add web-agent

Run the demo app locally for a live agent with your API keys in .env.local:

cd examples/agent-ui-template
pnpm install
pnpm dev:embed

Installation

pnpm dlx agentcn@latest add web-agent

Wire your API route

Create app/api/chat/route.ts in your Next.js app:

import { webAgent } from "@/agents/web"; import { convertToModelMessages, type UIMessage } from "ai"; export async function POST(req: Request) { const { messages }: { messages: UIMessage[] } = await req.json(); const result = webAgent(await convertToModelMessages(messages)); return result.toUIMessageStreamResponse(); }

The CLI adds a @/agents/* path alias pointing at ./ai/agents/* in your tsconfig.json.

API keys required

The web agent needs live provider API keys — there is no mock or offline fallback. Set these in .env.local before testing:

Configuration

Environment variables required by web-agent.

Tools

The agent exposes these tools (see ai/agents/web/tools/toolset.ts):

  • web_search — search the web for up-to-date information
  • answer_question — answer a question with source-backed evidence
  • deep_research — longer investigations using web sources
  • use_browser — automate tasks on websites when interaction is required
  • create_webset — comprehensive entity collection via Exa websets