Skip to content
开发中

Lumen — Agent 回放与成本审计工具

回放任意一次 Agent 运行、核算用量成本、中断后从检查点继续 · 早期试点

前置条件

  • 首选:Python 3.9+(pip install lumen-ai)
  • 可选 CLI:Rust 1.93+ 从源码编译 lumen-cli
  • 一个 Lurus API KeyAPI Key访问 API 的密钥凭证,类似于密码。每个 Key 可独立设置配额和权限。了解更多 →(获取方式)

什么是 Lumen? ​

Lumen 是面向 AI Agent 开发者的三合一可靠性工具 — Replay(零成本重放)+ Crash Recovery(微秒级 崩溃恢复Checkpoint检查点,将内存中的完整状态快照写入磁盘。崩溃恢复时从最近的 Checkpoint 开始重放 WAL。)+ Cost Tracking(实时成本追踪)。交付形态:Python SDK 优先(pip install lumen-ai,LangGraph/Agent 首选)+ Rust 引擎(lumen-core 性能底座)+ 可选 CLI(lumen-cli v0.1.0)。理念:Illuminate your AI agents. Never lose a run. Never burn tokens blindly.

python
pip install lumen-ai

from lumen_ai import LumenTracer, LumenCheckpointer, CostTracker

# 三行代码接入 — LangGraph 原生集成
graph = workflow.compile(
    checkpointer=LumenCheckpointer(),   # 崩溃恢复
    callbacks=[LumenTracer()]            # 执行追踪 + 成本追踪
)

底层 Rust 引擎(lumen-core)驱动,Python SDK 提供友好接口,连接 Kova Agent 引擎 和 Python 生态。

3 行接入 LangGraph
微秒级崩溃恢复
30+模型定价表
v0.1.0lumen-cli
Lumen's two-stage SDK-to-CLI trace pipelineDiagram showing Lumen's two-stage architecture: your code calls its own LLM provider while the Python SDK writes trace JSON to disk for the embedded Rust core and CLI to read for replay, cost, and dashboard rendering, with Lumen never calling the LLM provider itself.never called by LumenAPI CALLSPATCHESWRITE JSONREAD JSONNO HTTPOPTIONALEXTLLM ProviderOpenAI · Anthropic APIsUSERYour Agent CodeOpenAI · Anthropic SDKsSDKLumen SDKinstrument() · Python SDKSTORETrace JSONon disk · LUMEN_TRACE_DIRCORELumen Coreembedded in CLI · no HTTPCLILumen CLIreplay · cost · dashboardOPTKova + Netdatametrics · terminal tabLEGENDYour codeExternal APILumen componentFocal · trace fileOptionalInternal callLLM API callWrites trace (focal)Optional path
两段式:你的代码照常直接调自己的模型服务商,Python SDK 只在旁边把 trace 写成磁盘上的 JSON;内嵌的 Rust 核心与 CLI 事后读这份文件来做重放、算成本、渲染面板。橙色那条是 trace 落盘,也是全图的关键路径 —— Lumen 自己从不代你调模型,所以接入它不改变你的调用链路,也不多花一次 token。2c-cli-lumen · 与仓库 README 同一张图

核心能力

三合一可靠性

重放、恢复、成本 — 一次接入全部就绪。

Replay — 零成本确定性重放

从 trace JSON 重放任意执行,不调 LLM 不花钱,可从指定步骤开始精确定位问题。lumen replay TRACE_ID(完整)/ --from 5(从第 5 步)。

Crash Recovery — 微秒级崩溃恢复

LangGraph CheckpointSaver 完整实现,直接替换原生 SQLite/Redis Checkpointer。内存+磁盘双层、原子写入,恢复走引擎级 WAL 重放,零外部服务依赖。

Cost Tracking — 实时成本追踪

内置 30+ 模型定价表(Claude / GPT-4o / Gemini / Llama / DeepSeek),LLM 不返回费用也能估算。单次调用 > 2x 平均值自动告警。lumen cost --last 24h / lumen traces。

更多功能 ​

功能说明
Agent 管理创建、启动、停止、删除 Agent
工作流调试本地运行工作流,逐步调试
日志查看实时查看 Agent 执行日志
部署将 Agent 部署到 Kova 云端实例
MCP 管理安装和配置 MCP 工具服务
交互式 REPL直接在终端与 Agent 对话

安装 ​

bash
pip install lumen-ai                          # Python SDK(推荐)
curl -fsSL https://get.lurus.cn/lumen | sh    # CLI macOS/Linux
# Windows (PowerShell): irm https://get.lurus.cn/lumen.ps1 | iex
# 从源码(Rust 1.93+,首次编译约 2-3 分钟):
git clone https://github.com/hanmahong5-arch/lumen.git && cd lumen && cargo build --release
# 二进制在 target/release/lumen

验证:lumen --version(→ lumen 0.1.0);lumen doctor(检查 Lurus API connected / Kova optional)。


快速上手 ​

bash
# 初始化项目(结构: agent.toml / prompts/system.md / tools/search.yaml / workflows/main.yaml)
lumen init my-agent && cd my-agent

# 配置 API Key
lumen auth login                              # 浏览器登录授权自动配置
lumen config set api_key sk-your-lurus-key    # 或直接设置

# 本地运行 Agent
lumen run --interactive                       # 交互模式
lumen run "分析这段代码的性能问题" --file ./main.py
lumen run "翻译这段文本" --model gpt-4o        # 指定模型

# 工作流调试
lumen workflow run main --input topic="AI trends"
lumen workflow run main --step-by-step        # 逐步调试(每步暂停)
lumen workflow history main --last            # 上次运行结果

常用命令 ​

bash
# Agent 管理
lumen agent list / create researcher / info researcher / logs researcher / delete researcher
# MCP 工具
lumen mcp list / install github / test github / remove github
# 部署
lumen deploy --target kova        # 或 --target docker
lumen deploy status
# 配置
lumen config list / set api_key xxx / get api_key

配置文件 ​

agent.toml 是 Agent 项目的核心配置:

toml
[agent]
name = "my-researcher"
model = "deepseek-chat"
max_iterations = 20

[agent.llm]
base_url = "https://hub.lurus.cn/v1"
temperature = 0.7
max_tokens = 4096

[tools]
builtin = ["web_search", "file_read", "file_write"]

[[tools.mcp]]
name = "github"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-github"]

[deploy]
target = "kova"

与 Kova 的关系 ​

Lumen

开发者命令行工具 — 本地开发、调试、部署。轻量运行时 lumen run 即起即用。

Kova

Agent 运行时引擎 — 持久化执行、WAL、集群管理。lumen deploy 后获得完整持久化与集群能力。

本地开发用轻量运行时(lumen run),部署到 Kova(lumen deploy)后获得完整持久化和集群能力。


与其他方案对比 ​

对标

维度LumenTemporalLangGraph CheckpointerConductor
Replay零成本 LLM 重放Event replay部分Workflow replay
接入成本3 行代码Worker + SDK配置Worker
Cost 追踪内置无无无

相关产品与下一步 ​

下一步

Powered by Lurus Technologies