Documentation menu

Codegen SDK

The Codegen SDK enables developers to programmatically interact with Codegen SWE agents via API.

Go to developer settings to generate an API token

from graph_sitter import Agent
 
# Initialize the Agent with your organization ID and API token
agent = Agent(org_id="...", token="...")
 
# Run an agent with a prompt
task = agent.run(prompt="Leave a review on PR #123")
 
# Check the initial status
print(task.status)
 
# Refresh the task to get updated status (tasks can take time)
task.refresh()
 
if task.status == "completed":
    print(task.result)  # Result often contains code, summaries, or links

Graph-sitter agents can research code, create PRs, modify Linear tickets, and more.

Installation

Install the SDK using pip or uv:

pip install graph-sitter
# or
uv pip install graph-sitter

What can I do with the Codegen SDK?

The Codegen SDK is your gateway to programmatically interacting with your AI Software Engineer. You can use it to:

  • Automate development tasks: Assign tasks like implementing features, fixing bugs, writing tests, or improving documentation to the agent.
  • Integrate AI into your workflows: Trigger agent tasks from your CI/CD pipelines, scripts, or other development tools.
  • Provide context and guidance: Supply the agent with specific instructions, relevant code snippets, or background information to ensure it performs tasks according to your requirements.

Essentially, the SDK allows you to leverage Codegen's AI capabilities wherever you can run Python code.

Get Started

Create Account

Sign up for a free account and get your API token.

Join our Slack

Get help and connect with the Graph-sitter community.

Tutorials

Learn how to use Graph-sitter for common code transformation tasks.

View on GitHub

Star us on GitHub and contribute to the project.