OptimizationArtifact

@Serializable
data class OptimizationArtifact(val strategyInstruction: String? = null, val strategyDemonstrations: List<Demonstration> = emptyList(), val subgraphInstructions: Map<String, String> = emptyMap(), val subgraphDemonstrations: Map<String, List<Demonstration>> = emptyMap())

The serializable output of an optimization run, holding optimized instructions and demonstrations.

Produced by optimizers, consumed by optimizable subgraphs at runtime, and persisted to the filesystem between training and inference.

Immutability simplifies parallel evaluation: each optimization trial can safely hold its own artifact instance without synchronization.

Subgraph entries use the subgraph name as key. The strategy-level instruction and demonstrations are stored separately from subgraph entries.

Constructors

Link copied to clipboard
constructor(strategyInstruction: String? = null, strategyDemonstrations: List<Demonstration> = emptyList(), subgraphInstructions: Map<String, String> = emptyMap(), subgraphDemonstrations: Map<String, List<Demonstration>> = emptyMap())

Types

Link copied to clipboard
object Companion

Holds the agent-storage key under which the artifact is published at runtime.

Properties

Link copied to clipboard

Demonstrations for the strategy level.

Link copied to clipboard

Optimized instruction for the strategy's system prompt, or null to keep the original.

Link copied to clipboard

Map from subgraph name to demonstration list.

Link copied to clipboard

Map from subgraph name to optimized instruction text.

Functions

Link copied to clipboard

Returns the demonstrations for the given subgraph, or an empty list if not present.

Link copied to clipboard
fun getInstruction(subgraphName: String): String?

Returns the optimized instruction for the given subgraph, or null if not present.

Link copied to clipboard

Merges this artifact with another, with the other artifact's entries taking precedence.

Link copied to clipboard

Creates a new artifact with updated strategy-level demonstrations.

Link copied to clipboard

Creates a new artifact with an updated strategy-level instruction.

Link copied to clipboard

Creates a new artifact with additional or updated subgraph demonstrations.

Link copied to clipboard
fun withSubgraphInstruction(subgraphName: String, instruction: String): OptimizationArtifact

Creates a new artifact with an additional or updated subgraph instruction.