Content
# LumenAgent
> A multi-turn dialogue Agent system based on large models, equipped with complete enterprise-level functional modules such as **remote virtual machine control**, **MCP protocol extension**, **AI automatic timing tasks**, **pluggable skills**, **RAG knowledge base**, **dual-mode memory system**, and **tool approval process**.




## ✨ Highlights
| Dimension | LumenAgent |
|------|-----------|
| **Remote VM Control** | Agent **directly controls remote virtual machines via SSH**, executes commands, views status, and supports WebSocket real-time echo |
| **Tool Approval Process** | Three-level approval mode (none/all/by risk level) + **front-end pop-up real-time approval**, automatic rejection on timeout |
| **MCP Protocol Support** | Supports loading **external MCP Server** as an extended tool pool, selectively enabled on the front-end |
| **AI Timing Tasks** | Agent **creates and manages timing tasks in dialogue** (cron/interval/date), automatically executes tool cycles when tasks are triggered |
| **Dual-Mode Memory** | **Daily memory** (automatic summary) + **long-term memory** (automatic compression) + dual vector retrieval (ChromaDB + semantic search) |
| **Sliding Window Summary** | Dynamic compression strategy: triggered every N rounds, compressing the previous M rounds into a summary, retaining the next K rounds of original text |
| **Hot Update Configuration** | Agent can **modify its own configuration at runtime** via the `env_editor` tool, without restarting the service |
| **Dual-Entry + API Key** | Runs CLI and Web UI simultaneously, **API Key authentication** protects all endpoints |
| **Management Front-end** | **13 view components** cover tool/skill/memory/knowledge base/virtual machine/timing task/MCP/system configuration/log/API Key full management scenarios |
## 📋 Feature Overview
| Module | Function | Description |
|------|------|------|
| **💬 Dialogue** | Streaming chat | SSE real-time push, supports thought chain, tool calling, and end-to-end streaming rendering of text |
| **🤖 Agent Mode** | Multi-turn tool cycle | LLM automatic reasoning → tool calling → observing results → continuing reasoning, supports up to 20 rounds |
| **🛠 Tool System** | 11 built-in tools | Read / Write / Bash / WebSearch / WebFetch / KnowledgeSearch / KnowledgeInsert / MemorySearch / EnvEditor / TaskScheduler / VirtualMachineOperation |
| **🖥 Remote Virtual Machine** | SSH control | Agent directly connects to remote servers to execute commands and view status, with WebSocket real-time echo |
| **👮 Tool Approval Process** | Three-level approval | No approval / full approval / approval by risk level, front-end pop-up real-time decision |
| **🔌 MCP Protocol** | External tool extension | Loads tools from any MCP Server, selectively enabled on the front-end |
| **⏰ AI Timing Tasks** | Automatic scheduling | Agent creates cron/interval/date timing tasks in dialogue, automatically executes tool cycles when tasks are triggered |
| **🧠 Knowledge Base** | RAG vector retrieval | Text splitting → Embedding → ChromaDB retrieval, supports import, deletion, and rebuilding |
| **💾 Memory System** | Automatic summary + vector retrieval | Daily dialogue automatically summarized and stored, long-term memory automatically organized, dual vector semantic retrieval |
| **📜 Session Management** | Sliding window summary | SQLite persistence, cursor pagination, automatic title generation |
| **🔌 Skill System** | Pluggable extension | Driven by SKILL.md, environment dependency verification, compatible with clawhub ecosystem |
| **⚙️ Configuration Management** | Hot update | Agent calls `env_editor` tool to read/write configuration at runtime, no need to restart the service |
| **🔑 API Security** | API Key authentication | Complete Key creation/list/enable/disable management, default Key automatically generated on first startup |
| **🌐 Dual-Entry** | Web UI + CLI | Vue 3 management console; CLI command-line mode, supports slash commands |
## Project Structure
```
LumenAgent/
├── lumen_agent/ # Backend Python package (~7000 lines)
│ ├── agent/ # Agent core engine
│ │ ├── agent.py # AgentStreamExecutor — multi-turn tool loop engine
│ │ ├── context.py # Context management, anti-loop guard
│ │ ├── memory/
│ │ │ └── memory_utils.py # Memory file operation tools
│ │ ├── prompts/
│ │ │ ├── builder.py # System Prompt builder
│ │ │ └── docs/ # Prompt templates
│ │ ├── skills/
│ │ │ ├── loader.py # Skill loader
│ │ │ └── meta.py # Skill metadata model
│ │ ├── tokens/
│ │ │ ├── char_counter.py # Character counter
│ │ │ └── tiktoken_counter.py # tiktoken counter
│ │ └── tools/ # 11 tool implementations
│ │ ├── base.py # BaseTool + ToolResult base classes
│ │ ├── registry.py # Tool registry (decorator-driven)
│ │ ├── read.py / write.py / bash.py # File/command operations
│ │ ├── web_search.py / web_fetch.py # Network tools
│ │ ├── knowledge.py # Knowledge base retrieval and storage
│ │ ├── memory_search.py # Memory vector retrieval
│ │ ├── env_editor.py # .env configuration editor (hot update)
│ │ ├── task_scheduler.py # Timer task creation and management
│ │ ├── vm_operation.py # Virtual machine SSH operations
│ │ └── mcp_bridge.py # MCP tool bridge
│ ├── api/ # FastAPI routing layer (28+ endpoints)
│ │ ├── routers/
│ │ │ ├── chat.py # Chat: POST + SSE streaming + interrupt + approval
│ │ │ ├── sessions.py # Session CRUD + cursor pagination
│ │ │ ├── vm.py # Virtual machine registration/update/deletion/list/execution
│ │ │ ├── vm_ws.py # Virtual machine WebSocket real-time echo
│ │ │ ├── scheduler_router.py # Timer task CRUD + execution records
│ │ │ ├── mcp_servers.py # MCP Server configuration management
│ │ │ ├── api_keys.py # API Key management
│ │ │ ├── knowledge.py # Knowledge base management
│ │ │ ├── configs.py / logs_router.py # Configuration / log
│ │ │ ├── tools.py / skills.py # Tool/skill list
│ │ │ └── memories.py # Memory file browsing
│ │ └── schemas/ # Pydantic DTO + SSE events
│ ├── application/ # Application service layer (~2500 lines)
│ │ ├── service/
│ │ │ ├── chat_service.py # Chat orchestration (single-turn/streaming/Agent)
│ │ │ ├── vm_connection_service.py # Virtual machine SSH connection pool + streaming command execution
│ │ │ ├── scheduler_task_service.py # Timer task service
│ │ │ ├── mcp_server_service.py # MCP service
│ │ │ ├── summary_service.py # Sliding window summary + long-term memory organization
│ │ │ ├── rag_service.py # Knowledge base RAG service
│ │ │ ├── memory_rag_service.py # Memory vector retrieval service
│ │ │ ├── config_service.py # Configuration management service
│ │ │ ├── api_key_service.py # API Key service
│ │ │ ├── memory_file_service.py # Memory file browsing service
│ │ │ ├── log_service.py # Log service
│ │ │ └── title_service.py # Session title automatic generation
│ │ └── utils/
│ │ ├── context_assembly.py # Context assembly + token budget check
│ │ ├── text_splitter.py # Text splitting
│ │ └── llm_error_policy.py # LLM chain error mapping
│ ├── infrastructure/ # Infrastructure layer
│ │ ├── startup/ # Startup bootstrap
│ │ │ ├── workspace.py # Workspace initialization
│ │ │ ├── uvicorn_runner.py # Uvicorn startup
│ │ │ └── flask_proxy.py # Flask static + API proxy
│ │ ├── data_base/ # SQLite storage
│ │ │ ├── sqlite_conversation.py # Conversation storage
│ │ │ ├── sqlite_knowledge.py # Knowledge base storage
│ │ │ ├── sqlite_scheduler.py # Timer task storage
│ │ │ ├── sqlite_mcp.py # MCP configuration storage
│ │ │ ├── sqlite_api_key.py # API Key storage
│ │ │ └── sqlite_vm_config.py # VM configuration storage
│ │ ├── client/
│ │ │ ├── deepseek_client.py # DeepSeek HTTP client
│ │ │ ├── embedding_client.py # Alibaba Cloud Embedding client
│ │ │ ├── chroma_client.py # Chroma vector storage wrapper
│ │ │ └── mcp_client.py # MCP SSE client manager
│ │ ├── scheduler/
│ │ │ ├── scheduler_service.py # APScheduler wrapper (singleton)
│ │ │ └── tasks.py # Predefined system tasks
│ │ ├── virtual_machine/
│ │ │ └── virtual_machine_registry.py # VM registration center
│ │ ├── approval_registry.py # Tool approval registry
│ │ ├── vm_event_bus.py # Virtual machine event bus
│ │ ├── websocket_manager.py # WebSocket connection manager
│ │ ├── sse_registry.py # SSE interrupt registry
│ │ └── http_pool.py # Shared HTTP connection pool
│ ├── model_adapters/ # Model adapter layer
│ │ ├── base.py # ModelAdapter abstract interface
│ │ └── deepseek.py # DeepSeek adapter implementation
├── webChannel/ # Frontend Vue 3 + TypeScript (~8800 lines)
│ └── src/
│ ├── App.vue # Main layout (sidebar navigation + top bar + content area + input area)
│ ├── components/ # 13 view components
│ │ ├── ChatView.vue # Chat panel
│ │ ├── ChatMessage.vue # Message rendering (Markdown/thinking chain/tool/approval)
│ │ ├── SessionList.vue # Session list
│ │ ├── VMView.vue (1366 lines) # Virtual machine management + terminal
│ │ ├── SchedulerView.vue # Timer task management
│ │ ├── MCPServerView.vue # MCP configuration
│ │ ├── KnowledgeView.vue # Knowledge base management
│ │ ├── ConfigView.vue # System configuration editing
│ │ ├── LogView.vue # Log real-time monitoring
│ │ ├── MemoryView.vue / ToolView.vue / SkillView.vue / ApiKeyManager.vue
│ │ └── MiniChatPanel.vue # Floating chat panel
│ ├── composables/
│ │ ├── useChatStream.ts # SSE streaming message management
│ │ └── useVMWebSocket.ts # Virtual machine WebSocket connection management
│ ├── types.ts # TypeScript type definitions
│ └── utils/markdown.ts # Markdown + code highlighting rendering
├── work_space/ # Workspace
│ ├── memory/ # Daily memory files YYYY-MM-DD.md
│ ├── MEMORY.md # Long-term memory
│ ├── ME.md / USER.md / RULE.md # Project/user/rule context
│ └── skills/ # Pluggable skill packages
├── pyproject.toml # Python package configuration
├── package.json / start.js / install.js # Node.js startup/installation scripts
└── lumen_agent/.env / config.json # Environment variables + default configuration
```
---
## 🚀 Quick Start
### 0️⃣ One-line command to start (recommended)
Ensure you have installed [Node.js ≥ 18](https://nodejs.org/) and [Python ≥ 3.13](https://www.python.org/):
```bash
# One-click installation + startup (automatic installation of Python/Node dependencies, frontend build, and service startup)
npx lumen-start
```
The first run will automatically complete: Python dependency installation → frontend dependency installation → frontend build → service startup.
Then, simply configure `lumen_agent/.env` with your `LLM_API_KEY` and restart.
> **Domestic users**: If npm and pip downloads are slow, you can configure mirror acceleration:
> ```bash
> npm config set registry https://registry.npmmirror.com
> pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
> ```
---
### 1️⃣ Environment Requirements
- Python ≥ 3.13
- Node.js ≥ 18
- A **DeepSeek API Key** (or other compatible OpenAI API)
- A **Alibaba Cloud DashScope API Key** (only required for knowledge base RAG + memory vector retrieval, pure chat can be omitted)
### 2️⃣ Configure Environment Variables
Edit `lumen_agent/.env`:
```env
# ── LLM Configuration ──
LLM_API_KEY=sk-your-deepseek-api-key
LLM_BASE_URL=https://api.deepseek.com
LLM_MODEL=deepseek-v4-flash
# ── Alibaba Cloud Embedding (optional, required for RAG/memory) ──
EMBEDDING_API_KEY=sk-your-dashscope-api-key
EMBEDDING_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1/embeddings
EMBEDDING_MODEL=text-embedding-v4
# ── Service Ports ──
HOST=127.0.0.1
PORT=21675
```
All configurable items are detailed in `config.json` (same-name `.env` variables override).
### 3️⃣ Global Installation and Startup (or manual step-by-step)
```bash
# Method 1: Global installation
npm install -g lumen-agent
lumen-start
# Method 2: Clone repository and manual step-by-step
git clone https://github.com/renking-W/LumenAgent.git
cd LumenAgent
npm install # Automatic installation of Python + Node dependencies
npm start # Frontend build + service startup
```
### 4️⃣ Traditional Method: Pure Python Backend Startup
```bash
pip install -r lumen_agent/requirements.txt
python -m lumen_agent.app
```
Backend defaults to running on `http://127.0.0.1:21675`.
> The first startup will automatically create a default API Key and print it to the log. Please keep it properly.
- Swagger documentation: `http://127.0.0.1:21675/docs`
- Health check: `http://127.0.0.1:21675/health`
### 4️⃣ Start Frontend (Development Mode)
```bash
cd webChannel
npm install
npm run dev
```
Frontend defaults to running on `http://127.0.0.1:5173`, with proxy forwarding API requests to backend `21675` port.
### 5️⃣ Build Production Version
```bash
cd webChannel
npm run build
```
Build output to `webChannel/dist/`, backend startup automatically provides static file service through Flask, visit `http://127.0.0.1:21675` to access.
### 6️⃣ CLI Mode (optional)
```bash
# Automatic startup of HTTP service
lumen-cli
# or
python -m lumen_agent.application.common.chat_in_cli
```
CLI supports slash commands: `/exit` `/new` `/knowledge`
---
## 🖥 Management Console Interface
### Navigation Panel
The left sidebar contains **10 management views**, grouped by function:
**Core**
| View | Description |
|------|-------------|
| 💬 Conversation | Real-time streaming conversation panel |
| 🛠️ Tools | Browse all available tools for the Agent and their parameters |
| 🎯 Skills | Display the status of pluggable skills (available/missing environment) |
| 🧠 Memory | Browse daily memory + long-term memory files |
**Functions**
| View | Description |
|------|-------------|
| 🔌 MCP | Manage MCP Server configuration (CRUD + test connection) |
| 🖥 Virtual Machine | Register/manage remote virtual machines, real-time terminal echo |
| 📚 Knowledge Base | Knowledge document storage, retrieval, and chunk details view |
| ⏰ Scheduled Tasks | View AI-created scheduled tasks and execution records |
**Others**
| View | Description |
|------|-------------|
| ⚙️ System Configuration | Edit system runtime parameters |
| 📋 Logs | Real-time view/download log files |
---
### 1️⃣ Conversation View
**Session List**
- All historical sessions sorted by update time
- Relative time display ("3 minutes ago")
- Support for creating/switching/deleting (with confirmation popup)
- Collapsible
**Message Area** — Each assistant message rendered as a block:
| Block | Rendering Method | Description |
|------|------------------|-------------|
| 💭 Thinking Chain | Collapsible `<details>` | DeepSeek reasoning_content, collapsed by default |
| 📝 Body | GFM Markdown | Code highlighting + tables + links + copy button |
| 🛠 Tool Calls | Collapsible details | Tool name + parameters + time consumption + result |
| 👮 Approval Waiting | Popup button | Approve/reject current tool call (by approval mode) |
| ⚠️ Error | Collapsible details | Error details + "Retry" button |
**Mode Switching**
- **Simple Mode** — Single-round conversation, LLM responds directly
- **Agent Mode** (default) — Multi-round tool loop, LLM can call 11 tools
**Input Area**
- Multi-line text box (auto-adjusting height 4–10 lines)
- `Enter` sends, `Ctrl+Enter` line break
- Can interrupt streaming response at any time
- Supports selecting MCP Server to mount to the current conversation
---
### 2️⃣ 🖥 Virtual Machine Management View
> **This is one of the core features of the project**, providing a complete remote server management experience.
- **Register VM**: Fill in IP, port, username, password
- **Status Panel**: View connection status of all registered VMs
- **Built-in Terminal**: Real-time echo via WebSocket, supports command execution, streaming output, and exit code display
- **One-click Operations**: Connect/disconnect/delete, with real-time feedback on operation results
- **Agent Linkage**: Agent can automatically connect to VM to execute tasks in conversations, and users can observe the execution process in real-time via the web interface
---
### 3️⃣ ⏰ AI Scheduled Tasks View
- Display all AI-created scheduled tasks
- Show trigger type (cron/interval/date), expression, and next execution time
- View execution records and output content for each trigger
- Supports pause/resume/delete
---
### 4️⃣ 🔌 MCP Server Management
- Add/edit/delete MCP Server configuration
- Test connection and view exposed tool list
- Selectively mount MCP tools during conversation via dropdown selection box
---
## 🧠 Core Architecture Interpretation
### Agent Tool Loop
```
User Input
│
▼
┌─────────────────────────────────┐
│ 1. Context Assembly │
│ (summary + history + current │
│ + token budget check) │
└──────────┬──────────────────────┘
▼
┌─────────────────────────────────┐
│ 2. LLM Inference (streaming SSE) │
│ Output: text + thinking │
│ or initiate: tool_use │
└──────┬──────────────────────────┘
│
├── No tool call → yield "done" → store + summary trigger
│
└── Tool calls
│
▼
┌───────────────────┐
│ 3. Approval Check │
│ (optional: none/all/dangerous) │
└──────┬────────────┘
│ Approved
▼
┌───────────────────┐
│ 4. Execute Tool │
│ (execute one by one, streaming) │
└──────┬────────────┘
│
▼
┌───────────────────┐
│ 5. Return Result to LLM │
│ → back to step 2 │
│ (max 20 rounds) │
└───────────────────┘
```
### Sliding Window Summary
```
Turns: 1 2 3 4 5 6 │ 7 8 9 ...
│
▼
┌───────────┐
│ Trigger Summary │
│ (threshold=6) │
└───────────┘
│
Compress first 4 turns into summary
Keep last 2 turns as original text
count → 2
```
- `summary_threshold_turns=6`: Trigger summary every 6 turns
- `summary_compress_turns=4`: Compress first 4 turns into summary
- `summary_keep_turns=2`: Keep last 2 turns as original text
- Summary result is written to daily memory file (YYYY-MM-DD.md) + ChromaDB vector store
### SSE Event Stream
```
Complete SSE event sequence in Agent mode:
event: reasoning_update ← incremental thinking chain
event: message_update ← main text increment
event: tool_calls ← tool call list for this turn
event: awaiting_approval ← waiting for user approval (with tool ID/name/parameters)
event: tool_execution_start← tool execution start
event: tool_execution_end ← tool execution end (with time consumption)
event: reasoning_update ← continue reasoning after tool result
event: message_update ← final response
event: assistant_done ← this turn completed
event: error ← error (optional)
[DONE] ← stream end marker
```
---
## 🛠 Tool System Details
### 11 Built-in Tools
| Tool Name | Purpose | Requires Approval | Description |
|--------|------|------------------|-------------|
| `read` | Read file | No | offset/limit chunking, 2000 lines / 50KB per time |
| `write` | Write/append/replace | No | Three write modes |
| `bash` | Execute shell command | No | Auto-adapt to Win/Unix, 30s timeout |
| `web_search` | Web search | No | DuckDuckGo, no extra API key required |
| `web_fetch` | Web scraping | No | HTML → Markdown, supports file download |
| `knowledge_search` | RAG knowledge retrieval | No | Retrieve relevant chunks from ChromaDB |
| `knowledge_insert` | Knowledge storage | No | Text/file storage in knowledge base |
| `memory_search` | Memory retrieval | No | Semantic search for historical conversation memory |
| `env_editor` | Config editor | No | Read/write .env at runtime, hot update |
| `task_scheduler` | Scheduled task management | ✅ Yes | Create/list/delete/pause/resume scheduled tasks |
| `virtual_machine_operation` | Virtual machine operation | ✅ Yes | SSH command execution/connect/disconnect/view status |
### Tool Approval System
Three approval modes can be dynamically switched during conversation:
| Mode | Behavior | Applicable Scenario |
|------|------|---------|
| `none` | No approval, direct execution | Debugging/trusted environment |
| `dangerous` (default) | Only approve tools marked `requires_approval=True` | Daily use |
| `all` | All tool calls require approval | High security requirements |
Approval process:
1. LLM initiates tool call → enter approval pending state
2. Frontend pops up approval dialog, showing tool name + parameters
3. User clicks approve/reject one by one (or timeout auto-reject all)
4. Rejected tools inject error result: "User rejected this tool call"
5. Agent continues reasoning based on the result
### MCP Tool Extension
Supports loading any MCP Server as a tool source:
- Frontend management panel configures MCP Server URL + API Key
- Automatically connect to all enabled servers on startup
- Selectively mount MCP tools during conversation via dropdown selection box
- Exposed tools from MCP Server are automatically injected into Agent tool pool
---
## 🖥 Virtual Machine Module Architecture
```
┌────────────────────────────────────────────────────────┐
│ Agent (VirtualMachineOperation tool) │
│ - exec_command / connect / disconnect / get_status │
│ - list_vms │
└──────────┬─────────────────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ VMConnectionService (SSH connection pool) │
│ - asyncssh driver, supports connection reuse │
│ - streaming command execution (async for kind, data in ...) │
└────┬──────────────┬──────────────────┬─────────────────┘
│ │ │
▼ ▼ ▼
┌──────────┐ ┌──────────────┐ ┌──────────────────┐
│ SQLite │ │ WebSocket │ │ VMEventBus │
│ VM Config │ │ Connection Manager │ │ (event publish/subscribe) │
│ Storage │ │ (real-time frontend) │ │ │
└──────────┘ └──────────────┘ └──────────────────┘
Frontend VMView.vue:
- Register/manage VM configuration
- Real-time subscribe to command execution output via WebSocket
- Built-in terminal panel
- Linkage with Agent conversation for VM operations
```
---
## ⏰ AI Scheduled Task System
Agent can directly create scheduled tasks in conversations via `task_scheduler` tool:
```
User: "Help me check the latest AI news every 9am"
Agent → call task_scheduler (action=create, trigger_type=cron,
trigger_expr="0 9 * * *", ...)
System:
┌─ Confirm task steps + output format with user
├─ Register to APScheduler
├─ Persist to scheduled_tasks table
└─ Return task ID
At trigger time:
┌─ Use independent session (__scheduled__{id})
├─ Execute a complete Agent tool loop
├─ Store result in scheduled_executions table
└─ Can be viewed by frontend SchedulerView
```
Supports three trigger types: cron (`0 9 * * *`) / interval (`1800` seconds) / date (`ISO date`)
---
## 📝 Memory System
### Two-layer Structure
```
Memory System
├── 📅 Daily Memory (work_space/memory/YYYY-MM-DD.md)
│ ├── Automatically append at each summary trigger
│ ├── Segmented by "---" + "## timestamp session=xxx"
│ └── Auto-vectorize → ChromaDB (memory_store)
│
└── 📌 Long-term Memory (work_space/memory/MEMORY.md)
├── Auto-compress and refine content when exceeding 150KB
├── Keep concise content
└── Full-indexing → ChromaDB on startup
```
### Retrieval Methods
- **Agent Semantic Retrieval**: `memory_search` tool → ChromaDB vector search
- **Frontend Browsing**: View all memory files + type distinction on memory panel
---
## 📚 Knowledge Base (RAG)
| Step | Tech Stack | Description |
|------|--------|-------------|
| Text Split | Custom TextSplitter | Split by chunk_size=500, overlap=150 |
| Vectorization | Aliyun DashScope Embedding | text-embedding-v4 |
| Storage | ChromaDB | collection: knowledge_base |
| Retrieval | Cosine similarity | top_k=5, threshold=0.2 |
Vector model can be customized by modifying `config.json` with EMBEDDING_BASE_URL and EMBEDDING_MODEL
---
## 🔧 Skill Extension
Skills are predefined reusable instruction packages, compatible with **clawhub** ecosystem.
```
work_space/skills/
└── skill-creator-0.1.0/
├── SKILL.md # YAML frontmatter + Markdown instructions
├── _meta.json # Metadata
└── scripts/ # Companion scripts
```
SKILL.md frontmatter:
```yaml
---
name: skill-name
description: Brief description
requires:
env: [API_KEY_NAME] # Optional: dependent environment variables
primaryEnv: API_KEY_NAME # Optional: primary environment variable name
emoji: 🔧 # Optional: display icon
---
```
Automatically scan and load skills via `load_skills()`, validate environment variables, and mark as "available/unavailable".
## 📡 API Overview
| Method | Path | Description |
|------|------|------|
| `GET` | `/health` | Health Check |
| `POST` | `/v1/chat` | Full Conversation (Non-Streaming) |
| `POST` | `/v1/chat/stream` | SSE Streaming Conversation |
| `POST` | `/v1/chat/stream/interrupt` | Interrupt Streaming Conversation |
| `POST` | `/v1/chat/stream/approve` | Submit Tool Approval Decision |
| `GET` | `/v1/sessions` | Session List (Paginated) |
| `GET` | `/v1/sessions/{id}/messages` | Session Messages (Cursor Paginated) |
| `POST` | `/v1/sessions/{id}/messages` | Append Messages |
| `PUT` | `/v1/sessions/{id}/title` | Modify Title |
| `DELETE` | `/v1/sessions/{id}` | Delete Session |
| `GET` | `/v1/tools` | Tool List |
| `GET` | `/v1/skills` | Skill List |
| `GET` | `/v1/memories` | Memory File List |
| `POST` | `/v1/knowledge/ingest` | Knowledge Ingestion |
| `POST` | `/v1/knowledge/search` | Knowledge Search |
| `GET` | `/v1/knowledge/collections` | Knowledge Collection List |
| `GET` | `/v1/knowledge/documents` | Knowledge Document List |
| `GET` | `/v1/mcp-servers` | MCP Server List |
| `POST` | `/v1/mcp-servers` | Create MCP Server |
| `PUT` | `/v1/mcp-servers/{id}` | Update MCP Server |
| `DELETE` | `/v1/mcp-servers/{id}` | Delete MCP Server |
| `POST` | `/v1/mcp-servers/{id}/test` | Test MCP Server Connection |
| `GET` | `/v1/scheduled-tasks` | Scheduled Task List |
| `POST` | `/v1/scheduled-tasks` | Create Scheduled Task |
| `DELETE` | `/v1/scheduled-tasks/{task_id}` | Delete Scheduled Task |
| `GET` | `/v1/scheduled-tasks/{task_id}/executions` | Task Execution Record |
| `GET` | `/v1/api-keys` | API Key List |
| `POST` | `/v1/api-keys` | Create API Key |
| `DELETE` | `/v1/api-keys/{key_id}` | Delete API Key |
| `PATCH` | `/v1/api-keys/{key_id}` | Enable/Disable API Key |
| `GET` | `/v1/config` | Get Config List |
| `PUT` | `/v1/config` | Update Config Item |
| `GET` | `/v1/logs` | Log File List |
| `GET` | `/v1/logs/{filename}` | Log File Content |
| `GET` | `/v1/vm` | VM List |
| `POST` | `/v1/vm/register` | Register VM |
| `PUT` | `/v1/vm/{vm_id}` | Update VM Config |
| `POST` | `/v1/vm/execute` | Streaming Execute Command |
| `DELETE` | `/v1/vm/{vm_id}` | Delete VM |
| `WS` | `/v1/vm/ws` | VM Real-time Event WebSocket |
---
## ⚙️ Complete Configuration Items
| Config Item | Default Value | Description |
|--------|--------|------|
| `LLM_API_KEY` | (Required) | DeepSeek API Key |
| `LLM_BASE_URL` | `https://api.deepseek.com` | API Address |
| `LLM_MODEL` | `deepseek-v4-flash` | Model Identifier |
| `LLM_TEMPERATURE` | null | Temperature Parameter |
| `LLM_MAX_TOKENS` | null | Maximum Output Token |
| `LLM_ENABLE_THINKING` | true | Enable Thinking Chain |
| `EMBEDDING_API_KEY` | (Optional) | Alibaba Cloud Embedding API |
| `EMBEDDING_MODEL` | `text-embedding-v4` | Embedding Model |
| `HOST` / `PORT` | `127.0.0.1:21675` | Service Listening Address |
| `CORS_ORIGINS` | `http://127.0.0.1:5173` | Allowed Cross-Domain Origin |
| `AGENT_MAX_TURNS` | 20 | Tool Loop Maximum Turns |
| `TOOL_APPROVAL_MODE` | `dangerous` | Approval Mode |
| `TOOL_APPROVAL_TIMEOUT` | 300 | Approval Timeout (Seconds) |
| `CONVERSATION_MAX_CONTEXT_MESSAGES` | 5 | Recent Messages |
| `SUMMARY_THRESHOLD_TURNS` | 6 | Summary Trigger Turns |
| `SUMMARY_COMPRESS_TURNS` | 4 | Compression Turns |
| `SUMMARY_KEEP_TURNS` | 2 | Keep Original Turns |
| `RAG_CHUNK_SIZE` / `RAG_CHUNK_OVERLAP` | 500 / 150 | Text Segmentation |
| `RAG_TOP_K` / `RAG_SIMILARITY_THRESHOLD` | 5 / 0.2 | Retrieval Parameters |
| `SCHEDULER_TIMEZONE` | `Asia/Shanghai` | Timezone |
| `VM_SSH_TIMEOUT` | 60 | SSH Connection Timeout |
| `VM_SSH_KEEPALIVE` | 40 | SSH Keepalive Interval |
| `VM_EXECUTE_TIMEOUT` | 30 | Command Execution Timeout |
| `VM_DANGEROUS_COMMANDS` | `rm -rf,shutdown...` | Dangerous Command List |
> Agent can view and modify configurations at runtime using the `env_editor` tool without restarting.
---
## 🧪 Technology Stack
| Layer | Technology | Version |
|---|------|------|
| Language | Python | ≥ 3.13 |
| Web Framework | FastAPI | ≥ 0.136 |
| Model Adapter | DeepSeek API / OpenAI Compatible | - |
| Vector Storage | ChromaDB | ≥ 1.5.9 |
| Embedding | Alibaba Cloud DashScope / Alibaba Lingji | - |
| Scheduler | APScheduler | ≥ 3.10 |
| SSH | asyncssh | (VM Module) |
| MCP | Python MCP SDK | ≥ 1.0 |
| Database | SQLite (aiosqlite) | - |
| Frontend Framework | Vue 3 + TypeScript | ≥ 3.5 |
| UI Library | Element Plus | ≥ 2.10 |
| Frontend Build | Vite | ≥ 7.1 |
---
## 📦 Dependency Installation
```bash
# Python Dependencies
pip install -r lumen_agent/requirements.txt
# Frontend Dependencies
cd webChannel && npm install
```
---
## 💡 Design Principles
1. **Model-Independent**: Through the `ModelAdapter` abstraction layer, theoretically can switch to any LLM (currently adapted to DeepSeek)
2. **Global Singleton Pattern**: HTTP Connection Pool / MCP Manager / Approval Registry / SSE Registry / VM Connection Service are all global singletons
3. **Hot Configuration**: Agent can modify its own configuration at runtime without restarting
4. **Dual Entry**: CLI mode automatically starts the background HTTP service
5. **Minimal Dependencies**: Core Python dependencies are only 10, and frontend dependencies are only 8
---
## The End
The project is continuously developed, and contributions are welcome!
Contact: 3194676188@qq.com
<sub>If you find this project helpful, please give it a ⭐ Star!</sub>
Connection Info
You Might Also Like
No recommendations available