Nested traces
Model the full tree of a request — retrievers, tools, and chains — by nesting spans and generations inside a trace.
Real LLM apps aren't one call — they're retrievers, tool calls, and chains of model steps. Currai nests spans and generations inside a trace so you get the full tree of a request and can pinpoint exactly which step was slow or wrong.
Spans
A span is any unit of work that isn't itself a model call — a vector search, a tool invocation, a function. Create one with span() and end() it when the work finishes:
Arbitrary nesting
Spans and generations can be created on a span as well as on a trace, so the tree goes as deep as your app does — a tool span containing a generation containing another span:
Each node carries its own input, output, timing, and metadata, and is linked to its parent automatically. This works for agent loops, RAG pipelines, and multi-model chains alike.
Next: token cost, tracked for you.
currai