|
22 | 22 |
|
23 | 23 | <br /> |
24 | 24 |
|
25 | | -The Codegen SDK provides a programmatic interface to code agents provided by [Codegen](https://codegen.com). |
| 25 | +# Codegen SDK |
| 26 | + |
| 27 | +The Codegen SDK provides a programmatic interface to AI-powered code agents provided by [Codegen](https://codegen.com). It enables developers to integrate intelligent code generation, analysis, and transformation capabilities into their workflows and applications. |
| 28 | + |
| 29 | +## Features |
| 30 | + |
| 31 | +- **AI-Powered Code Generation**: Generate code based on natural language descriptions |
| 32 | +- **Code Analysis**: Analyze codebases for patterns, issues, and insights |
| 33 | +- **Code Transformation**: Refactor and transform code with intelligent understanding of context |
| 34 | +- **Multi-Language Support**: Works with Python, JavaScript, TypeScript, and more |
| 35 | +- **Integration with Development Workflows**: Seamlessly integrate with your existing tools |
| 36 | +- **Extensible Architecture**: Build custom extensions and workflows |
| 37 | + |
| 38 | +## Installation |
| 39 | + |
| 40 | +Install the SDK using pip or uv: |
| 41 | + |
| 42 | +```bash |
| 43 | +pip install codegen |
| 44 | +# or |
| 45 | +uv pip install codegen |
| 46 | +``` |
| 47 | + |
| 48 | +Requires Python 3.12 or newer. |
| 49 | + |
| 50 | +## Quick Start |
26 | 51 |
|
27 | 52 | ```python |
28 | 53 | from codegen.agents.agent import Agent |
@@ -51,31 +76,89 @@ if task.status == "completed": |
51 | 76 | print(task.result) # Result often contains code, summaries, or links |
52 | 77 | ``` |
53 | 78 |
|
54 | | -## Installation and Usage |
| 79 | +## Advanced Usage |
55 | 80 |
|
56 | | -Install the SDK using pip or uv: |
| 81 | +### Working with Specific Files |
| 82 | + |
| 83 | +```python |
| 84 | +from codegen.agents.agent import Agent |
| 85 | + |
| 86 | +agent = Agent(org_id="YOUR_ORG_ID", token="YOUR_API_TOKEN") |
| 87 | + |
| 88 | +# Analyze a specific file |
| 89 | +task = agent.run( |
| 90 | + prompt="Analyze this file for potential bugs and suggest improvements.", |
| 91 | + files=["path/to/your/file.py"] |
| 92 | +) |
| 93 | + |
| 94 | +# Wait for completion and get results |
| 95 | +task.wait_until_complete() |
| 96 | +print(task.result) |
| 97 | +``` |
| 98 | + |
| 99 | +### Transforming Code |
| 100 | + |
| 101 | +```python |
| 102 | +from codegen.agents.agent import Agent |
| 103 | + |
| 104 | +agent = Agent(org_id="YOUR_ORG_ID", token="YOUR_API_TOKEN") |
| 105 | + |
| 106 | +# Transform code based on requirements |
| 107 | +task = agent.run( |
| 108 | + prompt="Refactor this code to use async/await pattern instead of callbacks.", |
| 109 | + files=["path/to/your/file.js"] |
| 110 | +) |
| 111 | + |
| 112 | +# Wait for completion and get results |
| 113 | +task.wait_until_complete() |
| 114 | +print(task.result) |
| 115 | +``` |
| 116 | + |
| 117 | +## Command Line Interface |
| 118 | + |
| 119 | +The SDK includes a powerful CLI tool that allows you to interact with Codegen directly from your terminal: |
57 | 120 |
|
58 | 121 | ```bash |
59 | | -pip install codegen |
60 | | -# or |
61 | | -uv pip install codegen |
| 122 | +# Get help |
| 123 | +codegen --help |
| 124 | + |
| 125 | +# Initialize configuration |
| 126 | +codegen init |
| 127 | + |
| 128 | +# Run an agent with a prompt |
| 129 | +codegen run "Implement a function to calculate Fibonacci numbers" |
| 130 | + |
| 131 | +# Analyze a file |
| 132 | +codegen analyze path/to/file.py |
62 | 133 | ``` |
63 | 134 |
|
64 | | -Get started at [codegen.com](https://codegen.com) and get your API token at [codegen.com/developer](https://codegen.com/developer). |
| 135 | +## Integrations |
| 136 | + |
| 137 | +Codegen integrates with popular development tools: |
65 | 138 |
|
66 | | -You can interact with your AI engineer via API, or chat with it in Slack, Linear, Github, or on our website. |
| 139 | +- **Slack**: Chat with your AI engineer in Slack |
| 140 | +- **GitHub**: Get PR reviews and code suggestions |
| 141 | +- **Linear**: Manage tasks and issues with AI assistance |
| 142 | +- **Web Interface**: Use the web UI at [codegen.com](https://codegen.com) |
67 | 143 |
|
68 | 144 | ## Resources |
69 | 145 |
|
70 | | -- [Docs](https://docs.codegen.com) |
71 | | -- [Getting Started](https://docs.codegen.com/introduction/getting-started) |
72 | | -- [Contributing](CONTRIBUTING.md) |
| 146 | +- [Documentation](https://docs.codegen.com) |
| 147 | +- [Getting Started Guide](https://docs.codegen.com/introduction/getting-started) |
| 148 | +- [API Reference](https://docs.codegen.com/api-reference) |
| 149 | +- [Examples](https://github.com/codegen-sh/codegen-examples) |
| 150 | +- [Contributing Guide](CONTRIBUTING.md) |
73 | 151 | - [Contact Us](https://codegen.com/contact) |
74 | 152 |
|
75 | 153 | ## Contributing |
76 | 154 |
|
77 | | -Please see our [Contributing Guide](CONTRIBUTING.md) for instructions on how to set up the development environment and submit contributions. |
| 155 | +We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for instructions on how to set up the development environment and submit contributions. |
78 | 156 |
|
79 | 157 | ## Enterprise |
80 | 158 |
|
81 | 159 | For more information on enterprise engagements, please [contact us](https://codegen.com/contact) or [request a demo](https://codegen.com/request-demo). |
| 160 | + |
| 161 | +## License |
| 162 | + |
| 163 | +This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details. |
| 164 | + |
0 commit comments