Week 1 ended with a toy: an access agent simulated in your browser. Before we build the real one, we need a workbench. This week: scaffold a Mastra project, meet the example weather agent in Studio, and rewire its brain to Anduin's LiteLLM proxy.
Following the Mastra quickstart:
npm create mastra@latest
The wizard asks a few questions — pick the same answers:
When it finishes you get a src/mastra/ folder with a sample weather agent,
tool, and workflow — a working example app we'll poke at before writing our own.
There's also a gallery of templates — pre-built projects (deep research, PDF Q&A, browser agents) you can start from instead of the blank scaffold. Worth a browse later; this track builds from the bare scaffold so you see every piece.
npm run dev
Studio comes up at localhost:4111 — Mastra's local workbench. The scaffold's
Weather Agent is already in the agents list, because the scaffold registered it in
src/mastra/index.ts. Registration is what makes things visible here.
Try chatting with it, though, and you'll hit a wall: the agent has no working model — you skipped the OpenAI key in the wizard, remember? The body needs a brain. That's step 3.
Two small changes point the scaffold at Anduin's proxy. First, replace the contents of
.env:
# Anduin LiteLLM proxy — OpenAI-compatible gateway; holds the real provider keys
LITELLM_BASE_URL=https://litellm.anduin.center/v1
LITELLM_API_KEY=sk-… # ask your instructor for a key — never commit it
LITELLM_MODEL=anthropic.claude-sonnet-5-global
Then, in src/mastra/agents/weather-agent.ts, swap the one-line model string
(model: 'openai/gpt-5-mini') for a gateway object:
model: {
id: `litellm/${process.env.LITELLM_MODEL ?? 'anthropic.claude-sonnet-5-global'}`,
url: process.env.LITELLM_BASE_URL,
apiKey: process.env.LITELLM_API_KEY,
},
Mastra's model router takes any OpenAI-compatible endpoint as url +
apiKey; the id prefix (litellm/) is just a label,
and the part after the slash is the model name the proxy expects. Note what the model
actually is now: Claude, served through a gateway that talks the OpenAI protocol.
mastra dev hot-reloads — no restart needed.
Back in Studio, open the Weather Agent and ask: "What's the weather in Tokyo?"
Now it thinks: the agent decides to call its weatherTool, gets real data
back (the tool hits a free weather API), and composes an answer.
That's the whole agent loop from week 1, live: model picks a tool, tool runs, model reads the result, answers. The difference from a plain chatbot is that the model chose to make that call.
The scaffold also ships a weather-workflow — same weather domain, opposite
philosophy. A workflow is a fixed sequence of steps: fetch forecast, then plan
activities. No model decides what happens next; the graph does.
This is one of Mastra's core distinctions: agents when the model should decide what to do next, workflows when the steps must be predictable. You'll pick between them constantly, and the scaffold hands you one of each to compare.
Studio's Traces view shows what actually happened on every run — each model call, each tool call, inputs, outputs, and timing. When an agent misbehaves, this is where you look first.
That's the tour: a scaffolded project, a live agent on the company proxy, a workflow to contrast it with, and traces to see inside. Next week we put our own agent on this bench — the GitHub access agent from week 1, for real.