CollectedSubgraphTraces

class CollectedSubgraphTraces(maxPerSubgraph: Int)

Thread-safe container for collected subgraph execution traces and whole-agent trajectory.

Stores per-subgraph Demonstration objects keyed by subgraph name, and the latest whole-agent conversation trajectory. Safe for concurrent access via internal mutex.

Intermediate-message capture is driven purely by pipeline events:

  • On subgraph start, the prompt's current messages are snapshotted as the "inherited" prefix.

  • On every LLM call completion, the prompt+responses are recorded against the innermost active subgraph for that run.

  • On subgraph completion, the latest recorded snapshot is diffed against the inherited prefix and cleaned up into Demonstration.intermediateMessages.

Constructors

Link copied to clipboard
constructor(maxPerSubgraph: Int)

Functions

Link copied to clipboard
suspend fun clear()

Clears all collected traces and the trajectory.

Link copied to clipboard

Returns all collected traces grouped by subgraph name.

Link copied to clipboard
suspend fun getLatestFullPrompt(): Prompt?

Returns the latest whole-agent conversation trajectory, or null if no LLM call was made.

Link copied to clipboard
suspend fun getTraces(subgraphName: String): List<Demonstration>

Returns all collected traces for a specific subgraph.