Collected Subgraph Traces
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.