The Codegen SDK is a thin pythonic wrapper around the Codegen API with all the same capabilities for creating and managing AI agents programmatically.
Go to developer settings to generate an API token
from codegen 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

Installation

Install the codegen package from PyPI:
uv pip install codegen

Get Started