You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-64
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
</p>
8
8
9
9
<h2align="center">
10
-
Scriptable interface to a powerful, multi-lingual language server.
10
+
The SWE that Never Sleeps
11
11
</h2>
12
12
13
13
<divalign="center">
@@ -22,72 +22,48 @@
22
22
23
23
<br />
24
24
25
-
[Codegen](https://docs.codegen.com) is a python library for manipulating codebases.
25
+
The Codegen SDK provides a programmatic interface to code agents provided by [Codegen](https://codegen.com).
26
26
27
27
```python
28
-
from codegen import Codebase
29
-
30
-
# Codegen builds a complete graph connecting
31
-
# functions, classes, imports and their relationships
32
-
codebase = Codebase("./")
33
-
34
-
# Work with code without dealing with syntax trees or parsing
35
-
for function in codebase.functions:
36
-
# Comprehensive static analysis for references, dependencies, etc.
37
-
ifnot function.usages:
38
-
# Auto-handles references and imports to maintain correctness
39
-
function.move_to_file("deprecated.py")
40
-
```
41
-
42
-
Write code that transforms code. Codegen combines the parsing power of [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) with the graph algorithms of [rustworkx](https://github.com/Qiskit/rustworkx) to enable scriptable, multi-language code manipulation at scale.
28
+
from codegen.agents.agent import Agent
43
29
44
-
## Installation and Usage
30
+
# Initialize the Agent with your organization ID and API token
31
+
agent = Agent(
32
+
org_id="YOUR_ORG_ID", # Find this at codegen.com/developer
33
+
token="YOUR_API_TOKEN", # Get this from codegen.com/developer
34
+
# base_url="https://codegen-sh-rest-api.modal.run", # Optional - defaults to production
35
+
)
45
36
46
-
We support
37
+
# Run an agent with a prompt
38
+
task = agent.run(prompt="Implement a new feature to sort users by last login.")
- Linux is supported on x86_64 and aarch64 with glibc 2.34+
52
-
- Windows is supported via WSL. See [here](https://docs.codegen.com/building-with-codegen/codegen-with-wsl) for more details.
53
-
- Python, Typescript, Javascript and React codebases
40
+
# Check the initial status
41
+
print(task.status)
54
42
55
-
```
56
-
# Install inside existing project
57
-
uv pip install codegen
43
+
# Refresh the task to get updated status (tasks can take time)
44
+
task.refresh()
58
45
59
-
# Install global CLI
60
-
uv tool install codegen --python 3.13
46
+
#Check the updated status
47
+
print(task.status)
61
48
62
-
# Create a codemod for a given repo
63
-
cd path/to/repo
64
-
codegen init
65
-
codegen create test-function
66
-
67
-
# Run the codemod
68
-
codegen run test-function
69
-
70
-
# Create an isolated venv with codegen => open jupyter
71
-
codegen notebook
49
+
# Once task is complete, you can access the result
50
+
if task.status =="completed":
51
+
print(task.result) # Result often contains code, summaries, or links
72
52
```
73
53
74
-
## Usage
54
+
## Installation and Usage
75
55
76
-
See [Getting Started](https://docs.codegen.com/introduction/getting-started) for a full tutorial.
56
+
Install the SDK using pip or uv:
77
57
58
+
```bash
59
+
pip install codegen
60
+
# or
61
+
uv pip install codegen
78
62
```
79
-
from codegen import Codebase
80
-
```
81
-
82
-
## Troubleshooting
83
-
84
-
Having issues? Here are some common problems and their solutions:
85
63
86
-
-**I'm hitting an UV error related to `[[ packages ]]`**: This means you're likely using an outdated version of UV. Try updating to the latest version with: `uv self update`.
87
-
-**I'm hitting an error about `No module named 'codegen.sdk.extensions.utils'`**: The compiled cython extensions are out of sync. Update them with `uv sync --reinstall-package codegen`.
88
-
-**I'm hitting a `RecursionError: maximum recursion depth exceeded` error while parsing my codebase**: If you are using python 3.12, try upgrading to 3.13. If you are already on 3.13, try upping the recursion limit with `sys.setrecursionlimit(10000)`.
64
+
Get started at [codegen.com](https://codegen.com) and get your API token at [codegen.com/developer](https://codegen.com/developer).
89
65
90
-
If you run into additional issues not listed here, please [join our slack community](https://community.codegen.com) and we'll help you out!
66
+
You can interact with your AI engineer via API, or chat with it in Slack, Linear, Github, or on our website.
91
67
92
68
## Resources
93
69
@@ -96,18 +72,6 @@ If you run into additional issues not listed here, please [join our slack commun
96
72
-[Contributing](CONTRIBUTING.md)
97
73
-[Contact Us](https://codegen.com/contact)
98
74
99
-
## Why Codegen?
100
-
101
-
Software development is fundamentally programmatic. Refactoring a codebase, enforcing patterns, or analyzing control flow - these are all operations that can (and should) be expressed as programs themselves.
102
-
103
-
We built Codegen backwards from real-world refactors performed on enterprise codebases. Instead of starting with theoretical abstractions, we focused on creating APIs that match how developers actually think about code changes:
104
-
105
-
-**Natural mental model**: Write transforms that read like your thought process - "move this function", "rename this variable", "add this parameter". No more wrestling with ASTs or manual import management.
106
-
107
-
-**Battle-tested on complex codebases**: Handle Python, TypeScript, and React codebases with millions of lines of code.
108
-
109
-
-**Built for advanced intelligences**: As AI developers become more sophisticated, they need expressive yet precise tools to manipulate code. Codegen provides a programmatic interface that both humans and AI can use to express complex transformations through code itself.
110
-
111
75
## Contributing
112
76
113
77
Please see our [Contributing Guide](CONTRIBUTING.md) for instructions on how to set up the development environment and submit contributions.
Our mission is to build fully-autonomous software engineering - the equivalent of self-driving cars for code.
17
+
18
+
We believe the highest leverage path to autonomous development is enabling AI agents to "act via code."
19
+
20
+
Just as self-driving cars need sophisticated sensors and controls to navigate the physical world, AI agents need powerful, precise tools to manipulate codebases. We're building that foundational layer: a programmatic interface that lets AI agents express complex code transformations through code itself.
21
+
22
+
This approach creates a shared language that both humans and AI can use to:
23
+
24
+
- Express powerful changes with precision and predictability
25
+
- Build sophisticated tools from primitive operations
26
+
- Create and maintain their own abstractions
27
+
- Scale transformations across massive codebases
28
+
29
+
## The Team
30
+
31
+
Based in San Francisco, we're a team of engineers and researchers passionate about:
32
+
33
+
- Making large-scale code changes more accessible
34
+
- Building tools that work the way developers think
35
+
- Creating the infrastructure for AI-powered code manipulation
36
+
- Advancing the state of the art in program transformation
37
+
38
+
## Open Source
39
+
40
+
We believe in the power of open source software. Our core library, [codegen](https://github.com/codegen-sh/codegen-sdk), is freely available and open to contributions from the community.
0 commit comments