ClaudeCode:AgentSDK
lastmod 2026-03-09created 2026-03-091 edits
Build production AI agents using Claude Code as a library
About
Build AI agents that autonomously read files, run commands, search the web, edit code, and more. The Agent SDK gives you the same tools, agent loop, and context management that power Claude Code, programmable in Python and TypeScript.
import asyncio
from claude_agent_sdk import query, ClaudeAgentOptions
async def main():
async for message in query(
prompt="Find and fix the bug in auth.py",
options=ClaudeAgentOptions(allowed_tools=["Read", "Edit", "Bash"])
):
print(message) # Claude reads the file, finds the bug, edits it
asyncio.run(main())