Prompt Buddy logoPrompt Buddy

vercel · Vercel AI SDK Docs

AI SDK Agents: Subagents

Teaches how to implement a multi-agent architecture by delegating tasks from a primary agent to specialized subagents using the AI SDK.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

AI SDK Agents: Subagents

Teaches how to implement a multi-agent architecture by delegating tasks from a primary agent to specialized subagents using the AI SDK.

When To Use

Use when you need to decompose complex agentic tasks into smaller, specialized sub-tasks handled by independent agent instances.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/ai-sdk-agents-subagents-workflow-guide.mdA guide explaining how parent agents can delegate tasks to autonomous subagents using tools within the AI SDK.Questions about a guide explaining how parent agents can delegate tasks to autonomous subagents using tools within the AI SDK.
examples/ai-sdk-agents-subagents-ai-sdk-subagents-toolloopagent-typescript.textA TypeScript code example demonstrating how to implement subagents using the ToolLoopAgent class from the AI SDK.Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to implement subagents using the ToolLoopAgent class from the AI SDK.
examples/ai-sdk-agents-subagents-execute-function.textA code example demonstrating the implementation of an execute function that invokes a subagent with an abort signal within the AI SDK agents framework.Exact payloads, commands, or snippets shown in A code example demonstrating the implementation of an execute function that invokes a subagent with an abort signal w...
examples/ai-sdk-agents-subagents-convert-to-model-messages.textA code example demonstrating how to use the convertToModelMessages function to prepare messages for subagents within the AI SDK.Exact payloads, commands, or snippets shown in A code example demonstrating how to use the convertToModelMessages function to prepare messages for subagents within...
examples/ai-sdk-agents-subagents-execute-generator.textA text example demonstrating the use of an async generator function within the execute property for AI SDK subagents.Exact payloads, commands, or snippets shown in A text example demonstrating the use of an async generator function within the execute property for AI SDK subagents.
examples/ai-sdk-agents-subagents-typescript-implementation.textA TypeScript code example demonstrating how to implement subagents using the AI SDK tool function and streaming.Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to implement subagents using the AI SDK tool function and streaming.
examples/ai-sdk-agents-subagents-ai-sdk-subagents-research-tool-implementation.textA code example demonstrating how to define a research tool that invokes a subagent using the AI SDK.Exact payloads, commands, or snippets shown in A code example demonstrating how to define a research tool that invokes a subagent using the AI SDK.
examples/ai-sdk-agents-subagents-ai-sdk-subagents-toolloopagent-typescript-2.textA TypeScript code example demonstrating how to implement a research subagent using the ToolLoopAgent class within the AI SDK.Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating how to implement a research subagent using the ToolLoopAgent class within the...
examples/ai-sdk-agents-subagents-part-state-logic.textA code snippet demonstrating how to determine if an agent part is streaming, complete, or has output available based on its state.Exact payloads, commands, or snippets shown in A code snippet demonstrating how to determine if an agent part is streaming, complete, or has output available based...
examples/ai-sdk-agents-subagents-ai-sdk-subagents-toolloopagent-typescript-3.textA TypeScript code example demonstrating the implementation of a ToolLoopAgent and the use of InferAgentUIMessage for subagent orchestration.Exact payloads, commands, or snippets shown in A TypeScript code example demonstrating the implementation of a ToolLoopAgent and the use of InferAgentUIMessage for...
examples/ai-sdk-agents-subagents-react-usechat-implementation.textA React client component demonstrating how to use the useChat hook to render messages and tool-research parts within an AI SDK subagent architecture.Exact payloads, commands, or snippets shown in A React client component demonstrating how to use the useChat hook to render messages and tool-research parts within...
examples/ai-sdk-agents-subagents-ai-sdk-subagents-execute-function.textA code example demonstrating how to implement an execute function for a subagent within the AI SDK agents framework.Exact payloads, commands, or snippets shown in A code example demonstrating how to implement an execute function for a subagent within the AI SDK agents framework.

What This Skill Covers

  • A subagent is an agent that a parent agent can invoke. The parent delegates work via a tool, and the subagent executes autonomously before returning a result.
  • Main sections: How It Works, When to Use Subagents, Why Use Subagents?, Offloading Context-Heavy Tasks, Parallelizing Independent Work.

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/subagents