Skip to main content

Install

No extra dependencies. No API keys. Works with any Python 3.10+ project.

Option 1 — Instrument with @span

Add @span decorators to the functions you want to trace. Each decorated function becomes one span in the captured trace:
The tracer automatically captures each span’s input, output, and timing. No changes to function signatures required.

Option 2 — Adapt existing logs

If your agent already emits OpenClaw JSONL or OpenTelemetry spans, skip the decorators and parse the logs directly:

Option 3 — Intercept MCP sessions

Wrap an MCP ClientSession to auto-capture every tool call:

Inspect the trace

Mark spans for Reflex

Set optimize=True and a prompt_id on any span whose prompt you want Reflex to improve. Spans sharing the same prompt_id are treated as instances of the same prompt across steps:
Or set it directly on the node when using adapters:

Next steps

Adapters

Import OpenClaw JSONL and OTel spans

MCP interceptor

Auto-capture MCP tool calls

Trace schema

Full AgentTrace and TraceNode field reference

Origin

Feed your trace to Origin for failure attribution