Build production AI agents that autonomously read files, run commands, search the web, edit code, and accomplish complex goals. The same engine that powers Claude Code, available as a library.
A comprehensive guide exploring the architecture, philosophy, and practical implementation of autonomous AI agents. Covers what distinguishes agents from workflows, why Anthropic embraced bash as a core tool, how the three-part agent loop works, and detailed explanations of both the TypeScript and Python SDKs.
A practical guide to building a production worker agent that handles the complete pull request lifecycle autonomously. Covers the gap in one-shot worker patterns, git worktree isolation for parallel agents, the review and merge loop, main branch verification, and modern Python tooling.
A practical guide to building agents that combine Claude's orchestration with Gemini's vision capabilities. Demonstrates the pattern through a Roblox NPC animation workflow, covering command-line animation authoring in Blender, frame-by-frame visual analysis, runtime terrain adaptation with inverse kinematics, and Rojo-based development workflows.
Official documentation from Anthropic covering installation, configuration, and all SDK features.
In-depth guides for specific features and use cases.
Official repositories and example implementations.
An agent is fundamentally different from a workflow. Workflows follow your predetermined structure. Agents build their own structure. You give an agent a goal and the tools to achieve that goal, and it decides its own trajectory. Claude Code is the canonical example: you speak to it in natural language and it autonomously reads files, runs commands, edits code, and verifies its work.
Every well-designed agent follows this pattern: gather context (find the information needed for the task), take action (use appropriate tools), and verify the work (confirm the results are correct). If you can programmatically verify the agent's work, you have an excellent candidate for automation.
Anthropic discovered that the bash tool represents perhaps the most powerful capability you can give an agent. It enables storing results to files, dynamically generating scripts, composing functionality through pipes, and using any existing software on the system. This obviates the need for most specialized tools.
Security comes through multiple layers: model alignment training, harness permissioning and prompting, bash command parsing, and sandboxing. Each layer has holes, but the layers are arranged so no single path goes straight through. This is called the Swiss cheese defense.
Install Claude Code first (the SDK uses it as its runtime), then install the SDK package:
# Install Claude Code
curl -fsSL https://claude.ai/install.sh | bash
# TypeScript
npm install @anthropic-ai/claude-agent-sdk
# Python
pip install claude-agent-sdk
Create an agent that lists files in your directory:
# Python
import asyncio
from claude_agent_sdk import query, ClaudeAgentOptions
async def main():
async for message in query(
prompt="What files are in this directory?",
options=ClaudeAgentOptions(allowed_tools=["Bash", "Glob"])
):
if hasattr(message, "result"):
print(message.result)
asyncio.run(main())