ClaudeCode:AgentSDK
Claude Code를 라이브러리로 사용하여 프로덕션 AI 에이전트 구축
About
파일 읽기, 명령 실행, 웹 검색, 코드 편집 등을 자율적으로 수행하는 AI 에이전트를 구축하세요. Agent SDK는 Claude Code를 구동하는 동일한 도구, 에이전트 루프, 컨텍스트 관리를 Python과 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())