Prompt Optimization Feature
Feature that applies an OptimizationArtifact to an agent at strategy start.
At strategy start, this feature:
Stores the OptimizationArtifact in agent storage for optimizable subgraphs to read.
Stores PromptInsertionDefaults in agent storage for subgraphs to inherit.
If OptimizationArtifact.strategyInstruction is set, replaces the system message in the prompt with the optimized instruction.
If OptimizationArtifact.strategyDemonstrations is non-empty, appends demonstrations after the system message.
Without this feature installed, optimizable subgraphs fall back to their default instructions and empty demonstrations.
Usage:
val agent = AIAgent(...) {
installPromptOptimization {
artifact = loadedArtifact
}
}Properties
Storage key under which the applied OptimizationArtifact is published.
Functions
Creates the default, empty PromptPromptOptimizationFeatureConfig.
Registers the strategy-start interceptor that publishes the artifact and applies strategy-level prompt edits.