Prompt Buddy logoPrompt Buddy

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.

Import to Prompt Buddy

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

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/ai-sdk-agents-building-workflow-guide.mdA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. 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