Template name
Ship a Slack research bot built on Claude Managed Agents and Chat SDK.
Claude Managed Agents and Chat SDK power this Slack research bot. Mention it in a channel or send it a DM, and it will search and fetch sources in an Anthropic-managed sandbox before streaming a brief back into the thread.
Each Slack thread maps to one persistent Managed Agents session, so follow-ups retain the thread's prior research context. Vercel Connect owns the Slack app and credentials, while Redis preserves subscriptions, session mappings, and webhook deduplication across deployments.
| Layer | Choice |
|---|---|
| Surface | Slack via Chat SDK and Vercel Connect |
| Agent | Claude Managed Agents with Claude Sonnet 5 |
| State | Upstash Redis |
| Runtime | Next.js 16 on Vercel |
Requires Node.js 24+, an Anthropic API key with Managed Agents access, Vercel project, and Redis.
git clone https://github.com/vercel-labs/claude-research-botcd claude-research-botpnpm installAdd Slack with Vercel Connect:
vercel linkvercel connect create slack --name claude-research-bot --triggersvercel connect attach slack/claude-research-bot \ --project YOUR_VERCEL_PROJECT \ --environment production \ --triggers \ --trigger-path /api/webhooks/slackAdd Upstash Redis from the Vercel Marketplace:
vercel integration add upstash/upstash-kvAdd ANTHROPIC_API_KEY to .env.local, then run:
npm run cma:setup -- --vercelThis one-time command creates the agent and sandbox environment, writes both IDs to .env.local, and adds them to the linked Vercel project.
vercel env add ANTHROPIC_API_KEYvercel deploy --prodInvite the bot to the Slack channels where it should answer or message the bot directly.
In a thread with one human participant, follow-ups do not need another @mention. Once multiple humans participate, the bot responds only when explicitly mentioned.
| Variable | Required | Default | What it does |
|---|---|---|---|
ANTHROPIC_API_KEY | Yes | None | Authenticates Claude Managed Agents |
CLAUDE_AGENT_ID | Yes | None | Persistent analyst created by npm run cma:setup |
CLAUDE_ENVIRONMENT_ID | Yes | None | Anthropic-managed sandbox created by setup |
REDIS_URL | Yes | None | Stores subscriptions, deduplication, and thread/session mappings |
SLACK_CONNECTOR | Yes | None | Vercel Connect Slack connector UID |
BOT_USERNAME | No | claude-research-bot | Chat SDK bot name |
CLAUDE_DEBUG_MODE | No | false | Posts per-turn diagnostics and a Claude Console link |
The model and system prompt live in scripts/cma/lib/agent.ts.
Publish changes as a new agent version:
npm run cma:updateAnthropic pins each session to the agent version that created it, so test changes in a new Slack thread. Use npm run cma:update for prompt changes, not npm run cma:setup.
The setup disables Bash because the analyst reads untrusted web pages. If Bash were auto-approved with open network access, a malicious page could trick it into sending conversation data to an attacker.
Set CLAUDE_DEBUG_MODE=true to post a compact diagnostics table after every completed turn. It includes duration, model requests, token and prompt-cache usage, web searches and fetches, and a Claude Console session link.
| File | Purpose |
|---|---|
src/lib/bot.ts | Chat SDK configuration and Slack handler registration |
src/lib/research-handler.ts | Participant policy and thread/session orchestration |
src/lib/managed-agents.ts | Session validation, turn queue, event stream, and token previews |
src/lib/config.ts | Typed runtime configuration and required env validation |
src/lib/debug-card.tsx | Debug Mode diagnostics card |
src/app/api/webhooks/[platform]/route.ts | Fast webhook acknowledgement and background dispatch |
scripts/cma/cli.ts | Dispatches setup, update, and archive commands |
scripts/cma/lib/agent.ts | Model, system prompt, and tool posture |
scripts/cma/setup.ts | One-time agent and environment provisioning |
scripts/cma/update.ts | Publishes a new agent version |
scripts/cma/archive.ts | Archives Managed Agents resources |
scripts/cma/lib/env.ts | Shared local environment loading and persistence |
Archive the persistent Anthropic resources when finished:
npm run cma:archiveBecause archiving is permanent, confirm both Managed Agents IDs before running the command.


Build a TanStack Start chat with eve, interactive cards, sortable tables, follow-up forms, and conversations with shareable URLs.

Coordinate a marketing lead and five specialist agents in Slack, with Notion drafts, Typefully posts, and Resend email campaigns.

Turn GitHub and Linear issues into reviewed draft pull requests with specialist eve agents and human approval before shipping.