RA.Aid Documentation
website·Indexed 32 days ago
https://docs.ra-aid.aiRA.Aid is an AI-powered development companion for autonomous software building. It features a memory system for persisting project knowledge, support for open-source and thinking models via providers like Ollama, and a REST API (v1.0.0) for managing sessions and agents. The tool includes a web-based UI and supports complex workflows, including monorepo management and a 'plan first, execute later' planning workflow.
What's inside RA.Aid
- RA.Aid (pronounced "raid") is a standalone AI-powered coding agent built on LangChain's agent-based task execution framework. It automates software development by following a three-stage workflow: Research, Planning, and Implementation. It can handle complex programming tasks, research best practices, and modify code autonomously.
Overview of the RA.Aid Expert Model
The expert model is an AI model configured to provide advanced reasoning capabilities for complex tasks, acting as a 'second opinion' for the main agent. It is specifically used for domain-specific problems such as analyzing code, debugging issues, and making complex implementation decisions. This differs from 'Reasoning Assistance', which focuses on meta-guidance regarding tool usage and planning for weaker models.Understand RA.Aid's memory system architecture
RA.Aid uses a persistent memory system to store project facts, code snippets, and research notes across sessions. This data is stored in a SQLite database file namedpk.dblocated by default in a hidden.ra-aiddirectory within the current working directory. The database consists of four primary tables:KeyFact(project facts),KeySnippet(code snippets with file paths/line numbers),ResearchNote(detailed findings), andHumanInput(user input context).Understand Reasoning Assistance in RA.Aid
Reasoning Assistance is a feature that helps weaker agent models make better decisions regarding tool usage and task planning. It works by making a one-off call to a stronger 'expert model' at the start of each agent stage (research, planning, and implementation). The expert model receives the task description and available tools, then provides strategic guidance that is incorporated into the main agent's prompt.
Distinction from Expert Model feature:
- Reasoning Assistance: Focuses on the process (how to work, which tools to use, and planning).
- Expert Model: Focuses on domain-specific technical challenges (debugging, complex implementation decisions).
This is particularly useful for open-source or less capable models that struggle with complex reasoning or tool sequencing.
Supported model providers for RA.Aid
RA.Aid supports a wide range of open-source and proprietary model providers, including:
- DeepSeek: Strong reasoning models (e.g., R1).
- Fireworks: High-performance serverless inference.
- MakeHub: OpenAI-compatible AI router.
- OpenRouter: Unified API gateway for 100+ models.
- OpenAI-compatible: Self-hosted endpoints (Llama, Mistral, etc.).
- Anthropic: Claude series with large context windows.
- Gemini: Google's multimodal models.
- Ollama: Local LLM hosting (no API keys required).
- Bedrock: Amazon's serverless LLM platform via AWS IAM.
Manage RA.Aid project state directory
RA.Aid uses a project state directory to store persistent data, including the project knowledge database (pk.db) and operation logs. By default, this directory is created as.ra-aidin the current working directory. This directory is essential for maintaining memory across sessions, troubleshooting via logs, and backing up project state.Create custom Python tools for RA.Aid
To create custom tools, define Python functions using the@tooldecorator fromlangchain_core.tools. The file pointed to by the--custom-toolsflag must export a list namedtoolscontaining the tool functions.# tools/custom_tools.py from langchain_core.tools import tool @tool def custom_add(a: int, b: int) -> int: """Add two numbers together."" return a + b tools = [ custom_add, ]Initialize a new Next.js application using RA.Aid
Use the RA.Aid CLI to automatically initialize a new Next.js project. The tool will execute the necessary setup commands and reference the latest Next.js documentation to ensure best practices are followed.ra-aid -m "Initialize a new nextjs app."Contribute to RA.Aid documentation
Documentation for RA.Aid is located in thedocs/folder of the repository. Contributors are encouraged to submit Pull Requests for typo fixes or improved explanations. You can use the RA.Aid tool itself to help draft documentation changes.Run the RA.Aid development server and frontend
RA.Aid requires the backend and frontend to be run separately during development. The backend is started using thera-aid --servercommand. The frontend is managed viayarn devwithin thefrontend/directory. You can customize the frontend and backend ports using environment variablesVITE_FRONTEND_PORTandVITE_BACKEND_PORT.# Start the backend ra-aid --server # Start the frontend (default port 5173, targeting backend on 1818) cd frontend/ yarn dev # Example: Host web app on 5555 targeting backend on 1818 VITE_FRONTEND_PORT=5555 yarn dev # Example: Host web app on 2221 targeting backend on 9191 VITE_FRONTEND_PORT=2221 VITE_BACKEND_PORT=9191 yarn dev # Example: Host web app on 5173 targeting backend on 4002 VITE_BACKEND_PORT=4002 yarn devImplement application features incrementally with RA.Aid
When adding new features to a web application, provide RA.Aid with focused and specific prompts. This incremental approach maintains code quality and manages complexity. For example, when adding a form, specify the exact fields required.ra-aid -m "Add a simple user registration form. Include fields for email and password."Integrate advanced tools using MCP servers
For complex tools and services, you can use the Model Context Protocol (MCP) by configuringMultiServerMCPClient_Sync. This allows you to dynamically load tools from external MCP servers and assign them to thetoolslist exported in your custom tools file.# tools/custom_tools.py from ra_aid.utils.mcp_client import MultiServerMCPClient_Sync mcp_client = MultiServerMCPClient_Sync({ "mcp-example-server": { "transport": "stdio", "command": "python", "args": ["./examples/custom-tools-mcp/mcp_server.py"], }, "mcp-weather": { "transport": "stdio", "command": "npx", "args": [ "-y", "@smithery/cli@latest", "run", "@mcp-examples/weather", ] }, }) mcp_tools = mcp_client.get_tools_sync() tools = mcp_tools