- Set up a project with the Agent SDK
- Create a file with some buggy code
- Run an agent that finds and fixes the bugs automatically
Prerequisites
- Node.js 18+ or Python 3.10+
- An Anthropic account. If you don’t have one, sign up here.
Setup
1
Create a project folder
Create a new directory for this quickstart:For your own projects, you can run the SDK from any folder; it will have access to files in that directory and its subdirectories by default.
2
Install the SDK
Install the Agent SDK package for your language:Setting
- TypeScript (new project)
- TypeScript (existing project)
- Python (uv)
- Python (pip)
"type": "module" in package.json lets your agent script use top-level await, and tsx runs TypeScript files directly. npm prints added N packages when the install succeeds.Both the TypeScript and Python SDKs bundle a native Claude Code binary, so most installs need no separate Claude Code install. Some installs have no bundled binary:
- If pip installs the Python SDK’s source distribution instead of a platform wheel, for example on ARM64 Windows, no binary is bundled. Install Claude Code natively. The Python SDK finds it on your
PATH. - The TypeScript SDK installs its binary through npm optional dependencies, so an install that skips them, for example
npm ci --omit=optional, gets no binary even on a supported platform. Reinstall without skipping optional dependencies, or install Claude Code natively and setpathToClaudeCodeExecutableto its path.
3
Set your API key
Get an API key from the Claude Console, then set it as an environment variable in the shell where you’ll run your agent:
- macOS / Linux
- Windows (PowerShell)