Package-level declarations

Types

Link copied to clipboard
@Serializable
data class Demonstration(val input: String, val output: String, val intermediateMessages: List<Message>? = null)

A unified demonstration representing an input-output example for few-shot learning.

Link copied to clipboard

Controls the level of detail included when rendering a demonstration into the prompt.

Link copied to clipboard

Renders demonstrations into prompt-ready content based on the chosen format and insertion mode.

Link copied to clipboard

Controls how few-shot demonstrations are inserted into the prompt.

Link copied to clipboard
data class OptimizableModule(val name: String, val currentInstruction: String, val description: String? = null)

Represents an optimizable module discovered in an agent.

Link copied to clipboard

Delegate wrapper for optimizable subgraphs that captures the resolved subgraph name.

Link copied to clipboard
@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.

Link copied to clipboard
@Serializable
data class PromptInsertionDefaults(val fewShotPromptType: FewShotPromptType = FewShotPromptType.AS_MESSAGE_HISTORY, val demonstrationFormat: DemonstrationFormat = DemonstrationFormat.FULL_TRACE)

Default settings for how demonstrations are inserted into prompts.

Properties

Link copied to clipboard

Strategy-level module key used in OptimizationArtifact maps and OptimizableModule lists to refer to the agent's top-level system prompt (as opposed to a named subgraph).

Functions

Link copied to clipboard
fun <TInput, TOutput> AIAgentGraphStrategy<TInput, TOutput>.describeForOptimization(): String

Creates a text description of the strategy structure for use in MIPRO instruction proposal.

Link copied to clipboard

Discovers optimizable modules in an agent: the strategy-level system prompt plus any subgraphs created via optimizableSubgraphWithTask.

Link copied to clipboard
fun <TInput, TOutput> AIAgentGraphStrategy<TInput, TOutput>.findAllNodes(): List<AIAgentNode<*, *>>

Finds all AIAgentNode instances in the strategy, excluding start/finish nodes and subgraphs.

Link copied to clipboard
fun <TInput, TOutput> AIAgentGraphStrategy<TInput, TOutput>.findAllSubgraphs(): List<AIAgentSubgraph<*, *>>

Finds all AIAgentSubgraph instances in the strategy, excluding the strategy itself.

Link copied to clipboard
inline fun <Input, Output> AIAgentSubgraphBuilderBase<*, *>.optimizableSubgraphWithTask(optimizableInstruction: String, name: String? = null, toolSelectionStrategy: ToolSelectionStrategy = ToolSelectionStrategy.ALL, llmModel: LLModel? = null, llmParams: LLMParams? = null, runMode: ToolCalls = ToolCalls.SEQUENTIAL, assistantResponseRepeatMax: Int? = null, responseProcessor: ResponseProcessor? = null, freshHistory: Boolean = false, fewShotPromptType: FewShotPromptType? = null, demonstrationFormat: DemonstrationFormat? = null, noinline defineTask: suspend AIAgentGraphContextBase.(instruction: String, input: Input) -> String): OptimizableSubgraphDelegate<Input, Output>

Creates an optimizable subgraph that performs a single task with a tunable instruction and bootstrappable few-shot demonstrations.