The Claude Agent SDK gives you a ready agent loop with built-in tools (read and edit files, run commands, search) that you call from Python or TypeScript.
Do this first: Python with uv
Make a project folder and go into it, then pick one option (A, B or C)
mkdir my-agent && cd my-agentOur helper command
Option A: Python with uv. Start a project
uv initFrom the official docs (written 10 Nov 2026); the automatic check confirms it on its next run
Option A: Python with uv. Add the SDK
uv add claude-agent-sdkFrom the official docs (written 10 Nov 2026); the automatic check confirms it on its next run
Option B: Python with pip. Make a virtual environment
python3 -m venv .venvFrom the official docs (written 10 Nov 2026); the automatic check confirms it on its next run
Option B: Python with pip. Turn it on for this terminal
source .venv/bin/activateFrom the official docs (written 10 Nov 2026); the automatic check confirms it on its next run
Option B: Python with pip. Install the SDK
pip install claude-agent-sdkFrom the official docs (written 10 Nov 2026); the automatic check confirms it on its next run
Option C: TypeScript. Install the SDK
npm install @anthropic-ai/claude-agent-sdkFrom the official docs (written 10 Nov 2026); the automatic check confirms it on its next run
Any option: set your key for this terminal (never commit it)
export ANTHROPIC_API_KEY=your-keyOur helper command
import asyncio
from claude_agent_sdk import query
async def main():
async for message in query(prompt="Say hello in five words"):
print(message)
asyncio.run(main())You should see: A few messages, ending with a result message that holds the reply
Authentication error or 401ANTHROPIC_API_KEY is missing in this terminal. Set it again, or load it from a .env file that is in .gitignore.
CLI not foundReinstall the package in the active environment; on platforms without a bundled binary, install Claude Code so the SDK can find it on PATH.
Activate.ps1 cannot be loaded because running scripts is disabledAllow local scripts for your user once: Set-ExecutionPolicy -Scope CurrentUser RemoteSigned, then run the activate line again.
Source: Agent SDK quickstart (Anthropic). Written from it on 2026-11-10; the pipeline confirms the commands on its next run.