Building the Agent Runtime

▶ Watch (08:06)

AI SDK v6 introduces toolLoopAgent, a named export that replaces the pattern of stuffing tools and system prompts into route handlers. A minimal agent.ts needs two things: the import and a model string. The SDK’s new global provider routes plain strings like "gpt-4o-mini" through Vercel’s AI Gateway automatically, removing per-file provider setup.

Albanese framed the session around three building blocks: a runtime managing the tool loop, the tools passed into it, and a sandbox giving the agent a file system to persist state across steps.

Three Types of Tools

▶ Watch (19:21)

Three tool types ship in AI SDK v6. Custom tools take a description, an input schema, and an execute function. Provider-defined tools (Anthropic’s bash tool, computer use) come with pre-tuned descriptions. Provider-executed tools, like OpenAI’s web search, run on the provider’s servers and return results directly into your message state, no execute function needed.

He wired in the web search tool and ran the web search live demo (21:58) against “AI Engineer Summit London.” The tradeoff: provider-executed tools bind you to one provider.

End-to-End Type Safety Across the Agent

▶ Watch (25:24)

InferAgentUIMessage extracts a fully typed message shape from the agent definition. Pass that type into useChat and TypeScript knows the exact input and output for every tool. The web search case goes from unknown to typed query and result. The agent definition is the single source of truth: change the tools, the UI types update automatically.

AI SDK 7 will extend this to context typing. A tool expecting sandbox access will produce a compile error if the agent does not provide it.

Persistent Sandboxes as Agent Compute

▶ Watch (30:41)

Vercel Sandbox’s named/persistent sandbox feature (currently in beta) solves the ephemeral sandbox problem. Every sandbox gets a name. Reference it by name and Vercel routes to an active instance or spins a new one with the last snapshotted file system. The lifecycle management code Albanese replaced was “taring the entire file system after every single request and storing in blob.”

“we feel very strongly that bash is all you need” — Nico Albanese

He gave the agent one tool: bash. The Vercel Sandbox bash tool demo (55:51) shows ls -la streaming live into the Next.js UI.

Context Window Management at Scale

▶ Watch (37:55)

prepareStep runs before every step and can return a modified message array, model swap, or any top-level parameter. Albanese’s coding agent ran for 104 minutes, made 316 tool calls, changed 29 files, and used only 32% of GPT-4o’s context window with zero compaction. He holds a 95% cache-token read ratio, which compaction would reset every time it fires.

His alternative: sub-agents. Spin one off for independent work, let it consume 30,000 tokens, get back a 500-token summary. The main thread stays near 7,000 tokens.

Persistent Memory and Self-Extending Agents

▶ Watch (57:23)

Albanese’s memory pattern: one file, memories.md, stored in the sandbox. prepareCall reads it before every run and injects the contents into the system prompt. No vector database.

“memory is a file that you store in your sandbox” — Nico Albanese

The self-extending weather agent demo (64:23) shows the agent writing a Python weather script, executing it via bash, and appending the script description to memories.md. On the next request it reuses the script. His production version of this system handles 23 Vercel employees, has pushed 3.8 billion tokens in about two months, and is responsible for roughly 350 merged PRs.

Notable Quotes

we feel very strongly that bash is all you need Nico Albanese · ▶ 51:21

memory is a file that you store in your sandbox Nico Albanese · ▶ 57:27

104 minutes it ran for used 316 tool calls changed 29 files and it used only 32% of GPT54’s Nico Albanese · ▶ 40:04

Key Takeaways

  • A single bash tool inside a named Vercel Sandbox gives an agent a persistent, full-featured computer.
  • Million-token context windows make aggressive compaction unnecessary; sub-agents are a better alternative for long tasks.
  • File-system-backed memory injected into the system prompt is a simple and auditable alternative to vector memory.