A powerful, autonomous AI coding assistant built in Rust. This agent uses the ReAct (Reasoning and Acting) pattern to understand complex prompts, plan its actions, and execute them using a suite of integrated tools.
- Autonomous Agent Loop: Implements the ReAct pattern, allowing the agent to "think" (reason) and "act" (execute tools) in an iterative loop to solve multi-step problems.
- Tool Integration:
- Bash Tool: Execute shell commands directly to run scripts, install dependencies, or explore the system.
- File Tool: Read and write files within the project workspace, enabling autonomous coding and documentation.
- LLM Agnostic: Integrated with OpenRouter, allowing it to leverage various state-of-the-art models (like Claude 3.5 Sonnet or GPT-4o) while maintaining a consistent OpenAI-compatible interface.
- Flexible Orchestration: Handles context management, tool execution, and response parsing seamlessly.
The project is organized into modular components for easy extensibility:
src/agent/: The brain of the application. Contains theOrchestratorwhich manages the ReAct loop and maintains the conversation context.src/llm/: The communication layer. Handles requests to LLM providers (via OpenRouter) and parses responses into usable payloads.src/tools/: The agent's hands. Each tool (e.g.,BashTool,FileTool) is implemented here as a discrete module with specific capabilities.src/main.rs: The main entry point that initializes the agent and processes user input.
- Rust (1.92+)
- An OpenRouter API Key (set as an environment variable)
The recommended way to run the agent is using cargo run:
cargo run -- "Your prompt here"- User Prompt: You provide a task (e.g., "Implement a search function in src/lib.rs").
- Reasoning: The agent analyzes the request and decides which tool to use.
- Action: The agent executes a tool (like
read_fileorbash). - Observation: The agent receives the output of the tool.
- Iteration: Steps 2-4 repeat until the agent determines the task is complete and provides a final response.