codegen
Python wrapper for the Codegen API - run code agents at scale
Documentation
The SWE that Never Sleeps
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/token
token="YOUR_API_TOKEN", # Get this from codegen.com/token
# 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 linksInstallation and Usage
Install the SDK using pip, pipx, or uv:
pip install codegen
# or
pipx install codegen
# or
uv tool install codegenKeeping Up to Date
The Codegen CLI includes a built-in self-update system:
# Update to the latest version
codegen update
# Check for available updates
codegen update --check
# Update to a specific version
codegen update --version 1.2.3The CLI automatically checks for updates daily and notifies you when a new version is available.
Get started at codegen.com and get your API token at codegen.com/token.
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.
Frequently asked questions
What is codegen?
codegen is Python wrapper for the Codegen API - run code agents at scale
How do I install codegen?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is codegen open source?
Yes — it is hosted on GitHub at https://github.com/codegen-sh/codegen and has 518 stars.
Related MCP tools
A super light-weight embedded code search engine CLI (AST based) that just works - improves speed and efficiency for coding agent 🌟 Star if you like it!
Universal memory layer for AI Agents; Announcing OpenMemory MCP - local and secure memory management. Python-based implementation.
🚀 The fast, Pythonic way to build MCP servers and clients Trusted by 19900+ developers. Trusted by 19900+ developers. Trusted by 19900+ developers.
Python SQL Parser and Transpiler
Build effective agents using Model Context Protocol and simple workflow patterns Python-based implementation. Trusted by 7600+ developers.
Neo4j Labs Model Context Protocol servers
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP