How apecloud/aperag works
ApeRAG is a RAG platform for building and querying knowledge collections, with a web/API interface, document ingestion and multimodal parsing, five retrieval index types, agent-assisted answers, and enterprise management. A typical workflow starts with a user adding documents to a collection; ingestion parses and indexes them, then chat or search retrieves relevant material for an answer. The graph also preserves documented branches for graph normalization, MCP access, web search, workflows, evaluation, and administration. Several links reflect README-level capabilities because the relevant runtime files were not sampled.
Main entry points: agent_chat_service.py Agent Chat · collections.py Collection API · app.py FastAPI Routes · document_service.py Document Service
Components 29
API and Services
- FastAPI Routes
aperag/app.py - Collection API
aperag/views/collections.py - Authentication API
aperag/views/auth.py - Collection Services
aperag/service/collection_service.py
Collection Ingestion
- Document Service
aperag/service/document_service.py - Source Connectors
aperag/source/base.py - Document Parsing
aperag/docparser/doc_parser.py - Index Manager
aperag/index/manager.py - Five Index Types
aperag/index - Graph Indexing
aperag/graph/lightrag_manager.py - LightRAG Engine
aperag/graph/lightrag/base.py
Retrieval and Agents
- Agent Chat
aperag/service/agent_chat_service.py - Agent Sessions
aperag/agent/agent_session_manager.py - Search and Query
aperag/query/query.py - Agent Workflow Engine
aperag/flow/engine.py - MCP Server
aperag/mcp/server.py - Web Search
aperag/websearch/search/search_service.py
Data and Models
- Relational Data
aperag/db/models.py - Database Operations
aperag/db/ops.py - LLM Services
aperag/llm/completion/completion_service.py - Vector Store
aperag/vectorstore/connector.py - API and Flow Schemas
aperag/schema/view_models.py
Product Capabilities
- Audit Logging
aperag/utils/audit_decorator.py - Summary Indexing
aperag/service/collection_summary_service.py - Evaluation
aperag/service/evaluation_service.py - Marketplace
aperag/service/marketplace_service.py
Other components
- User
- MCP Client
- Web Search Providers
Connections 30
- User → FastAPI Routes: uses
README.md - FastAPI Routes → Collection API: routes
aperag/app.py - User → Collection API: manages collections
README.md - Collection API → Collection Services: delegates
aperag/views/collections.py - Collection API → Document Service: delegates
aperag/views/collections.py - User → Authentication API: authenticates
README.md - Document Service → Source Connectors: acquires documents
- Source Connectors → Document Parsing: supplies content
- Document Service → Index Manager: indexes documents
- Index Manager → Five Index Types: coordinates
- Graph Indexing → LightRAG Engine: builds graph index
aperag/graph/lightrag_manager.py - LightRAG Engine → LLM Services: uses language models
- User → Agent Chat: asks questions
README.md - Agent Chat → Agent Sessions: manages sessions
- Agent Chat → Search and Query: retrieves context
- Search and Query → Five Index Types: hybrid retrieval
README.md - Agent Chat → Web Search: searches web
README.md - Web Search → Web Search Providers: queries providers
aperag/websearch/search/search_service.py - Agent Chat → LLM Services: generates answers
- User → Agent Workflow Engine: configures workflows
README.md - MCP Client → MCP Server: connects
README.md - MCP Server → Search and Query: offers hybrid search
README.md - Database Operations → Relational Data: reads and writes
- Database Operations → Relational Data: composes repositories
aperag/db/ops.py - Five Index Types → Vector Store: stores vectors
- FastAPI Routes → API and Flow Schemas: validates requests
- Collection API → Audit Logging: audits actions
aperag/views/collections.py - Collection Services → Summary Indexing: generates summaries
- User → Evaluation: evaluates answers
README.md - User → Marketplace: explores collections
README.md