RAGent is a RAG-powered intelligent agent designed for code knowledge base Q&A. It combines Plan-and-Execute with ReAct paradigms and supports dynamic tool ecosystem expansion via the MCP protocol.
- Multi-way Retrieval — Vector (semantic) + Keyword (BM25) + Graph (relational) with reciprocal rank fusion
- Hybrid Agent — Planner generates task plans; Executor runs ReAct loops
- MCP Protocol — Dynamically discover and invoke external Tool Servers
- Progressive Skill Disclosure — Automatically adjust capability level based on task complexity
- CLI Interface — Supports both direct queries and interactive chat modes
# Install dependencies
pip install ragents
# Configure environment
cp .env.example .env
# Edit .env with your API keys
# Direct query
ragent query "How do React Hooks work?"
# Interactive chat
ragent chat
# Build index
ragent index ./my_docs/ --output ./index/my_docsgraph LR
CLI[CLI] --> Agent[HybridAgent]
Agent --> Planner[Planner]
Agent --> Executor[ReAct Executor]
Executor --> RAG[RAG Retriever]
Executor --> Tools[ToolRegistry]
Tools --> MCP[MCP Client]
Tools --> Local[Local Tools]
Planner --> LLM[LLM Provider]
Executor --> LLM
- Interface Contracts — API specifications for all base classes
- Data Models — Pydantic schema definitions
- Architecture — System design and data flows
- Development Guide — Contributing and extending
- MCP Setup — MCP Server configuration
RAGent/
├── src/ragents/ # Main package
│ ├── cli/ # Command-line interface
│ ├── agent/ # Agent core (Planner + Executor)
│ ├── rag/ # Retrieval layer
│ ├── mcp/ # MCP protocol client
│ ├── tools/ # Local tool implementations
│ ├── llm/ # LLM abstraction
│ ├── schema/ # Pydantic data models
│ └── utils/ # Utilities
├── tests/ # Unit, integration, and benchmark tests
├── docs/ # Documentation (en / zh)
├── scripts/ # Development and deployment scripts
└── examples/ # Sample input documents
See Development Guide for setup instructions and contribution guidelines.