AI-powered comprehensive web research using Claude and Exa. This application uses a multi-agent pipeline to conduct thorough research on any topic and generate professional reports.
- Multi-Agent Pipeline: Orchestrates 3 specialized agents working in sequence
- Deep Web Search: Uses Exa API for semantic search and content retrieval
- Professional Reports: Generates well-structured research reports with inline citations
- Real-time Progress: Visual pipeline progress tracking during research
- Streaming Results: Live updates as each stage completes
The research pipeline consists of 3 specialized agents:
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Planner │ -> │ WebSearch │ -> │ ReportWriter │
│ │ │ │ │ │
│ Creates │ │ Gathers │ │ Generates │
│ search │ │ sources │ │ final │
│ strategy │ │ from web │ │ report │
└──────────────┘ └──────────────┘ └──────────────┘
- Planner Agent: Analyzes the topic and creates optimized search queries with date ranges
- WebSearch Agent: Executes searches using Exa API, gathers and reads source content
- ReportWriter Agent: Produces a comprehensive markdown report with citations
- Frontend: Next.js 15, React 19, Tailwind CSS
- AI: Claude (via Claude Agent SDK), Anthropic API
- Search: Exa API (semantic web search)
- Deployment: Vercel with Vercel Sandbox for production
- Node.js 18+
- Anthropic API key
- Exa API key (get one here)
- Clone the repository:
git clone https://github.com/dair-ai/deep-research-agent.git
cd deep-research-agent- Install dependencies:
npm install- Copy the environment file and add your keys:
cp .env.example .env.local- Edit
.env.localwith your API keys:
ANTHROPIC_API_KEY=your-anthropic-api-key
EXA_API_KEY=your-exa-api-key- Run the development server:
npm run dev- Open http://localhost:3000 in your browser.
The app uses Vercel Sandbox to run the Claude Agent SDK in production. This is necessary because Vercel serverless functions can't spawn subprocesses, but the SDK requires this capability for MCP servers.
- Go to Vercel Account Tokens
- Click "Create Token"
- Name it (e.g., "deep-research-sandbox")
- Set scope to your account or team
- Copy the token (you won't see it again!)
After deploying to Vercel:
- Project ID: Go to your project → Settings → General → scroll to "Project ID"
- Team ID (if using a team): Go to Team Settings → General → "Team ID"
In your Vercel project dashboard, go to Settings → Environment Variables and add:
| Variable | Description | Required |
|---|---|---|
ANTHROPIC_API_KEY |
Your Anthropic API key | Yes |
EXA_API_KEY |
Your Exa API key | Yes |
VERCEL_TOKEN |
Vercel API token (from Step 1) | Yes (production) |
VERCEL_PROJECT_ID |
Your Vercel project ID | Yes (production) |
VERCEL_TEAM_ID |
Your Vercel team ID | If using a team |
- Push your code to GitHub
- Import the repository in Vercel
- Vercel will auto-detect Next.js settings
- Deploy!
When running in production on Vercel:
- A research request comes in to
/api/research - The API detects it's running on Vercel (
VERCELenv var) - Instead of running the SDK directly, it creates a Vercel Sandbox
- The sandbox is an isolated container with Node.js 22
- Inside the sandbox:
- Dependencies are installed (
@anthropic-ai/claude-agent-sdk,exa-js,zod) - The research script runs with full subprocess capabilities
- Exa API searches are executed
- Results stream back to the main API
- Dependencies are installed (
- The sandbox is cleaned up after completion
This allows the Claude Agent SDK to work properly in a serverless environment.
| Variable | Description |
|---|---|
ANTHROPIC_API_KEY |
Your Anthropic API key |
EXA_API_KEY |
Your Exa API key |
| Variable | Description |
|---|---|
ANTHROPIC_API_KEY |
Your Anthropic API key |
EXA_API_KEY |
Your Exa API key |
VERCEL_TOKEN |
Vercel API token for sandbox authentication |
VERCEL_PROJECT_ID |
Your Vercel project ID |
VERCEL_TEAM_ID |
Your Vercel team ID (optional, for team accounts) |
src/
├── app/
│ ├── api/research/ # Research API endpoint
│ └── page.tsx # Main page
├── components/
│ └── research/ # Research UI components
├── hooks/
│ └── useResearchAgent.ts # Research state management
├── lib/
│ ├── agent/ # Agent configuration & prompts
│ │ ├── config.ts # Orchestrator and agent config
│ │ ├── subagents.ts # Subagent definitions
│ │ ├── tools.ts # Exa MCP tools (local)
│ │ └── prompts.ts # Research prompts
│ └── sandbox/ # Vercel Sandbox runner
│ └── runner.ts # Sandbox script generation
└── types/
└── research.ts # TypeScript types
- Update the Claude Agent SDK:
npm install @anthropic-ai/claude-agent-sdk@latest
- Verify
VERCEL_TOKENis set correctly - Check that
VERCEL_PROJECT_IDmatches your project - If using a team, ensure
VERCEL_TEAM_IDis set - Check Vercel logs for sandbox creation errors
- Verify
EXA_API_KEYis valid - Check date ranges aren't too restrictive
- Try broader search queries
MIT