Planning & Task Decomposition
Built-in write_todos tool enables agents to break down complex tasks into discrete steps, track progress, and adapt plans as new information emerges during execution.
write_todos()Build agents that can plan, delegate to subagents, and leverage file systems for complex, multi-step tasks using Vercel AI SDK v6
Built-in write_todos tool enables agents to break down complex tasks into discrete steps, track progress, and adapt plans as new information emerges during execution.
write_todos()File system tools (ls, read_file, write_file, edit_file, glob, grep) allow agents to offload large context to memory, preventing context window overflow and enabling work with variable-length tool results.
read_file() | write_file()Built-in task tool enables agents to spawn specialized subagents for context isolation. This keeps the main agent's context clean while still going deep on specific subtasks.
task(agent: "researcher")Checkpointers enable persistent memory across conversations. Agents can save and restore state (todos, files, messages) and resume long-running tasks later.
checkpointer: new FileSaver()import { createDeepAgent } from 'ai-sdk-deep-agent';
import { anthropic } from '@ai-sdk/anthropic';
const agent = createDeepAgent({
model: anthropic('claude-sonnet-4-20250514'),
systemPrompt: "Break down complex tasks into todos, write research findings to files, and delegate specialized work to subagents.",
});
const result = await agent.generate({
prompt: 'Research and compare AI agent frameworks',
maxSteps: 20,
});
console.log(result.text);
console.log(result.state.todos);
console.log(Object.keys(result.state.files));