• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
project logo

templates

vercel-ai-agent-demo

Model-agnostic AI agent template using the Vercel AI SDK
Public
Like
vercel-ai-agent-demo
Home
Code
2
README.md
main.ts
Connections
Environment variables
1
Branches
1
Pull requests
Remixes
History
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.
Sign up now
Code
/
README.md
Code
/
README.md
Search
…
README.md

Vercel AI SDK Agent Template

A Val Town template for building AI agents using the Vercel AI SDK. This is a model-agnostic alternative to the OpenAI Agents template — same agent pattern, but you can swap in any model provider (Anthropic, Google, etc.) by changing a single line.

What is an Agent?

An agent is inference in a loop with tools: an LLM receives a system prompt, reads from and writes to an environment through tools, and loops until it decides it's done.

Rendering mermaid diagram...

Why Vercel AI SDK?

The OpenAI Agents SDK is great if you're all-in on OpenAI. The Vercel AI SDK gives you the same agent capabilities — tool loops, multi-step reasoning, structured output — but with a unified interface across providers. Switch from OpenAI to Anthropic to Google by changing one line:

// OpenAI model: openai("gpt-4o-mini") // Anthropic (just change this line + import) model: anthropic("claude-sonnet-4-20250514") // Google model: google("gemini-2.0-flash")

Get Started

  1. Fork this val
  2. Set the OPENAI_API_KEY environment variable. Get your API key here: https://platform.openai.com/api-keys
    • Or use a different provider — set ANTHROPIC_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, etc.
  3. Customize your agent: Edit main.ts — change the model, add custom tools, or modify the prompt.
  4. Run it: Click Run on main.ts

Learn More

  • Vercel AI SDK Docs
  • Building Agents with AI SDK
  • Web Search Agent Cookbook
  • OpenAI Agents Template — the OpenAI-specific version of this template
  • Val Town Documentation
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
AboutAlternativesPricingBlogNewsletterCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.