A simple, iterative AI agent that helps vibe coders to build projects using Ollama or other LLM's API Starts the code project for iterative vibe project by guiding AI with plain English. Agent Coder is an chat interactive command line interface tool designed to streamline your coding workflow using Large Language Models (LLMs). It allows you to prompt models via Ollama or OpenAI, view the generated code in a formatted terminal interface, and selectively save code blocks directly to your project files.
*** At this point this is just the base code for starting a project- there is still a lot of work to be done and need to work out the iterative features***
- Multi-Backend Support: switch between local models via Ollama and cloud-based models via OpenAI.
- Interactive CLI: Powered by
questionaryfor a smooth, guided user experience. - Code Extraction: Automatically identifies and extracts markdown code blocks from LLM responses.
- Surgical File Saving: Choose which generated code blocks to save and specify filenames on the fly.
- Rich Visuals: Uses
richto provide syntax highlighting and clean panel-based layouts in the terminal. - Extensible Architecture: Built using modules with an abstract base class system, making it easy to add new LLM providers.
- Python: 3.8 or higher.
- Ollama (optional): Install from ollama.com if you plan to use local models.
- OpenAI API Key (optional): Required if you plan to use OpenAI models.
-
Clone the repository:
git clone <repository-url> cd ollama-agent-coder
-
Install dependencies:
pip install -r requirements.txt
Run the application using Python:
python main.py- Select Backend: Choose between "Ollama" or "OpenAI".
- Model Selection: Pick from the list of available models on your chosen backend.
- Set Project Directory: Specify where you want the generated files to be saved.
- Prompt: Tell the agent what you want to code (e.g., "Create a Python script to scrape news headlines").
- Review & Save: View the generated response and choose whether to save specific code blocks to your project.
main.py: The central orchestration script.cli.py: Handles terminal interactions and user input.code_extractor.py: Utility for parsing code blocks from markdown.llm/: Contains the LLM client implementations.base.py: The abstract base class for all LLM clients.ollama_client.py: Client for interacting with the Ollama API.openai_client.py: Client for interacting with the OpenAI API.
Contributions are welcome! Please feel free to submit a Pull Request or open an issue for any bugs or feature requests.
This project is open-source and available under the MIT License.