A lightweight intelligent agent platform for individuals and small teams.
Simple architecture · Explicit code · Easy deployment · Easy to extend
Important
MiniAgent is currently under development, and its database structure and interface are subject to change. Please back up backend/db and backend/files before upgrading.
MiniAgent provides a complete workflow from model configuration, knowledge base building, agent orchestration to end-user dialogue. The project includes a FastAPI backend, a PureAdmin management backend, and a separate Workplace user workbench, suitable for building enterprise knowledge assistants, internal data assistants, legal advisors, and other vertical domain agents.
- Create and manage multiple agents, configure system prompts, LLM, and tools
- Support OpenAI compatible interfaces, Ollama and other model services
- Manage LLM, Embeddings, tools, domain plugins, and routing policies
- Control the scope of agent usage based on user-agent authorization relationships
- Support synchronous calls and SSE streaming responses
- Manage multiple knowledge bases, documents, and slices
- Support common document formats such as PDF, Word, text, and tables
- ChromaDB vector retrieval and BM25 keyword retrieval
- Support RRF fusion, threshold filtering, optional reordering, and Small-to-Big retrieval
- Support multi-knowledge base intelligent routing and domain processing plugins
- Use DuckDB Analyze structured data such as CSV and Excel
- SQL Agent supports data querying, statistical analysis, and chart generation
- Extensible tool system and Web Search capabilities
- Agent runtime tool caching and configuration invalidation mechanism
- JWT login, automatic Access Token refresh, and RBAC permission control
- Password complexity verification and login failure lockout
- Administrators can unlock users and maintain user agent authorizations
- Login logs, audit logs, and system configuration management
- API, SQLite, DuckDB, and hardware resource status monitoring
- Management: System management backend based on PureAdmin
- Workplace: Agent workbench for end users
- Login, automatic Token refresh, and logout
- Chinese
zh_CNand Englishen_US - Multiple theme colors
- Select authorized agents
- Query, view, rename, and delete sessions
- Markdown messages and SSE streaming conversations
flowchart TB
Admin["Management Backend"]
User["Workplace"]
API["FastAPI API"]
subgraph Core["Application Core"]
Auth["JWT / RBAC"]
Container["ServiceContainer"]
Agent["AgentFactory / AgentRunner"]
Tools["Tool Builder"]
KB["RAG Retrieval Pipeline"]
SQL["SQL Agent"]
end
subgraph Data["Data Layer"]
SQLite[(SQLite)]
DuckDB[(DuckDB)]
Chroma[(ChromaDB)]
BM25[(BM25 Index)]
Files[(Local Storage)]
end
Admin --> API
User --> API
API --> Auth
API --> Container
Container --> Agent
Agent --> Tools
Agent --> KB
Agent --> SQL
Container --> SQLite
SQL --> DuckDB
KB --> Chroma
KB --> BM25
KB --> Files
The backend adopts a clear layered structure:
-
app/api/: HTTP routing, dependency injection, and request/response transformation -
app/services/: Business logic -
app/runtime/: Runtime components such as agents, sessions, LLM, and retrieval -
app/repositories/: Asynchronous database access -
app/schemas/: Pydantic data model -
app/infra/: Database model, caching, initialization, and infrastructure
Startup process:
- DB init — app/infra/db/initializer.py creates SQLite tables and loads seed JSON from app/infra/db/seed/
- ServiceContainer — Builds the asynchronous SQLAlchemy engine, all repositories, and long-running services
- Domain plugins — Load domain rows from the database and register knowledge base processors via dynamic import.
All shared resources reside in request.app.state.container. Routes retrieve it via Depends(get_container).
| Modules | Technologies |
|---|---|
| Backend | Python, FastAPI, Pydantic, SQLAlchemy Async, Loguru |
| Agents | LangChain, Custom Agent Runtime |
| Admin Backend | Vue 3, TypeScript, PureAdmin, Element Plus, Pinia |
| User Workbench | Vue 3, TypeScript, Vite, Element Plus, Vue I18n |
| Business Database | SQLite |
| Analytics Database | DuckDB |
| Vector Database | ChromaDB |
| Search | Vector Search, BM25, RRF, Reranker |
miniagent/
├── backend/ # FastAPI Backend
│ ├── app/
│ │ ├── api/ # Admin, User, Auth, Operations Interface
│ │ ├── core/ # Configuration, Security, Dependency Injection, i18n
│ │ ├── infra/ # ORM, Database Initialization, Caching
│ │ ├── repositories/ # Asynchronous Data Access Layer
│ │ ├── runtime/ # Agent, LLM, Session and Runtime Components
│ │ ├── schemas/ # Pydantic DTO
│ │ └── services/ # Business Services
│ ├── db/ # Local Database and Indexes (Generated at Runtime)
│ ├── files/ # Upload Files (Generated at Runtime)
│ ├── .env.example # Environment Variable Template
│ └── requirements.txt
├── management/ # PureAdmin Management Backend
├── workplace/ # End-User Workbench
├── docker-compose.yml
├── setup.bat
├── setup.sh
└── README.md
- Python 3.12 or later
- Node.js 20.19+ or 22.13+
- pnpm 9 or later
- Available LLM service, such as Ollama or OpenAI compatible interface
- Optional: NVIDIA GPU and corresponding driver
git clone https://github.com/liupras/miniagent.git
cd miniagent
Windows PowerShell:
Set-Location backend
py -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
Copy-Item .env.example .env
Linux/macOS:
cd backend
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
cp .env.example .env
Open backend/.env, at least modify the JWT key, and configure the actual model service to be used. Then start the API:
python -m uvicorn app.main:app --reload --host 0.0.0.0 --port 10088
The application will automatically create the database and load seed data on its first startup.
Open a new terminal:
cd management
pnpm install
pnpm devDefault address: http://localhost:8848
Open another new terminal:
cd workplace
pnpm install
pnpm devWorkplace uses the Vite development server; the access address is as shown in the terminal output.
[!TIP]
pnpm must be run in the management or workplace directory. backend is a Python project and does not contain a package.json.
| Purpose | Username | Password |
|---|---|---|
| Administrator | admin |
1FaFkWt9 |
| Workplace Demo User | demo |
fIzF7JHK |
The demo user is authorized to use law_assistant by default.
Warning
The default account is for local development only. Before deploying to a shared or production environment, you must change the password, replace JWT_SECRET_KEY, and check user authorization.
After starting the default development environment:
| Service | Address |
|---|---|
| FastAPI | http://localhost:10088 |
| Swagger UI | http://localhost:10088/docs |
| ReDoc | http://localhost:10088/redoc |
| Health Check | http://localhost:10088/health |
| Management | http://localhost:8848 |
| Workplace | Refer to Vite terminal output |
Backend configuration is located in backend/.env. See backend/.env.example for complete fields.
The frontend development proxy points to http://127.0.0.1:10088 by default. Workplace can temporarily switch backend addresses by setting VITE_PROXY_TARGET before startup.
PowerShell Example:
$env:VITE_PROXY_TARGET="http://127.0.0.1:10089"
pnpm devBuild Management Backend:
cd management
pnpm buildCheck and Build Workplace:
cd workplace
pnpm buildSome search, LLM, and SQL Agent tests require model services and test data. Please prepare the environment according to the instructions in the test files.
-
SQLite, DuckDB, ChromaDB, BM25 indexes, and uploaded files are stored by default in the local directory under
backend. -
When you modify the agent, knowledge base, tool, or model configuration, the backend will automatically refresh the cache. If the caching system continues to use the old configuration, you can manually refresh the cache in
management. -
Do not commit
.envfiles, model keys, local databases, logs, or user-uploaded files to public repositories.
| Name | Location |
|---|---|
| prompt_loader | app.core.prompt_loader.py |
| t,translations | app.core.I18n.I18n.py |
| cache_registry | app.infra.store_registry.py |
| title_generator | app.runtime.conversation.title_generator.py |
| Cache Name | Class | Key-Value Description |
|---|---|---|
| web_search_pipeline | WebSearchService | tool_name → WebSearchPipeline |
| sql_agent | SQLAgentService | tool_name → SQLAgent |
| agent_runner | AgentFactory | agent_id → AgentRunner |
| smart_router | SmartRouterFactory | router_config_id → SmartRouter |
| kb_retrieval_pipeline | KBRetrievalService | kb_id → RetrievalPipeline |
| kb_info | KBRetrievalService | kb_id → KBInfo |
| kb_embedding | SmartRouter | kb_id → Embedding |
| vector_store_manager | VectorStoreRegistry | kb_id → VectorStoreManager |
| Class | Cached Key |
|---|---|
| AuthPermission | auth, user_perms: |
| BM25Manager | bm25 |
| RetrievalPipeline | retrieval |
| SearchResultCache | web_search |
| SchemaContextBuilder | schema_context |
- Set
DEBUG=FalseandENVIRONMENT=production - Use high-strength random
JWT_SECRET_KEY - Limit
CORS_ORIGINSto avoid using wildcard origins in production. - Modify or remove the default account.
- Configure HTTPS, reverse proxy, access logs, and backup policies for the API.
- Persist
backend/db,backend/files, and necessary index directories. - Configure CPU, memory, and GPU quotas based on model and document processing load.
The current terminal is in the backend directory. Please switch to the target frontend directory:
Set-Location D:\miniagent\workplace
pnpm install
pnpm devLog in to the admin panel and configure agent authorization for the user. Workplace only displays authorized and enabled agents in UserAgentRelation.
Runtime components use object caching and value caching. Please save the configuration through the management backend and confirm that the corresponding service has performed cache invalidation; restart the backend if necessary.
Confirm that Ollama or other model services are running, the model has been downloaded, and the Base URL, model name, and API Key configuration in the backend are correct.
Submitting Issues and Pull Requests is welcome. It is recommended to complete the following before submitting:
- Maintain a clear layering of API, Service, Repository, and Schema.
- Add permission and resource ownership checks for new interfaces.
- Add tests or provide reproducible verification steps for new features.
- Ensure frontend type checking and production build pass.
- Do not submit keys, databases, logs, model files, or user data.
This project is open source under the Apache License 2.0.
Make the simple things simple, and the complex things possible.

