All features
03NESTED TRACES

Spans, tools & chains

Real LLM apps aren't one call — they're retrievers, tool calls, and chains of model steps. Currai nests spans inside a trace so you get the full tree of a request and can pinpoint exactly which step was slow or wrong.

  • Arbitrary nesting: spans inside spans inside the root trace.
  • Mix generations, retriever spans, and plain function spans freely.
  • Each node carries its own input, output, timing, and metadata.
  • Works with agent loops, RAG pipelines, and multi-model chains.

Nest a RAG trace 🌳

trace = captureTrace(name="rag-answer")

retrieval = trace.span(name="retrieve-docs", input={"query": question})
docs = vector_store.search(question, k=4)
retrieval.end(output={"doc_ids": [d.id for d in docs]})

gen = trace.generation(name="answer", model="gpt-4o", input=prompt(docs))
gen.end(output=answer)

Use spans, tools & chains in production

Visualize the full tree of a request — retrievers, tools, and nested calls. Currai keeps this information connected to the conversation, user, session, and supporting trace so product and engineering teams can investigate the same evidence.

Start with one production workflow, verify the captured data, and use the resulting evidence to find recurring friction, debug failures, and measure whether each release improves the agent experience.

Follow the Currai getting-started guide to connect a real agent, then review the AI agent monitoring playbook for a practical production workflow.