Using Traces
Traces are an organizing component of a session. They are used to group completions together and provide a way to track the progress of a session. Named traces form the basis of Freeplay’s support for Agents. For a comprehensive guide on building agents with traces, see Agents.
Traces are a more fine-grained way to group LLM interactions within a Session. A Trace can contain one or more completions and a Session can contain one or more Traces. Find a more detailed guide on how Sessions, Traces, and Completions fit together here.
For a complete code example, see Record Traces.
Traces are created off of an existing session object:
Adding Tools to Traces
When building agents that use tools, tool calls are recorded as the output of an LLM call by default. You can also add explicit tool spans to provide more data about tool execution, including latency and other metadata. These are recorded as a Trace withkind='tool' and linked to the parent completion using parent_id.
For complete examples and code snippets, see Tool Calls.
Updating a Trace
Freeplay allows you to update a trace after it has been recorded. This is useful for adding evaluation results, customer feedback, metadata, or updating the output. To do this, you need theproject_id, session_id, and trace_id. You must provide at least one of output, metadata, feedback, eval_results, or test_run_info.

