Lumen Quickstart In development
Get it done in 10 minutes: install → integrate with LangGraph → view your first Trace → trigger a Replay → tally 24h costs.
Prerequisites
Install and integrate with LangGraph in three lines
bashpip install lumen-aipythonfrom lumen_ai import LumenTracer, LumenCheckpointer graph = workflow.compile( checkpointer=LumenCheckpointer(), # 崩溃恢复 callbacks=[LumenTracer()], # 执行追踪 + 成本追踪 )No business-logic changes required — every LLM call, tool call, and state change is recorded to the Lumen backend.
Run a minimal example
pythonfrom langgraph.graph import StateGraph, END from lumen_ai import LumenTracer, LumenCheckpointer from typing import TypedDict class State(TypedDict): query: str result: str def search(state: State) -> State: return {**state, "result": f"已处理: {state['query']}"} wf = StateGraph(State) wf.add_node("search", search) wf.set_entry_point("search") wf.add_edge("search", END) graph = wf.compile( checkpointer=LumenCheckpointer(), callbacks=[LumenTracer()], ) graph.invoke({"query": "什么是 WAL"})View the Trace
Open the console (default
http://localhost:7070) or the Lumen page in the Lurus console: the complete timeline of each graph run, the input/output/duration of every node, and the prompt/completion/token counts for each LLM call.Trigger a Replay
Replay a past execution sequence once, without consuming tokens (useful for reproducing bugs locally, verifying fixes, and Prompt A/B testing):
pythonfrom lumen_ai import Replay Replay.from_run_id("run_abc123").play()Tally 24-hour costs
pythonfrom lumen_ai import CostTracker print(CostTracker.summary(hours=24)) # { total_tokens: 128_340, cost_rmb: 12.47, by_model: {...} }
Replay costs nothing