https://github.com/codegen-sh/codegen
Python wrapper for the Codegen API - run code agents at scale
https://github.com/codegen-sh/codegen
agents python sdk
Last synced: 17 days ago
JSON representation
Python wrapper for the Codegen API - run code agents at scale
- Host: GitHub
- URL: https://github.com/codegen-sh/codegen
- Owner: codegen-sh
- License: apache-2.0
- Created: 2025-01-21T19:35:33.000Z (about 1 year ago)
- Default Branch: develop
- Last Pushed: 2026-01-01T18:05:09.000Z (about 1 month ago)
- Last Synced: 2026-01-04T21:57:59.566Z (27 days ago)
- Topics: agents, python, sdk
- Language: Python
- Homepage: https://codegen.com
- Size: 31 MB
- Stars: 516
- Watchers: 6
- Forks: 62
- Open Issues: 206
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Cla: CLA.md
Awesome Lists containing this project
README
The SWE that Never Sleeps
[](https://pypi.org/project/codegen/)
[](https://docs.codegen.com)
[](https://community.codegen.com)
[](https://github.com/codegen-sh/codegen-sdk/tree/develop?tab=Apache-2.0-1-ov-file)
[](https://x.com/codegen)
The Codegen SDK provides a programmatic interface to code agents provided by [Codegen](https://codegen.com).
```python
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 links
```
## Installation and Usage
Install the SDK using pip, pipx, or uv:
```bash
pip install codegen
# or
pipx install codegen
# or
uv tool install codegen
```
### Keeping Up to Date
The Codegen CLI includes a built-in self-update system:
```bash
# Update to the latest version
codegen update
# Check for available updates
codegen update --check
# Update to a specific version
codegen update --version 1.2.3
```
The CLI automatically checks for updates daily and notifies you when a new version is available.
Get started at [codegen.com](https://codegen.com) and get your API token at [codegen.com/token](https://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
- [Docs](https://docs.codegen.com)
- [Getting Started](https://docs.codegen.com/introduction/getting-started)
- [Contributing](CONTRIBUTING.md)
- [Contact Us](https://codegen.com/contact)
## Contributing
Please see our [Contributing Guide](CONTRIBUTING.md) for instructions on how to set up the development environment and submit contributions.
## Enterprise
For more information on enterprise engagements, please [contact us](https://codegen.com/contact) or [request a demo](https://codegen.com/request-demo).