claude-agent-sdk-python
by anthropics
A Python library that lets you control Claude Code from your own programs. It is for building custom AI agents that can read and write files, run commands and call tools you define.
- Stars
- 8.4k
- Licence
- MIT
- Runs on
- Your computer
- Setup
- Moderate
- Language
- Python
- Age
- 503 days
What you can do with it
- Send prompts to Claude Code from a Python script and read the replies as they stream in
- Write your own Python functions as custom tools that Claude can call
- Add hooks and permission rules to control what the agent is allowed to do
Make money with it
A freelancer could build and sell bespoke AI automation tools for clients using the SDK.
An idea, not financial advice. Check the licence before charging for anything built on it.
Ways a business could use it
- Build an internal assistant that edits files, writes reports or tidies up code for your team
- Automate repetitive admin or coding jobs by scripting Claude to run them on a schedule
Can you use it commercially?
Free to use, change and sell, including in paid products. Keep the copyright notice.
Not legal advice. Read the project's licence file before building a product on it.
Getting it running
Install with "pip install claude-agent-sdk" on Python 3.10 or newer; the Claude Code command-line tool is bundled with it.
Follow the official instructions in the project README.
Things to check
- Needs an Anthropic account or API access, which is paid by usage
- Agents can run commands and edit files, so permissions need careful setting
Checked 27 Oct 2026. Summary drafted by AI from the project's README.