Skip to main content

Agent Run

An AgentRun represents a complete agent run. It contains a collection of Transcript objects, as well as metadata (scores, experiment info, etc.).
  • In single-agent (most common) settings, each AgentRun contains a single Transcript.
  • In multi-agent settings, an AgentRun may contain multiple Transcript objects. For example, in a two-agent debate setting, you’ll have one Transcript per agent in the same AgentRun.
  • Docent’s LLM search features operate over complete AgentRun objects. Runs are passed to LLMs in their rendered text form (for example, via AgentRunView.to_text()).

Usage

AgentRun objects require a list of Transcript objects, as well as a metadata dictionary whose keys are strings. The metadata should be JSON-serializable. Passing dict[str, Transcript] is still accepted for backwards compatibility, but is deprecated.

Rendering

To see how your AgentRun is being rendered to an LLM, render a view and call to_text():

AgentRun

Bases: BaseModel Represents a complete run of an agent with transcripts and metadata. An AgentRun encapsulates the execution of an agent, storing all communication transcripts and associated metadata. It must contain at least one transcript. Attributes:

transcript_dict property

Returns a dictionary mapping transcript IDs to Transcript objects.

transcript_group_dict property

Returns a dictionary mapping transcript group IDs to TranscriptGroup objects.

AgentRunTree

Bases: BaseModel

SelectionSpec

Bases: BaseModel

is_default

Return True if all nodes have default settings (show everything).

AgentRunView

to_dict

Serialize the view for storage. Omits selection_spec if it’s default.

from_dict classmethod

Reconstruct a view from serialized data and an AgentRun.

should_render_child

Determine if a child should be rendered based on parent’s render settings.

should_render_metadata

Determine if a node’s metadata should be rendered.

set_metadata_selection

Set whether a node’s metadata is rendered. When enabling (True), this also ensures the path from the root to this node is visible by adjusting parent render settings. Parameters:

set_node_selection

Set whether a node and its descendants are rendered. This recursively sets children selection state for all descendants. When enabling (True), this also ensures the path from the root to this node is visible by adjusting parent render settings. When disabling (False), this ensures the parent excludes this node. Notably, this does not affect the metadata rendering state of each node. Parameters: