|
1 | | -# GCoder Project: Autonomous AI Agent Framework |
2 | 1 |
|
3 | | -This repository hosts an advanced, modular AI agent framework designed for complex system interaction, development assistance, and automated task execution. The core operational paradigm strictly adheres to the **Observe -> Orient -> Decide -> Act -> Verify** lifecycle. |
| 2 | +# G-Coder: AI Agent for Code & System Tasks |
4 | 3 |
|
5 | | - |
| 4 | +<div align="center"> |
| 5 | + |
| 6 | +``` |
| 7 | + ██████╗ ██████╗ ██████╗ ██████╗ ███████╗██████╗ |
| 8 | + ██╔════╝ ██╔═══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗ |
| 9 | +██║ ███╗██║ ██║██║ ██║██║ ██║█████╗ ██████╔╝ |
| 10 | +██║ ██║██║ ██║██║ ██║██║ ██║██╔══╝ ██╔══██╗ |
| 11 | +╚██████╔╝╚██████╔╝██████╔╝██████╔╝███████╗██║ ██║ |
| 12 | + ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ |
| 13 | +``` |
| 14 | +**An AI agent CLI for system admin and code dev tasks, powered by the Google Agent Development Kit.** |
| 15 | + |
| 16 | +</div> |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | +**G-Coder** is a sophisticated, command-line AI agent designed to be your partner in software development, DevOps, and system administration. Built on the powerful and fluid [Google Agent Development Kit (ADK)](https://google.github.io/adk-docs/), G-Coder is engineered for speed, reliability, and effectiveness. |
| 22 | + |
| 23 | +Its core philosophy revolves around providing the AI with meticulously designed tools, intuitive naming conventions, and a smart system prompt. This combination makes the agent remarkably effective, even with smaller open-source models, and an absolute powerhouse with frontier models, capable of conducting highly complex tasks. |
6 | 24 |
|
7 | 25 | --- |
8 | | -**Note:** The screenshot above illustrates the typical interactive environment or interface of the running agent. |
| 26 | + |
| 27 | +## ✨ Features |
| 28 | + |
| 29 | +* **Powered by Google ADK**: Leverages the speed, reliability, and fluidity of the Google Agent Development Kit for a robust and responsive agentic experience. |
| 30 | +* **Multi-LLM Backend**: Seamlessly switch between different LLM providers. |
| 31 | + * ✅ **Ollama** (for local models) |
| 32 | + * ✅ **OpenAI** |
| 33 | + * ✅ **Gemini AI Studio** |
| 34 | + * ✅ **vLLM** (or any OpenAI-compatible endpoint) |
| 35 | +* **🧠 Code Intelligence Toolbox (LSP-Powered)**: This is G-Coder's most powerful feature. It indexes your codebase and uses the Language Server Protocol (LSP) to provide the agent with deep, contextual understanding of your code. This allows it to navigate complex projects, find definitions, and trace references with surgical precision, all without consuming excessive context. |
| 36 | +* **🤖 Autonomous Task Mode**: For complex, multi-step tasks, you can delegate control to the agent using the `@task` command. It will work autonomously towards the goal, providing a live-updating dashboard of its progress. (Note: This feature is experimental as we continue to refine multiple autonomous agent patterns). |
| 37 | +* **🛠️ Comprehensive Toolset**: |
| 38 | + * **File Operations**: Read, write, and make surgical edits to files. |
| 39 | + * **Shell Execution**: Cross-platform support for running terminal commands. |
| 40 | + * **Service Management**: Start, monitor, and stop long-running services like web servers and dev watchers. |
| 41 | + * **Vision Tools** (Optional): Enable vision capabilities for multimodal models to analyze images. |
| 42 | + * **Browser Tools** (Optional): Allow the agent to interact with web pages, interpret UIs, and perform actions in a browser. |
| 43 | +* **💡 Flexible Interaction Modes**: |
| 44 | + * **Interactive Mode**: A rich, conversational CLI for back-and-forth collaboration. |
| 45 | + * **Command-Line Mode**: Execute single, automated tasks and exit, perfect for scripting. |
| 46 | +* **🚀 REST API Server**: Start G-Coder with a FastAPI backend, exposing its capabilities via a REST API with a built-in Swagger UI. This is perfect for serving agent environments in Docker containers. |
| 47 | +* **🎨 Dynamic UI**: A visually pleasing and informative terminal interface that shows a new vaporwave-style logo banner on each startup. |
| 48 | + |
9 | 49 | --- |
10 | 50 |
|
11 | | -## 1. Project Architecture Overview |
| 51 | +## 🚀 Installation & Setup |
12 | 52 |
|
13 | | -The framework is organized into functional layers for clarity and extensibility: |
| 53 | +### Prerequisites |
| 54 | +* Python 3.9+ |
| 55 | +* Git |
14 | 56 |
|
15 | | -| Path | Description | Key Files | |
16 | | -| :--- | :--- | :--- | |
17 | | -| **`src/gcoder/`** | Core Python logic and agent definition. | `main.py` (Entry Point) | |
18 | | -| **`src/gcoder/agents/`** | Implementations of the AI decision-makers. | `basic_agent.py`, `autonomous_agent.py` | |
19 | | -| **`src/gcoder/tools/`** | The comprehensive toolkit providing capabilities to the agents. | `execution_tools.py`, `file_tools.py`, `code_tools.py`, `vision_tools.py` | |
20 | | -| **`src/gcoder/prompts/`** | Stores system instructions and persona definitions. | `basic_agent_instruction.txt` | |
21 | | -| **`src/gcoder/lsp/`** | Integration layer for Language Server Protocol diagnostics. | `lsp_manager.py` | |
22 | | -| **`screenshots/`** | Visual documentation references. | `screen1.png`, `screen2.png` | |
| 57 | +### 1. Clone the Repository |
| 58 | +```bash |
| 59 | +git clone https://github.com/GreazySpoon/gcoder.git |
| 60 | +cd gcoder |
| 61 | +``` |
23 | 62 |
|
24 | | -## 2. Setup and Installation |
| 63 | +### 2. Install Dependencies |
| 64 | +It is highly recommended to use a virtual environment. |
| 65 | +```bash |
| 66 | +python -m venv .venv |
| 67 | +source .venv/bin/activate # On Windows, use `.venv\Scripts\activate` |
| 68 | +pip install -e . |
| 69 | +``` |
| 70 | +This installs the project in "editable" mode, so changes you make to the source code are immediately reflected. |
25 | 71 |
|
26 | | -### Prerequisites |
| 72 | +### 3. Configure Your LLM |
| 73 | +The first time you run `gcoder`, it will create a configuration file at `~/.gcoder/config.ini`. Open this file and edit it to select your desired LLM provider and enter your model names. |
27 | 74 |
|
28 | | -* Python 3.8+ |
29 | | -* Node.js (Likely required due to `package.json` presence) |
| 75 | +```ini |
| 76 | +[default] |
| 77 | +# Supported values: ollama, openai, gemini, vllm |
| 78 | +active_provider = ollama |
30 | 79 |
|
31 | | -### Installation |
| 80 | +[ollama] |
| 81 | +host = http://localhost:11434 |
| 82 | +model = llama3:latest |
| 83 | +autonomous_model = llama3:latest |
32 | 84 |
|
33 | | -1. **Clone & Navigate:** |
34 | | - ```bash |
35 | | - git clone <repository-url> |
36 | | - cd gcoder-project |
37 | | - ``` |
| 85 | +[openai] |
| 86 | +# Your OPENAI_API_KEY must be set as an environment variable. |
| 87 | +model = gpt-4o |
| 88 | +autonomous_model = gpt-4o |
| 89 | +``` |
38 | 90 |
|
39 | | -2. **Install Dependencies:** |
40 | | - The presence of `pyproject.toml` suggests a modern dependency manager like Poetry or PDM. |
41 | | - ```bash |
42 | | - # Recommended (if using Poetry) |
43 | | - poetry install |
44 | | - |
45 | | - # Fallback if necessary |
46 | | - # pip install -r requirements.txt (if requirements.txt exists) |
47 | | - |
48 | | - # Install Node dependencies |
49 | | - npm install |
50 | | - ``` |
| 91 | +### 4. (Recommended) Enable Code Intelligence |
| 92 | +To unlock the powerful Code Intelligence tools, you need to install the relevant Language Server Protocol (LSP) servers. The agent will automatically detect them if they are in your system's PATH. |
51 | 93 |
|
52 | | -## 3. Execution and Operation |
| 94 | +For **Python** support (heavily tested), install `pyright`: |
| 95 | +```bash |
| 96 | +npm install -g pyright-langserver |
| 97 | +``` |
| 98 | + |
| 99 | +Support for TypeScript/JavaScript (`typescript-language-server`) and C# (`omnisharp`) is also available. |
53 | 100 |
|
54 | | -The application is executed via the main script, which handles argument parsing and initiates the primary agent loop. |
| 101 | +--- |
55 | 102 |
|
56 | | -**Running a Task (from `src/gcoder/main.py`):** |
| 103 | +## 💻 How to Use |
| 104 | + |
| 105 | +### Interactive Mode |
| 106 | +This is the default mode. Start a rich, conversational session. The `-a` flag enables human approval for sensitive commands like `sudo`. |
57 | 107 | ```bash |
58 | | -python src/gcoder/main.py --task "Analyze the code and update the README" |
| 108 | +gcoder -a |
59 | 109 | ``` |
60 | 110 |
|
61 | | -### Tool Capabilities Summary |
| 111 | +### Autonomous Task Mode |
| 112 | +Delegate a complex task to the agent within the interactive session using the `@task` keyword. |
| 113 | +``` |
| 114 | +> /path/to/your/project ❯ @task Refactor the database connection logic in `main.py` to use a connection pool. |
| 115 | +``` |
| 116 | + |
| 117 | +### Single-Shot Task Mode |
| 118 | +Run a single autonomous task from your terminal and exit. Useful for scripting. |
| 119 | +```bash |
| 120 | +gcoder --task "Analyze the `docker-compose.yml` file and explain the services it defines." |
| 121 | +``` |
| 122 | + |
| 123 | +### API Server Mode |
| 124 | +Start the FastAPI server (defaults to port 8844). |
| 125 | +```bash |
| 126 | +gcoder --api 8844 |
| 127 | +``` |
| 128 | +You can now access the Swagger UI at `http://127.0.0.1:8844/docs`. |
| 129 | + |
| 130 | +--- |
| 131 | + |
| 132 | +## 🖼️ Usage Examples |
| 133 | + |
| 134 | +#### Interactive Chat & File Editing |
| 135 | + |
62 | 136 |
|
63 | | -Agents operate by leveraging the following tool categories: |
64 | | -* **Execution:** `run_in_terminal` allows safe execution of shell commands (e.g., `ls`, `git`). |
65 | | -* **File System:** Tools for reading, writing, and surgical editing of files (`read_file`, `edit_file`). |
66 | | -* **Code Intelligence:** LSP-backed tools for finding definitions and references across the codebase. |
| 137 | +#### Autonomous Task Dashboard |
| 138 | + |
67 | 139 |
|
68 | | -## 4. Usage Example: File Modification Workflow |
| 140 | +--- |
| 141 | + |
| 142 | +## 🛣️ Roadmap & Future Enhancements |
| 143 | +We are constantly working to improve G-Coder. Here's what's on the horizon: |
| 144 | + |
| 145 | +- [ ] **Autonomous Agent**: Enhance the autonomous agent to run reliably until a task is achieved or context limit is reached. |
| 146 | +- [ ] **Web UI**: Develop a full-featured web interface for interacting with the agent. |
| 147 | +- [ ] **Browser Interaction**: Further improve the reliability and capabilities of the browser tools. |
| 148 | +- [ ] **Multi-Code-Project (MCP) Support**: Better management for tasks spanning multiple codebases. |
| 149 | +- [ ] **API Endpoints**: Add dedicated API endpoints for browser and agent control. |
| 150 | +- [ ] **Session Management**: Persistent and shareable agent sessions. |
| 151 | +- [ ] **Background Subtasks**: Ability to spawn and manage background tasks. |
| 152 | +- [ ] **Pip Installation**: Make the package easily installable via `pip install gcoder`. |
69 | 153 |
|
70 | | -The agent excels at multi-step technical tasks. This secondary screenshot demonstrates a sequence where the agent reads file content and executes an edit based on a user request. |
| 154 | +--- |
71 | 155 |
|
72 | | - |
| 156 | +## 📂 Project Structure |
73 | 157 |
|
74 | | -## 5. Known Observations (From Code Inspection) |
| 158 | +A brief overview of the project's layout: |
75 | 159 |
|
76 | | -* **Agent Configuration:** Agents like `basic_agent.py` have compile-time configuration toggles for enabling advanced features like **Thinking** and **Vision**. |
77 | | -* **External Dependencies:** The `basic_agent.py` shows import errors related to `google.adk.models`, suggesting potential integration with an internal or specific Google SDK that might be missing or misconfigured in the current environment. |
| 160 | +``` |
| 161 | +. |
| 162 | +├── src/gcoder/ |
| 163 | +│ ├── api/ # FastAPI server logic. |
| 164 | +│ ├── agents/ # Agent definitions and prompts. |
| 165 | +│ ├── system/ # Core system components (tools, callbacks, capabilities). |
| 166 | +│ ├── ui/ # Rich UI components like the task dashboard. |
| 167 | +│ ├── banners/ # ASCII art banners for the CLI. |
| 168 | +│ ├── config.py # Configuration management. |
| 169 | +│ ├── main.py # CLI entry point and argument parsing. |
| 170 | +│ ├── models.py # LLM model loading and abstraction. |
| 171 | +│ └── terminal.py # Main interactive terminal loop and logic. |
| 172 | +├── pyproject.toml # Project definition and dependencies. |
| 173 | +└── README.md # You are here! |
| 174 | +``` |
| 175 | + |
| 176 | +--- |
| 177 | + |
| 178 | +## 🙌 Contributing |
| 179 | +Contributions are welcome! If you'd like to help improve G-Coder, please feel free to fork the repository, create a new branch for your feature or bug fix, and submit a pull request. |
| 180 | + |
| 181 | +--- |
78 | 182 |
|
79 | | -## 6. Configuration Files |
| 183 | +## 📜 License |
80 | 184 |
|
81 | | -Initial environment variables and settings should be checked in: |
82 | | -* `example-config.ini` |
83 | | -* `pyproject.toml` (for Python dependencies and metadata) |
| 185 | +MIT License |
0 commit comments