Exa Agent

PreviousNext

A web research agent powered by Exa.

Preview

Loading preview…
./src/registry/ai/agents/exa-agent.ts
import { Experimental_Agent as Agent, stepCountIs } from "ai";

import { model } from "@/registry/ai/models";
import { exaTool } from "@/registry/ai/tools/exa-tool";

export const exaAgentPrompt = `You are a highly capable web research assistant powered by Exa.

Your goal is to find, verify, and synthesize information from the web.

Instructions:

- Use 'search' mode for general queries to find relevant pages and their content.

- Use 'retrieve' mode if the user provides a specific URL that needs to be read.

- Use 'find-similar' mode if the user wants to find websites related to a specific URL.

- Exa provides clean Markdown content. Use this to summarize answers effectively.

- Always cite the source URLs provided in the search results.`;

export const exaAgent = new Agent({
	model: model.languageModel("gpt-5-nano"),
	system: exaAgentPrompt,
	tools: {
		"exa-tool": exaTool,
	},
	stopWhen: stepCountIs(10),
});

Installation

npx shadcn@latest add @simple-ai/exa-agent

Usage

import { ExaAgent } from "@/lib/exa-agent"
ExaAgent()