This repository offers an example for building CODA, an agentic system that autonomously generates, modifies, and executes code based on user-defined tasks. This example provides a starting point, but we highly encourage you to explore your own design and prompt while adhering to the assignment specifications.
CODA transforms passive interactions with AI into active collaboration by enabling autonomous control within your development environment. Core features include:
- Input Handling: Accepts a task description and a working directory path.
- Function Calling: Uses OpenAI's API to generate shell scripts that perform the desired tasks.
- Execution: Runs the generated shell scripts and collects execution logs.
- Feedback Loop: Analyzes the execution logs to determine success and handles errors accordingly.
Ensure the following are installed:
- Python (Version 3.10 or higher)
- OpenAI Python SDK (
openai
package) - OpenAI API Key
-
Clone the Repository
git clone https://github.com/ingim/coda.git
-
Change to the CODA Directory
cd coda
-
Install Required Packages
pip install openai
-
Configure the OpenAI API Key
- Edit
coda.py
to include your API key, replacing'api_key'
with your actual key. - Alternatively, set it as an environment variable:
export OPENAI_API_KEY='your-api-key'
- Edit
-
Run CODA:
python main.py
-
Define Your Task:
- Enter a brief description of the code or function you want CODA to create.
- Specify the working directory where generated files should be saved.
-
Generated Scripts and Execution Logs:
- CODA will display the shell script it generates, followed by real-time logs for each execution.
-
Feedback Loop:
- Upon successful completion, you can define additional tasks or exit.
- For errors, CODA analyzes the issue and revises the task description as needed.