This is a Next.js project bootstrapped with create-next-app.
Copy the example environment file and add your API keys:
cp .env.example .env.localThen edit .env.local and add your keys:
ANTHROPIC_API_KEY- Get your key at console.anthropic.comEXA_API_KEY- Get your key at exa.ai
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devOpen http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
This project uses the Claude Agent SDK which requires subprocess spawning for multi-agent orchestration. Since Vercel serverless functions don't support subprocesses, we use Vercel Sandbox to run the agent in an isolated container environment.
Note: Local development works without Sandbox configuration. These steps are only required for production deployment.
Follow these steps to configure Vercel Sandbox for production deployment:
- Go to vercel.com/account/tokens
- Click Create Token
- Give it a name (e.g., "dr-agent-sandbox")
- Set the scope to Full Access (required for Sandbox)
- Copy the token - you won't be able to see it again
- Go to your project on vercel.com
- Navigate to Settings → General
- Scroll down to find Project ID
- Copy the ID (looks like
prj_xxxxxxxxxxxx)
If your project is deployed under a team (not a personal account):
- Go to your team settings on Vercel
- Navigate to Settings → General
- Find and copy your Team ID
Note: If you're using a personal account (not a team), you can skip this step.
- Go to your project on vercel.com
- Navigate to Settings → Environment Variables
- Add the following variables:
| Variable | Value | Required |
|---|---|---|
ANTHROPIC_API_KEY |
Your Anthropic API key | ✅ |
EXA_API_KEY |
Your Exa API key | ✅ |
VERCEL_TOKEN |
Token from Step 1 | ✅ |
VERCEL_PROJECT_ID |
Project ID from Step 2 | ✅ |
VERCEL_TEAM_ID |
Team ID from Step 3 | Only if using a team |
- Make sure each variable is enabled for Production (and Preview/Development if needed)
- Click Save for each variable
After adding the environment variables, trigger a new deployment:
# If using Vercel CLI
vercel --prod
# Or push a commit to trigger auto-deploy
git commit --allow-empty -m "Trigger redeploy"
git pushThis means the Sandbox API rejected the request. Check:
- Token permissions: Make sure your
VERCEL_TOKENhas Full Access scope - Team ID missing: If your project is under a team,
VERCEL_TEAM_IDis required - Project ID mismatch: Verify
VERCEL_PROJECT_IDmatches your deployed project - Plan limitations: Vercel Sandbox may require a Pro or Enterprise plan
The VERCEL_TOKEN environment variable is not set. Add it in your Vercel project settings.
The VERCEL_PROJECT_ID environment variable is not set. Add it in your Vercel project settings.
┌─────────────────────────────────────────────────────────────┐
│ Vercel Serverless │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ /api/research (API Route) │ │
│ │ │ │ │
│ │ ▼ │ │
│ │ Creates Vercel Sandbox ────────────────┼───┼──┐
│ └─────────────────────────────────────────────────────┘ │ │
└─────────────────────────────────────────────────────────────┘ │
│
┌─────────────────────────────────────────────────────────────┐ │
│ Vercel Sandbox │◄─┘
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Claude Agent SDK │ │
│ │ │ │ │
│ │ ┌──────────────┼──────────────┐ │ │
│ │ ▼ ▼ ▼ │ │
│ │ ┌─────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │ Planner │ │ Web │ │ Report │ │ │
│ │ │ Agent │ │ Search │ │ Writer │ │ │
│ │ └─────────┘ │ Agent │ │ Agent │ │ │
│ │ └──────────┘ └──────────┘ │ │
│ │ │ │ │
│ │ ▼ │ │
│ │ Exa Search API │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
Check out our Next.js deployment documentation for more details.