Tracing is an invaluable tool for exploring the sub-components of your program that produce
each top-level input and output. Braintrust supports tracing in
logging and experiments.
A trace represents a single independent request made up of several spans.A span represents a unit of work, with a start and end time, and optional fields like
input, output, metadata, scores, and metrics (the same fields you can log in an
experiment). Each span contains one or more children that are usually run within their parent span, like for example, a nested function call.
Common examples of spans include LLM calls, vector searches, the steps of an
agent chain, and model evaluations.Each trace can be expanded to view all of the spans inside. Well-designed traces make it
easy to understand the flow of your application, and to debug issues when they
arise. The tracing API works the same way whether you are logging online (production
logging) or offline (evaluations).