copyWith

fun AIAgentConfig.copyWith(prompt: Prompt = this.prompt, model: LLModel = this.model, maxAgentIterations: Int = this.maxAgentIterations, missingToolsConversionStrategy: MissingToolsConversionStrategy = this.missingToolsConversionStrategy): AIAgentConfig

Method to copy the Agent's config with updated parameters (since the original class is immutable and is not a data class)


fun <Input, Output> GraphAIAgent<Input, Output>.copyWith(inputType: TypeToken = this.inputType, outputType: TypeToken = this.outputType, promptExecutor: PromptExecutor = this.promptExecutor, agentConfig: AIAgentConfig = this.agentConfig, id: String = this.id, toolRegistry: ToolRegistry = this.toolRegistry, clock: Clock = this.clock, installFeatures: GraphAIAgent.FeatureContext.() -> Unit = this.installFeatures, strategy: AIAgentGraphStrategy<Input, Output> = this.strategy): GraphAIAgent<Input, Output>

To be able to optimize the agent, we need to be able to automatically evolve it by modifying or creating copies of the AIAgent object.