SubgraphTraceCollectionFeature

Optimizer-internal feature that captures both per-subgraph traces and whole-agent trajectory.

Installed by optimizers on temporary agents during training to collect demonstrations from successful runs. Not intended for direct end-user use.

Driven entirely by pipeline events — no special hooks inside subgraphs are required:

  • Per-subgraph traces: at subgraph start, the prompt messages are snapshotted; every LLM call updates the running snapshot for the innermost active subgraph; on subgraph completion the snapshot is diffed against the start state and cleaned into Demonstration.

  • Whole-agent trajectory: the prompt+responses from the last LLM call in the run. Useful for trajectory-based optimizers (ACE, ReasoningBank).

Properties

Link copied to clipboard
open override val key: AIAgentStorageKey<CollectedSubgraphTraces>

Storage key under which the CollectedSubgraphTraces container is published.

Functions

Link copied to clipboard
open override fun createInitialConfig(agentConfig: AIAgentConfig): SubgraphTraceCollectionConfig

Creates the default SubgraphTraceCollectionConfig.

Link copied to clipboard
open override fun install(config: SubgraphTraceCollectionConfig, pipeline: AIAgentGraphPipeline): CollectedSubgraphTraces

Registers the pipeline interceptors that capture per-subgraph traces and the whole-agent trajectory.