vercel · Vercel AI SDK Docs
AI SDK Agents: Building Agents
Teaches how to construct AI agents using the AI SDK by defining tools, managing state, and implementing reasoning loops.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
AI SDK Agents: Building Agents
Teaches how to construct AI agents using the AI SDK by defining tools, managing state, and implementing reasoning loops.
When To Use
Use when you need to implement an autonomous agent that can use tools, maintain conversation state, and execute complex reasoning tasks within an application.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/ai-sdk-agents-building-workflow-guide.md | A guide explaining how to use the ToolLoopAgent class to encapsulate LLM configuration, tools, and behavior for building autonomous agents. | Questions about a guide explaining how to use the ToolLoopAgent class to encapsulate LLM configuration, tools, and behavior for build... |
examples/ai-sdk-agents-building-ai-sdk-toolloopagent-typescript-implementation.text | A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with a model, instructions, and tools using the AI SDK. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with a model, instructions, and tools usin... |
examples/ai-sdk-agents-building-ai-sdk-toolloopagent-typescript.text | A TypeScript code example demonstrating the implementation of a ToolLoopAgent using the AI SDK. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating the implementation of a ToolLoopAgent using the AI SDK. |
examples/ai-sdk-agents-building-ai-sdk-tool-loop-agent-typescript.text | A TypeScript code example demonstrating how to implement a ToolLoopAgent using the AI SDK to execute tools in a loop. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to implement a ToolLoopAgent using the AI SDK to execute tools in a loop. |
examples/ai-sdk-agents-building-ai-sdk-toolloopagent-typescript-2.text | A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with a custom step count limit using the AI SDK. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with a custom step count limit using the A... |
examples/ai-sdk-agents-building-ai-sdk-toolloopagent-typescript-implementation-2.text | A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with specific stop conditions using the AI SDK. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with specific stop conditions using the AI... |
examples/ai-sdk-agents-building-ai-sdk-toolloopagent-typescript-implementation-3.text | A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with a specific model and tool configuration. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with a specific model and tool configuration. |
examples/ai-sdk-agents-building-ai-sdk-toolloopagent-typescript-implementation-4.text | A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with specific tools and tool choice configurations using the AI SDK. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with specific tools and tool choice config... |
examples/ai-sdk-agents-building-ai-sdk-toolloopagent-typescript-implementation-5.text | A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with a structured Zod output schema using the AI SDK. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with a structured Zod output schema using... |
examples/ai-sdk-agents-building-ai-sdk-toolloopagent-typescript-implementation-6.text | A TypeScript code example demonstrating the instantiation of a ToolLoopAgent with model configuration and instructions. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating the instantiation of a ToolLoopAgent with model configuration and instructions. |
examples/ai-sdk-agents-building-ai-sdk-toolloopagent-review.text | A TypeScript code example demonstrating how to instantiate a ToolLoopAgent configured as a senior software engineer for conducting code reviews. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to instantiate a ToolLoopAgent configured as a senior software engineer f... |
examples/ai-sdk-agents-building-ai-sdk-toolloopagent-customer-support.text | A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with specific instructions for a customer support use case. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with specific instructions for a customer... |
examples/ai-sdk-agents-building-ai-sdk-toolloopagent-research-assistant.text | A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with specific instructions and a Claude model for research tasks. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to instantiate a ToolLoopAgent with specific instructions and a Claude mo... |
examples/ai-sdk-agents-building-ai-sdk-toolloopagent-technical-writer.text | A TypeScript code example demonstrating the implementation of a ToolLoopAgent configured as a technical documentation writer using Claude 3.5 Sonnet. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating the implementation of a ToolLoopAgent configured as a technical documentation... |
examples/ai-sdk-agents-building-javascript-agent-generate.text | A JavaScript code example demonstrating how to use the generate method to invoke an AI SDK agent with a prompt. | Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to use the generate method to invoke an AI SDK agent with a prompt. |
examples/ai-sdk-agents-building-stream.text | A code example demonstrating how to use the stream method on an AI SDK agent to iterate over a text stream. | Exact payloads, commands, or snippets shown in A code example demonstrating how to use the stream method on an AI SDK agent to iterate over a text stream. |
examples/ai-sdk-agents-building-createagentuistreamresponse-typescript.text | A TypeScript code example demonstrating how to use createAgentUIStreamResponse within an API route to handle agentic UI streams. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to use createAgentUIStreamResponse within an API route to handle agentic... |
examples/ai-sdk-agents-building-generate-method-usage.text | A code example demonstrating the use of the generate method within an AI SDK agent to process prompts and handle step completion callbacks. | Exact payloads, commands, or snippets shown in A code example demonstrating the use of the generate method within an AI SDK agent to process prompts and handle step... |
examples/ai-sdk-agents-building-ai-sdk-toolloopagent-typescript-implementation-7.text | A TypeScript code example demonstrating the instantiation and usage of the ToolLoopAgent with model configuration and step-finish callbacks. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating the instantiation and usage of the ToolLoopAgent with model configuration and... |
examples/ai-sdk-agents-building-toolloopagent-typescript.text | A TypeScript code example demonstrating the implementation of a ToolLoopAgent and the use of InferAgentUIMessage from the AI SDK. | Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating the implementation of a ToolLoopAgent and the use of InferAgentUIMessage from... |
examples/ai-sdk-agents-building-react-usechat-component.text | A React client component demonstrating the use of the useChat hook within an AI SDK agent implementation. | Exact payloads, commands, or snippets shown in A React client component demonstrating the use of the useChat hook within an AI SDK agent implementation. |
What This Skill Covers
- The ToolLoopAgent provides a structured way to encapsulate LLM configuration, tools, and behavior into reusable components. It handles the agent loop for you...
- Main sections:
Why Use the ToolLoopAgent Class?,Creating an Agent,Configuration Options,Model and System Instructions,Tools.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://ai-sdk.dev/docs/agents/building-agents