A hands-on workshop for building AI agents with Vercel AI SDK and OpenRouter. By the end you'll have a working agent with tools, model swapping, and a mini-eval — all in a single file.
Duration: 90 minutes · Stack: TypeScript, Vercel AI SDK, OpenRouter
- Node.js 18+ (check with
node -v) - npm (comes with Node) or npx
- An OpenRouter API key (sign up at openrouter.ai)
git clone <repo-url>
cd workshop-ceeianpm installThis installs:
ai— Vercel AI SDK@openrouter/ai-sdk-provider— OpenRouter provider for the AI SDKzod— Schema validation for tool inputs
cp .env.example .envAdd your OpenRouter API key:
OPENROUTER_API_KEY=sk-or-xxxxxxxxxxxxxxxxxxxxxxxxTip: Make sure your OpenRouter account has a small credit balance ($2–5 is enough for the workshop).
npm startYou should see the agent call the getWeather tool and return a final answer about Lisbon's weather.
npm startThis runs index.ts with the environment variables loaded from .env.
workshop-ceeia/
├── index.ts # Agent code (everything happens here)
├── package.json # Dependencies and scripts
├── .env.example # Template for environment variables
├── .gitignore # Excludes .env, node_modules, logs
└── README.md # This file
| Step | Topic | Decision |
|---|---|---|
| 1 | First model call | — |
| 2 | Add a tool + the loop | Decision 1: The Harness |
| 3 | Swap the model | Decision 2: Selecting the Model |
| 4 | Mini-eval (PASS/FAIL) | Decision 3: Evals |
| — | Vercel AI SDK wiring | Decision 4: Framework |
The full facilitator script is in AI_Agents_Workshop_SCRIPT.md.
- Harness — The loop, tools, context, and stop conditions around the model
- Model — Which brain powers the agent (kept swappable)
- Evals — Measurable tests to validate behavior before shipping
- Framework — The library that wires it all together (chosen last)