---
title: Agent stack
description: Learn how to build an agent on Vercel, connect it to models and tools safely, keep long runs durable, and ship and operate it in production.
url: "https://vercel.com/kb/architecture/agents"
last_updated: 2026-11-02
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# Agent stack

Learn how to build an agent on Vercel, connect it to models and tools safely, keep long runs durable, and ship and operate it in production.

## Build your agent

Decide what to automate, pick a framework, and get a working agent running.

### Choose an approach

Decide what to automate first, and whether to start from eve or compose AI SDK primitives yourself.

- [What we learned building agents at Vercel](https://vercel.com/blog/what-we-learned-building-agents-at-vercel): Learn how Vercel picks agent projects that work with current models: repetitive, low-judgment work with a human making the final call.
- [Choosing between eve, AI SDK agents, and \`WorkflowAgent\`](/kb/guide/eve-vs-ai-sdk-agents-vs-workflowagent): Compare eve, \`ToolLoopAgent\`, and \`WorkflowAgent\` by durability, approvals, channels, and setup to choose an agent framework for your TypeScript application.
- [Build AI agents with AI Gateway and AI SDK](/kb/guide/ai-gateway-and-ai-sdk): Build AI agents on Vercel with AI Gateway and AI SDK, then make them reliable, capable, and durable with Sandbox, Chat SDK, Vercel Connect, and Workflow.
- [Agent Frameworks on Vercel](https://vercel.com/docs/frameworks/agents): Run agent frameworks on Vercel, with AI Gateway for models and Sandbox for isolated code.

### Build a working agent

Follow a course from start to finish, or fork a template close to your use case.

- [Building Agents with eve](https://vercel.com/academy/building-agents-with-eve): Build a bike shop dispatcher with typed tools, durable memory, real auth, and human approval, then deploy it behind Slack and a web dashboard.
- [eve Slack Agent](https://vercel.com/templates/eve/eve-slack-agent): Deploy a starter Slack agent with webhook handling, Vercel Connect, and an example tool.
- [Build Your Own AI Coding Agent Harness](https://vercel.com/academy/build-ai-agent-harness): Build a harness from scratch with AI SDK, Vercel Sandbox, and just-bash, covering the tool loop, context pruning, subagents, and approval gates.
- [eve Software Factory](https://vercel.com/templates/eve/eve-software-factory): Software factory built on eve: AI agents work each stage of the development loop, and people make the judgment calls.

### Design tools and context

Decide how many tools the agent needs, and when a filesystem and bash beat custom tools.

- [We removed 80% of our agent's tools](https://vercel.com/blog/we-removed-80-percent-of-our-agents-tools): Learn why a text-to-SQL agent got faster and more accurate after its custom tools were replaced with one bash tool over a filesystem.
- [Build knowledge agents without embeddings](https://vercel.com/blog/build-knowledge-agents-without-embeddings): Open source filesystem and knowledge based agent template you can fork, customize, and deploy.
- [How to add tools to your eve agent](/kb/guide/how-to-add-eve-tools): Add tools to an eve agent by creating a TypeScript file under agent/tools/ with defineTool, and gate sensitive ones on human approval with approval.
- [How to perform large-scale data analysis with Vercel Sandbox and MCP](/kb/guide/large-scale-data-analysis-vercel-sandbox-mcp): Use Vercel Sandbox and an MCP server built with \`mcp-handler\` to let AI agents run DuckDB SQL and Python on large datasets without loading data into the model's context.

## Connect models and tools safely

Route model calls, scope access to services and private systems, and isolate the code agents generate.

### Route model calls and plan for failures

Decide which model serves each request, how a failed call falls back, and how spend is capped.

- [Cost-aware model routing with Vercel AI Gateway](/kb/guide/cost-aware-model-routing-with-ai-gateway): Send easy requests to a lower-cost model and escalate only the complex ones to a frontier model through AI Gateway, with budgets and spend tracking.
- [How to build your own AI model router](/kb/guide/how-to-build-your-own-ai-model-router): Build an AI model router with Vercel AI Gateway. Keep routing, key, and retention decisions in your code while the gateway handles provider integrations, failover, and cost metering
- [How Tailscale built a customer-facing model router on AI Gateway](https://vercel.com/customers/how-tailscale-built-a-customer-facing-model-router-on-ai-gateway): See how Tailscale built a model router on AI Gateway with identity-based access instead of API keys, cost on every response, and zero data retention.
- [How Zo Computer improved AI reliability 20x on Vercel](https://vercel.com/customers/how-zo-computer-improved-ai-reliability-20x-on-vercel): See how Zo Computer moved retries and provider fallbacks into AI Gateway, cutting its retry rate 20x and raising chat success to 99.93%.

### Connect services and private systems

Give agents scoped, short-lived access to SaaS APIs, and choose a network path to internal systems.

- [eve Data Analyst](https://vercel.com/templates/eve/eve-data-analyst): Answer business questions from Postgres in Slack, querying through a read-only database user that each deploy creates for the agent.
- [How Mercor ships internal apps and billions of production tokens](https://vercel.com/customers/how-mercor-ships-internal-apps-and-billions-of-production-tokens-on-one-platform): Learn how Mercor uses Vercel AI Gateway to manage model access and Vercel Passport to handle secure access to their applications.
- [The Complete Guide to Vercel Connect](https://vercel.com/kb/guide/vercel-connect): Call Slack, GitHub, Linear, Salesforce, and other APIs with short-lived, scoped tokens instead of long-lived secrets.
- [Give your eve agent secure access to your private AWS RDS database](/kb/guide/give-eve-agent-secure-access-to-aws-rds-database): Connect an eve agent to a private AWS RDS database using Vercel Secure Compute and VPC peering, with a read-only query tool.

### Isolate generated code

Choose where generated code runs, what it can reach, and how credentials stay out of it.

- [Security boundaries in agentic architectures](https://vercel.com/blog/security-boundaries-in-agentic-architectures): Learn where to draw boundaries between an agent and the code it generates, from secret injection to full sandboxing.
- [Introducing Run SDK: secure eval for your agents](https://vercel.com/blog/introducing-run): Run agent-written JavaScript in an isolated context that can only call the functions you expose, and pause mid-run for sign-in or human approval.
- [Vercel Sandbox](https://vercel.com/academy/vercel-sandbox): Build a CLI code-review agent that clones repositories, runs tests, and analyzes code inside a sandbox.
- [How Notion Workers run untrusted code at scale with Vercel Sandbox](https://vercel.com/customers/notion-workers-vercel-sandbox): See how Notion runs untrusted Worker code in Vercel Sandbox microVMs, with credentials injected at the network layer and egress locked down at runtime.

### Use decision models for bounded choices

Send bounded choices to a decision model, keep business rules and actions in code, and escalate answers the model is unsure about.

- [What are decision models? How they work and when to use them](https://vercel.com/i/what-are-decision-models): Learn how decision models return choices, scores, and probabilities, how they differ from structured outputs, and when to use one.
- [Where does Jev fit in an AI agent loop, and what stays in code?](https://vercel.com/i/jev-agent-control): Give Jev the bounded decisions in an agent loop while application code owns tool permissions, execution, and state.
- [What are confidence-based decision fallbacks in AI Gateway?](https://vercel.com/i/confidence-based-decision-fallbacks): Escalate uncertain decisions to a second model with confidence or probability conditions, and see why each fallback ran.
- [Using decision models in enterprise apps with trusted business rules](https://vercel.com/i/decision-models-enterprise-apps): Separate the model's interpretation from trusted business rules, add a decision call with AI SDK, and route suggestions through human review.

## Make runs durable

Keep long-running work recoverable, pause for human sign-off, and preserve memory and files between runs.

### Durable execution

Decide which steps must survive crashes and deploys, and how interrupted runs recover.

- [Running Durable Agents on Vercel](/kb/guide/durable-ai-agents): Design durable AI agents on Vercel with patterns for execution recovery, human approval, safe retries, deployment changes, and persistent files.
- [What is WorkflowAgent?](/kb/guide/what-is-workflowagent): Build durable AI agents with WorkflowAgent: tool calls that retry as workflow steps, suspend for human approval, and resume after timeouts or page refreshes.
- [How FLORA shipped a creative agent on Vercel's AI stack](https://vercel.com/customers/how-flora-shipped-a-creative-agent-on-vercels-ai-stack): See how FLORA runs a long-running creative agent on Workflow SDK's DurableAgent, fanning out parallel image jobs across 50+ models.

### Pause for human approval

Decide which tool calls need sign-off, who approves them, and how a run waits for the answer.

- [How to automatically approve tool calls in eve with Jev](/kb/guide/auto-approve-tool-calls-eve-jev): Use Jev to review tool calls in eve, allow routine actions, and request human approval when needed. Configure the policy and test its failure paths.
- [Human-in-the-Loop with Chat SDK and Workflow SDK](/kb/guide/human-in-the-loop-with-chat-sdk-and-workflow-sdk): Combine Chat SDK and Workflow SDK to suspend workflows on approval cards in a chat platform, then resume on click via createWebhook.
- [Pause for a Sign-off](https://vercel.com/academy/building-agents-with-eve/pause-for-a-signoff): Add an approval gate so expensive bookings wait for a person, then resume from the exact step.
- [Designing human review for enterprise AI decisions](https://vercel.com/i/human-review-enterprise-ai-decisions): Define what the reviewer decides, give them the evidence to challenge a suggestion, and track review separately from execution.

### Keep memory and files across runs

Decide what the agent remembers, and persist a workspace independently of the sandbox running it.

- [How to choose an eve memory provider](/kb/guide/choose-an-eve-memory-provider): Compare File memory, Supermemory, Upstash AgentKit, and Kybernesis Arcana by recall, capture, and storage to choose an eve memory provider for your agent.
- [eve Memory Agent](https://vercel.com/templates/eve/eve-memory-agent): Deploy a Slack agent that remembers each person's preferences and each channel's conventions in a private Vercel Blob store.
- [How Vercel Drives work and how to use them](/kb/guide/vercel-drives): Learn how Vercel Drives give Vercel Sandbox persistent, shareable storage, and how to create, mount, snapshot, fork, list, and delete a drive.
- [6 kinds of agents that need a persistent workspace](https://vercel.com/i/ai-agents-persistent-workspace): See which coding, research, analysis, and incident agents need files that outlast a run, then choose between Sandbox persistence and Drives.

## Ship and operate

Test behavior before release, deliver the agent where users work, inspect live runs, and govern agents across the company.

### Test and evaluate behavior

Test deterministic rules exactly, and evaluate model behavior separately against a dataset.

- [Evals in eve](https://eve.dev/docs/evals): Use evals to catch regressions when you change a prompt or a tool.
- [An Introduction to Evals](/kb/guide/an-introduction-to-evals): Evaluations test model and agent outputs to ensure they meet the standards and requirements you specify.
- [Test Rules and Model](https://vercel.com/academy/enterprise-apps-agents/test-the-boundary): Test policy code with fast deterministic tests, then run a model evaluation that includes inputs designed to redirect the agent.
- [Testing AI decisions before automating enterprise workflows](https://vercel.com/i/testing-ai-decisions-enterprise-workflows): Build a labeled set from real work, run a pilot alongside the current process, and set rollout criteria before you automate.

### Reach users in their channels

Choose between eve's built-in channels, a Chat SDK adapter, or a custom channel.

- [Chat SDK brings agents to your users](https://vercel.com/blog/chat-sdk-brings-agents-to-your-users): See why Vercel built one library for Slack, Teams, Discord, and more, so an agent written once can reach people wherever they already work.
- [Using Chat SDK and eve together](/kb/guide/chat-sdk-and-eve): Understand how eve and Chat SDK divide responsibilities, when to use eve's first-class channels versus the Chat SDK channel, and how to bridge any Chat SDK adapter into an eve agent
- [Build your own Slackbot with Vercel Connect](/kb/guide/build-a-slack-bot-with-vercel-connect): Learn how to build your very own Slackbot with Chat SDK and AI SDK. Vercel Connect supplies runtime Slack tokens and forwards triggers, so you never store a long-lived bot token.
- [eve Discord Agent](https://vercel.com/templates/eve/eve-discord-agent): Answer mentions and recap threads in Discord, with a Gateway relay running as a Vercel Daemon and Vercel Connect holding the bot credentials.

### Trace and debug runs

Inspect model calls, tool calls, and steps in live runs, and send traces to your observability tool.

- [Trace and debug eve agent runs](/kb/guide/trace-and-debug-eve-agent-runs): Inspect eve traces in Vercel Agent Runs, control captured content, export OpenTelemetry spans, and test fixes with regression evals.
- [Capture AI SDK token usage, tool calls, and cost with evlog](/kb/guide/ai-sdk-and-evlog): Record AI SDK usage with evlog, add cost estimates and request context, and investigate expensive or failed requests.
- [Observe everything](https://vercel.com/academy/workflow-foundations/observe-everything): Inspect each step's inputs and outputs in the Workflows dashboard, deploy a breaking change mid-run, and debug the failure.
- [Agents Runs](https://vercel.com/docs/agent-runs): Inspect eve sessions, turns, tools, reasoning, timing, and token usage in the Vercel dashboard.

### Govern apps and agents across the company

Decide who can deploy, what data and models each app or agent can reach, and how activity and spend are tracked.

- [How do you govern AI apps and agents built by employees?](https://vercel.com/i/govern-employee-built-ai-apps-and-agents): Give every employee-built app an owner, set baseline controls for access, data, and spend, and review apps before wider use.
- [Vercel for Enterprise: a control plane for apps and agents](https://vercel.com/blog/vercel-for-enterprise): See how one control plane governs deployments, data access, models, and token budgets for every builder, managed through your existing IdP.
- [How do you build an audit trail for what an AI agent did?](https://vercel.com/i/how-to-audit-ai-agents): Connect identity, tool calls, approvals, and results into one record, so you can reconstruct what an agent did and investigate mistakes.
- [How Klaviyo shipped 356 internal apps in two weeks on Vercel](https://vercel.com/customers/how-klaviyo-shipped-356-internal-apps-in-two-weeks-on-vercel): See how a Vercel SDK pipeline creates a repository and deployment per app and applies SSO, secrets, and security defaults.

## Reference Architecture

Choose a stack and work through the decisions behind it, with curated documentation, guides, templates, and courses to help you build.

- [Agent stack](/kb/architecture/agents): Build and operate agents with models, tools, and durable workflows.
- [Web applications](/kb/architecture/web): Choose rendering, data, authentication, and caching approaches.
- [Backends](/kb/architecture/backends): Choose a runtime, connect services, and run background work.

[Browse all stacks](/kb/architecture)
