Skip to content

Python SDK to Interact with Intelligent Code Generation Agents

License

Notifications You must be signed in to change notification settings

codegen-sh/codegen

Folders and files

NameName
Last commit message
Last commit date
Feb 27, 2025
Apr 14, 2025
Jan 22, 2025
Mar 10, 2025
Apr 22, 2025
Apr 18, 2025
Mar 14, 2025
Apr 16, 2025
Apr 16, 2025
Mar 4, 2025
Mar 7, 2025
Jan 22, 2025
Feb 3, 2025
Mar 14, 2025
Feb 24, 2025
Jan 22, 2025
Apr 14, 2025
Jan 23, 2025
Mar 14, 2025
Jan 22, 2025
Jan 28, 2025
Feb 11, 2025
Apr 16, 2025
Feb 13, 2025
Feb 11, 2025
Feb 24, 2025
Apr 21, 2025

Repository files navigation


The SWE that Never Sleeps

PyPI Documentation Slack Community License Follow on X


The Codegen SDK provides a programmatic interface to code agents provided by Codegen.

from codegen.agents.agent import Agent

# Initialize the Agent with your organization ID and API token
agent = Agent(
    org_id="YOUR_ORG_ID",  # Find this at codegen.com/developer
    token="YOUR_API_TOKEN",  # Get this from codegen.com/developer
    # base_url="https://codegen-sh-rest-api.modal.run",  # Optional - defaults to production
)

# Run an agent with a prompt
task = agent.run(prompt="Implement a new feature to sort users by last login.")

# Check the initial status
print(task.status)

# Refresh the task to get updated status (tasks can take time)
task.refresh()

# Check the updated status
print(task.status)

# Once task is complete, you can access the result
if task.status == "completed":
    print(task.result)  # Result often contains code, summaries, or links

Installation and Usage

Install the SDK using pip or uv:

pip install codegen
# or
uv pip install codegen

Get started at codegen.com and get your API token at codegen.com/developer.

You can interact with your AI engineer via API, or chat with it in Slack, Linear, Github, or on our website.

Resources

Contributing

Please see our Contributing Guide for instructions on how to set up the development environment and submit contributions.

Enterprise

For more information on enterprise engagements, please contact us or request a demo.