Lead Agent is an open-source reference architecture from Vercel Labs for an inbound lead qualification and research agent, built on Next.js 16, the Vercel AI SDK, Workflow DevKit, and the Vercel Slack Adapter. It turns a contact-sales form submission into a durable background workflow that researches the lead, scores them, drafts a personalized email, and routes the email for human approval in Slack before sending.
What is Lead Agent?
Lead Agent is a template application that captures a lead in a contact sales form and immediately returns a success response, then runs a qualification workflow in the background. It uses Workflow DevKit for durable tasks, the AI SDK Agent class with Exa.ai web search for deep research, generateObject to categorize leads into classes such as QUALIFIED, FOLLOW_UP, and SUPPORT, and generateText to write the response email. The entire pipeline is hosted on Vercel's AI Cloud, and the repository is maintained under vercel-labs with an MIT license.
Key Features
- Durable workflow execution — Workflow DevKit fires background tasks that run asynchronously; the workflow chain is defined in
workflows/inbound/steps.ts. - AI-powered lead qualification — Uses the AI SDK's
generateObjectwith OpenAI models to classify leads and provide reasoning; the qualification category schema is editable inlib/types.ts. - Deep research agent — Built on the AI SDK Agent class, it consumes a
queryKnowledgeBaseplaceholder and Exa.ai search to gather information about the lead. - Human-in-the-loop Slack approval — Generated emails are posted to a Slack channel with Approve/Reject Block Kit buttons; a Slack webhook catches the response and either sends the email or stops the flow.
- Vercel Slack Bolt adapter — Uses Bolt for JavaScript with
@vercel/slack-boltto handle Slack events in a serverless environment, with a manifest.json for app configuration. - Extensible architecture — Replace placeholder service functions in
lib/services.ts, add qualification categories via schema changes, and create new workflows for other outreach flows. - Immediate user feedback — The form submission endpoint responds instantly, while the slow research and qualification work runs asynchronously.
Who is it for?
Lead Agent is aimed at development teams building sales automation and lead-handling systems. Sales engineers can fork the repo and adapt the qualification categories, prompts, and research tools to their business. Technical founders can deploy the one-click Vercel button with the required environment variables to stand up a lead-qualification pipeline in minutes. Organizations with a Slack workspace can plug in their own bot token and signing secret to get human review for outbound emails.
What can you do with it?
- Customize qualification logic — Edit
qualificationCategorySchemato add or change lead categories (for example, adding tiered enterprise vs. SMB buckets) and see reasoning on each decision. - Plug in your own knowledge base — Implement the
queryKnowledgeBaseplaceholder so the research agent can search company documentation or historical lead data alongside Exa.ai web search. - Build new outreach workflows — Follow the Vercel Workflow docs to add steps like CRM syncing or multi-stage follow-ups, or create separate workflows for outbound prospecting.
- Adjust AI behavior — Tune prompts and agent parameters in
lib/services.tsto change how deeply the agent researches or how strictly it qualifies.
How does it work?
The flow is documented in the architecture diagram: a user submits the form, the /api/submit endpoint starts a workflow with Workflow DevKit, then the research agent gathers context, the qualification step categorizes the lead, the email step drafts a message, the Slack integration asks for approval, and on approval the email is sent. Slack events, including approve/reject clicks, are received by the /api/slack webhook. If Slack environment variables are not set, the application still runs with the Slack bot disabled.
FAQ
Is Lead Agent free?
Yes, the repository is open source under the MIT license. You can clone it and deploy it to your own Vercel account, paying only for the underlying AI and Slack services you configure.
What environment variables are required?
The one-click Vercel deployment asks for AI_GATEWAY_API_KEY, SLACK_BOT_TOKEN, SLACK_SIGNING_SECRET, SLACK_CHANNEL_ID, and EXA_API_KEY. Without the Slack variables the app runs but Slack approvals are disabled.
What versions and tools does it use?
It requires Node.js 20+ and uses pnpm (or npm). It uses Next.js 16, the Vercel AI SDK with AI Gateway, Workflow DevKit for durable execution, and Exa.ai for web search.
Does Slack approval happen automatically?
No, the generate-email step is deliberately gated by human approval in Slack. An operator sees the proposed email with Approve/Reject buttons; the sending step only proceeds when an approval event is received.








