ai-sdk-agents
Expert guidance for building AI agents with ToolLoopAgent (AI SDK v6+). Use when creating agents, configuring stopWhen/prepareStep, callOptionsSchema/prepareCall, dynamic tool selection, tool loops, or agent workflows (sequential, routing, evaluator-optimizer, orchestrator-worker). Triggers: ToolLoopAgent, agent loop, stopWhen, stepCountIs, prepareStep, callOptionsSchema, prepareCall, hasToolCall, InferAgentUIMessage, agent workflows.
npx skills add majiayu000/claude-skill-registry --skill ai-sdk-agents-bjornmelin-dev-skills-2 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# AI SDK Agents Build autonomous agents with ToolLoopAgent: reusable model + tools + loop control. ## Quick Start Assume Zod v4.3.5 for schema typing. ```ts import { ToolLoopAgent, tool } from 'ai'; import { anthropic } from '@ai-sdk/anthropic'; import { z } from 'zod'; const weatherAgent = new ToolLoopAgent({ model: anthropic('claude-sonnet-4-20250514'), tools: { weather: tool({ description: 'Get the weather in a location (F)', inputSchema: z.object({ location: z.string() }), execute: async ({ location }) => ({ location, temperature: 72 }), }), }, }); const result = await weatherAgent.generate({ prompt: 'What is the weather in San Francisco?', }); ``` ## When to Use ToolLoopAgent vs Core Functions - Use **ToolLoopAgent** for dynamic, multi-step tasks where the model decides which tools to call. - Use **generateText/streamText** for deterministic flows or strict ordering. ## Essential Patterns ### Structured Output ```ts import { ToolLoopAgent, Output } from 'ai'; import { z } from 'zod'; const analysisAgent = new ToolLoopAgent({ model: 'openai/gpt-4o', output: Output.object({ schema: z.object({ sentiment: z.enum(['positive', 'neutral', 'negative']), summary: z.string(), }), }), })
- Quick Start
- When to Use ToolLoopAgent vs Core Functions
- Essential Patterns
- Structured Output
- Streaming Agent
- API Route
- Type-Safe Client Integration
- Loop Control Checklist
- Runtime Configuration
- Reference Files
What does the ai-sdk-agents skill do?
Expert guidance for building AI agents with ToolLoopAgent (AI SDK v6+). Use when creating agents, configuring stopWhen/prepareStep, callOptionsSchema/prepareCall, dynamic tool selection, tool loops, or agent workflows (sequential, routing, evaluator-optimizer, orchestrator-worker). Triggers: ToolLoopAgent, agent loop, stopWhen, stepCountIs, prepareStep, callOptionsSchema, prepareCall, hasToolCall, InferAgentUIMessage, agent workflows.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill ai-sdk-agents-bjornmelin-dev-skills-2 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
