Human Approval as a First-Class Agent State

articleaitypescriptagentsmcptool-callinghuman-in-the-loopdevtoolsjoelclaw

AI SDK 6's ToolLoopAgent, tool approval, MCP, and DevTools map cleanly onto joelclaw agent-loop approval gates, gateway UI, and observability surfaces.

AI SDK 6 is Vercel’s big push to make agents feel less like a pile of callbacks and more like typed application infrastructure.

The useful bit is the shape: ToolLoopAgent wraps the full model → tool call → tool result loop, tool execution approval makes human review a real state instead of an awkward modal bolted onto the side, and AI SDK DevTools exposes the run trace. That’s the boring plumbing that makes agent systems actually operable.

The clever part is that AI SDK keeps the thing inside TypeScript instead of inventing a separate agent runtime. Tools, UI message parts, approvals, structured output, and provider-specific capabilities all get pulled into one type system. That matters because agents aren’t just prompts anymore. They are product surfaces with state, permissions, logs, and users waiting for the damn thing to finish.

For joelclaw, this is mostly a confirmation signal: agent work needs explicit lifecycle states, approval gates, traceability, and provider abstraction. The overlap with MCP, reranking, standard JSON schema, and provider tools is the ecosystem growing toward the same shape as the local rig.

Key Ideas

  • ToolLoopAgent turns the repeated model/tool/result loop into a reusable AI SDK primitive instead of copy-pasted generateText and streamText configuration.
  • Tool execution approval makes destructive or sensitive tool calls wait for explicit human approval, which maps directly to agent-loop reviewer and operator checkpoints.
  • MCP support covers remote transports, OAuth, resources, prompts, and elicitation, which makes external tool/data access less bespoke.
  • AI SDK DevTools gives visibility into inputs, outputs, model config, token usage, timing, and raw provider requests/responses.
  • Reranking is treated as a first-class context-quality step, not a weird extra script after search.
  • Standard JSON Schema support reduces schema-library lock-in for structured output and tool input contracts.
  • Provider tools for Anthropic, OpenAI, Google, and xAI pull vendor-specific capabilities into the same application-facing API.