When to Use the SDK
Use the SDK when you want to:- Integrate Codebuff agents into your own applications
- Automate coding tasks in CI/CD pipelines
- Build custom development tools powered by AI
- Create workflows that combine multiple agent runs
- Programmatically control agent behavior
- Interactively chat with agents during development
- Quickly iterate on code changes
- Use agents in your terminal workflow
Installation
Prerequisites
Create a Codebuff account and get your Codebuff API key.Basic Example
Key Concepts
Agents
Agents are AI models configured with specific instructions, tools, and capabilities. You can use:- Published agents from the Codebuff store (e.g.,
codebuff/[email protected]) - Custom agents you define with
AgentDefinition
Run State
Eachclient.run() call returns a RunState object containing:
sessionState: Internal state for continuing conversationsoutput: The agent’s final output or error
Events
ThehandleEvent callback receives real-time events as the agent executes:
- Tool calls and results
- Text responses
- Subagent spawns
- Errors
Next Steps
CodebuffClient
Learn about client configuration and methods
Running Agents
Master the client.run() method
Custom Agents
Create your own AI agents
Custom Tools
Extend agents with custom capabilities

