Skip to main content
Use the Agent SDK to build an AI agent that reads your code, finds bugs, and fixes them, all without manual intervention. What you’ll do:
  1. Set up a project with the Agent SDK
  2. Create a file with some buggy code
  3. 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 "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 set pathToClaudeCodeExecutable to 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: