Skip to content

Lumen Quickstart In development ​

Get it done in 10 minutes: install → integrate with LangGraph → view your first Trace → trigger a Replay → tally 24h costs.

10 minend to end
3 linesof integration code
0business-logic changes

Prerequisites

Python 3.9+ · Lurus API KeyAPI KeyA secret credential for accessing the API, much like a password. Each Key can have its own quota and permissions.Learn more → (how to get one) · an existing LangGraph/LangChain Agent project (or use the minimal example below if you don’t have one).
  1. Install and integrate with LangGraph in three lines

    bash
    pip install lumen-ai
    python
    from 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.

  2. Run a minimal example

    python
    from 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"})
  3. 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.

  4. Trigger a Replay

    Replay a past execution sequence once, without consuming tokens (useful for reproducing bugs locally, verifying fixes, and Prompt A/B testing):

    python
    from lumen_ai import Replay
    Replay.from_run_id("run_abc123").play()
  5. Tally 24-hour costs

    python
    from lumen_ai import CostTracker
    
    print(CostTracker.summary(hours=24))
    # { total_tokens: 128_340, cost_rmb: 12.47, by_model: {...} }

Replay costs nothing

Replay plays back from the recorded execution sequence and does not call the LLM again, so reproducing bugs, verifying fixes, and running Prompt A/B tests all cost zero tokens.

Next Steps ​

Next Steps

Powered by Lurus Technologies