Public
Likeduck
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v173View latest version
BYOA (Bring Your Own Agent) to Slack.
Based on the Vercel Slackbot Agent Guide, adapted for Val Town.
This template uses Claude Sonnet 4.6 directly in
lib/generate-response.ts, which requires setting
an ANTHROPIC_API_KEY environment variable. Alternatively, you could use a
gateway to switch between models easily, like the
Vercel AI Gateway or the
Kilo Gateway.
This agent comes with the following tools:
You should of course edit and add your own tools! That's the whole point of BYOA :)
duck/
├── events.ts # HTTP entry point (Hono app, Slack event router)
├── prompt.md # System prompt for your agent
├── README.md
└── lib/
├── generate-response.ts # AI core (Claude + MCP + web search)
├── handle-app-mention.ts # Handles @mentions in channels and threads
├── handle-message.ts # Handles DMs in assistant (Slack app) threads
├── handle-thread-started.ts # Greeting + suggested prompts on new assistant thread
└── slack-utils.ts # Slack client and utils
This val uses pinned imports (latest package version as of 2/19/26) to avoid breaking changes:
@slack/web-api@7.14.1hono@4.12.0ai@6.0.92@ai-sdk/anthropic@3.0.45@ai-sdk/mcp@1.0.21
It's "duck" as in rubber duck debugging. But you can call your agent whatever you'd like!