Skip to content
Agent Stack
  • AI SDK
  • AI Gateway
  • Sandbox
  • Passport
  • Connect
  • eve
Core Platform
  • Security
  • Content Delivery
  • Fluid Compute
  • Observability
  • Workflows
  • CI/CD
Tools
  • Next.js
  • Vercel Agent
  • Vercel Plugin
  • Open Source
  • Domains↗
  • v0↗
Learn
  • Docs
  • About
  • Blog
  • Changelog
  • Knowledge Base
Build
  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce
Explore
  • Customers
  • Marketplace
  • Partner Finder
  • AWS
  • Community↗
EnterprisePricing
Contact
Log InSign Up
Dashboard

Products

Agent Stack

  • AI SDK
  • AI Gateway
  • Sandbox
  • Passport
  • Connect
  • eve

Core Platform

  • Security
  • Content Delivery
  • Fluid Compute
  • Observability
  • Workflows
  • CI/CD

Tools

  • Next.js
  • Vercel Agent
  • Vercel Plugin
  • Open Source
  • Domains↗
  • v0↗
Resources

Learn

  • Docs
  • About
  • Blog
  • Changelog
  • Knowledge Base

Build

  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce

Explore

  • Customers
  • Marketplace
  • Partner Finder
  • AWS
  • Community↗
Enterprise
Pricing
Sign UpLog In
Contact

Claude Managed Agents with Chat SDK

Ship a Slack research bot built on Claude Managed Agents and Chat SDK.

DeployView Demo

Claude Managed Agents research analyst

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.

Stack

LayerChoice
SurfaceSlack via Chat SDK and Vercel Connect
AgentClaude Managed Agents with Claude Sonnet 5
StateUpstash Redis
RuntimeNext.js 16 on Vercel

Quickstart

Requires Node.js 24+, an Anthropic API key with Managed Agents access, Vercel project, and Redis.

1. Clone and install

git clone https://github.com/vercel-labs/claude-research-bot
cd claude-research-bot
pnpm install

2. Connect Slack and Redis

Add Slack with Vercel Connect:

vercel link
vercel connect create slack --name claude-research-bot --triggers
vercel connect attach slack/claude-research-bot \
--project YOUR_VERCEL_PROJECT \
--environment production \
--triggers \
--trigger-path /api/webhooks/slack

Add Upstash Redis from the Vercel Marketplace:

vercel integration add upstash/upstash-kv

3. Create the Managed Agent

Add ANTHROPIC_API_KEY to .env.local, then run:

npm run cma:setup -- --vercel

This one-time command creates the agent and sandbox environment, writes both IDs to .env.local, and adds them to the linked Vercel project.

4. Deploy

vercel env add ANTHROPIC_API_KEY
vercel deploy --prod

Invite 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.

Environment variables

VariableRequiredDefaultWhat it does
ANTHROPIC_API_KEYYesNoneAuthenticates Claude Managed Agents
CLAUDE_AGENT_IDYesNonePersistent analyst created by npm run cma:setup
CLAUDE_ENVIRONMENT_IDYesNoneAnthropic-managed sandbox created by setup
REDIS_URLYesNoneStores subscriptions, deduplication, and thread/session mappings
SLACK_CONNECTORYesNoneVercel Connect Slack connector UID
BOT_USERNAMENoclaude-research-botChat SDK bot name
CLAUDE_DEBUG_MODENofalsePosts per-turn diagnostics and a Claude Console link

Customize the analyst

The model and system prompt live in scripts/cma/lib/agent.ts.

Publish changes as a new agent version:

npm run cma:update

Anthropic 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.

Debug mode

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.

Key files

FilePurpose
src/lib/bot.tsChat SDK configuration and Slack handler registration
src/lib/research-handler.tsParticipant policy and thread/session orchestration
src/lib/managed-agents.tsSession validation, turn queue, event stream, and token previews
src/lib/config.tsTyped runtime configuration and required env validation
src/lib/debug-card.tsxDebug Mode diagnostics card
src/app/api/webhooks/[platform]/route.tsFast webhook acknowledgement and background dispatch
scripts/cma/cli.tsDispatches setup, update, and archive commands
scripts/cma/lib/agent.tsModel, system prompt, and tool posture
scripts/cma/setup.tsOne-time agent and environment provisioning
scripts/cma/update.tsPublishes a new agent version
scripts/cma/archive.tsArchives Managed Agents resources
scripts/cma/lib/env.tsShared local environment loading and persistence

Cleanup

Archive the persistent Anthropic resources when finished:

npm run cma:archive

Because archiving is permanent, confirm both Managed Agents IDs before running the command.

References

  • Claude Managed Agents × Chat SDK guide
  • Claude Managed Agents overview
  • Claude Managed Agents events and streaming
  • Chat SDK docs
  • Slack adapter
  • Vercel Connect
GitHub
Ownervercel-labs
Repositorycma-chat-sdk
Use Cases
AI
Starter
Backend
Stack
Next.js

Related Templates

eve Sanity Copilot

Give your team a Sanity copilot in Slack. It runs GROQ, edits schemas, manages releases, and asks before it touches production.
eve Sanity Copilot thumbnail

eve Software Factory

Software factory built on eve: AI agents work each stage of the development loop, and people make the judgment calls.
eve Software Factory thumbnail

eve Marketing Team

Marketing team in Slack: one lead, five specialists. Blog drafts in Notion, posts in Typefully, campaigns in Resend, on approval.
eve Marketing Team thumbnail

Agent Stack

  • AI SDK
  • AI Gateway
  • Sandbox
  • Workflows
  • ConnectNew
  • PassportNew
  • eveNew

Core Platform

  • CI/CD
  • Content Delivery
  • Fluid Compute
  • Observability

Security

  • Platform Security
  • WAF
  • Bot Management
  • BotID

Tools

  • Vercel DropNew
  • Vercel Agent
  • Vercel PluginNew
  • Agent Skills
  • Domains
  • v0

Frameworks

  • eveNew
  • Next.js
  • Nuxt
  • SvelteKit
  • Nitro
  • Turborepo
  • Tanstack Start
  • FastAPI
  • xmcp
  • All frameworks

SDKs

  • Vercel SDK
  • Workflow SDKNew
  • Flags SDK
  • Chat SDKNew
  • Queues SDKNew
  • Streamdown

Build

  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce
  • Platform Engineers
  • Design Engineers

Learn

  • Docs
  • Blog
  • Changelog
  • Knowledge Base
  • Academy
  • Articles
  • Community
  • Is Agentic

Explore

  • Customers
  • Marketplace
  • Templates
  • Partner Finder
  • Vercel + AWS

Company

  • About
  • Careers
  • Press
  • Events
  • Startups
  • Shipped on Vercel
  • Open Source Program
  • Enterprise
  • Pricing
  • Help

Legal & Trust

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • DPA
  • Acceptable Use Policy
  • Legal (all documents)
  • Trust Center
  • Status

Social

  • GitHub
  • X
  • LinkedIn
  • YouTube
  • Instagram
  • VercelVercel
DeployView Demo

Loading status…

Select a display theme: