AIAgentPlannerPipeline

Represents a specific implementation of an AI agent pipeline that uses a planner approach.

Represents a specific implementation of an AI agent pipeline that uses a planner approach.

Represents a specific implementation of an AI agent pipeline that uses a planner approach.

Constructors

Link copied to clipboard
expect constructor(agentConfig: AIAgentConfig, clock: KoogClock = KoogClock.System, basePipelineDelegate: AIAgentPipelineImpl = AIAgentPipelineImpl(agentConfig, clock))
actual constructor(agentConfig: AIAgentConfig, clock: ERROR CLASS: Symbol not found for KoogClock, basePipelineDelegate: AIAgentPipelineImpl)
actual constructor(agentConfig: AIAgentConfig, clock: KoogClock, basePipelineDelegate: AIAgentPipelineImpl)

Properties

Link copied to clipboard
expect open override val clock: KoogClock

Provides access to a Clock instance representing the current system time. The Clock can be used to retrieve the current time, create date-time instances, or perform operations based on a specific moment in time.

open override val clock: ai/koog/utils/time/KoogClock
open override val clock: KoogClock
Link copied to clipboard
expect open override val config: AIAgentConfig

Represents the configuration settings for the AI agent.

open override val config: AIAgentConfig
open override val config: AIAgentConfig

Functions

Link copied to clipboard
expect open suspend override fun closeAllFeaturesMessageProcessors()
open suspend override fun closeAllFeaturesMessageProcessors()
open suspend override fun closeAllFeaturesMessageProcessors()
Link copied to clipboard
expect open suspend override fun collectToolCallMetadata(eventId: String, executionInfo: AgentExecutionInfo, runId: String, toolCallId: String?, toolName: String, toolDescription: String?, toolArgs: JSONObject, context: AIAgentContext): ToolCallMetadata

Collects metadata contributions from every feature that registered a handler via provideToolCallMetadata and returns the combined map.

open suspend override fun collectToolCallMetadata(eventId: String, executionInfo: AgentExecutionInfo, runId: String, toolCallId: String?, toolName: String, toolDescription: String?, toolArgs: ai/koog/serialization/JSONObject, context: AIAgentContext): ai/koog/agents/core/tools/ToolCallMetadata

Collects metadata contributions from every feature that registered a handler via provideToolCallMetadata and returns the combined map.

open suspend override fun collectToolCallMetadata(eventId: String, executionInfo: AgentExecutionInfo, runId: String, toolCallId: String?, toolName: String, toolDescription: String?, toolArgs: JSONObject, context: AIAgentContext): ToolCallMetadata

Collects metadata contributions from every feature that registered a handler via provideToolCallMetadata and returns the combined map.

Link copied to clipboard
expect open override fun <TFeature : Any> feature(featureClass: KClass<TFeature>, feature: AIAgentFeature<*, TFeature>): TFeature?

Retrieves a feature implementation from the current pipeline using the specified feature, if it is registered.

open override fun <TFeature : Any> feature(featureClass: KClass<TFeature>, feature: AIAgentFeature<*, TFeature>): TFeature?
open override fun <TFeature : Any> feature(featureClass: KClass<TFeature>, feature: AIAgentFeature<*, TFeature>): TFeature?
Link copied to clipboard
expect open override fun <TConfig : FeatureConfig, TFeatureImpl : Any> install(featureKey: AIAgentStorageKey<TFeatureImpl>, featureConfig: TConfig, featureImpl: TFeatureImpl)

Installs a feature into the AI agent storage using the provided feature key, configuration, and implementation.

expect fun <TConfig : FeatureConfig, TFeature : Any> install(feature: AIAgentPlannerFeature<TConfig, TFeature>, configure: TConfig.() -> Unit)

Installs a planner feature into the pipeline with the provided configuration.

open override fun <TConfig : FeatureConfig, TFeatureImpl : Any> install(featureKey: AIAgentStorageKey<TFeatureImpl>, featureConfig: TConfig, featureImpl: TFeatureImpl)

actual fun <TConfig : FeatureConfig, TFeature : Any> install(feature: AIAgentPlannerFeature<TConfig, TFeature>, configure: TConfig.() -> Unit)

Installs a non-graph feature into the pipeline with the provided configuration.

open override fun <TConfig : FeatureConfig, TFeatureImpl : Any> install(featureKey: AIAgentStorageKey<TFeatureImpl>, featureConfig: TConfig, featureImpl: TFeatureImpl)

actual fun <TConfig : FeatureConfig, TFeature : Any> install(feature: AIAgentPlannerFeature<TConfig, TFeature>, configure: TConfig.() -> Unit)

Installs a non-graph feature into the pipeline with the provided configuration.

Link copied to clipboard
expect open override fun interceptAgentClosing(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: AgentClosingContext) -> Unit)

Intercepts and sets a handler to be invoked before an agent is closed.

open override fun interceptAgentClosing(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: AgentClosingContext) -> Unit)
open override fun interceptAgentClosing(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: AgentClosingContext) -> Unit)
Link copied to clipboard

Intercepts and sets a handler to be invoked before an agent is closed.

Link copied to clipboard
expect open override fun interceptAgentCompleted(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: AgentCompletedContext) -> Unit)

Intercepts the completion of an agent's operation and assigns a custom handler to process the result.

open override fun interceptAgentCompleted(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: AgentCompletedContext) -> Unit)
open override fun interceptAgentCompleted(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: AgentCompletedContext) -> Unit)
Link copied to clipboard

Intercepts the completion of an agent's operation and assigns a custom handler to process the result.

Link copied to clipboard
expect open override fun interceptAgentExecutionFailed(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: AgentExecutionFailedContext) -> Unit)

Intercepts and handles errors occurring during the execution of an AI agent's strategy.

open override fun interceptAgentExecutionFailed(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: AgentExecutionFailedContext) -> Unit)
open override fun interceptAgentExecutionFailed(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: AgentExecutionFailedContext) -> Unit)
Link copied to clipboard

Intercepts and handles errors occurring during the execution of an AI agent's strategy.

Link copied to clipboard
expect open override fun interceptAgentStarting(feature: AIAgentFeature<*, *>, handle: suspend (AgentStartingContext) -> Unit)

Intercepts on before an agent started to modify or enhance the agent.

open override fun interceptAgentStarting(feature: AIAgentFeature<*, *>, handle: suspend (AgentStartingContext) -> Unit)
open override fun interceptAgentStarting(feature: AIAgentFeature<*, *>, handle: suspend (AgentStartingContext) -> Unit)
Link copied to clipboard

Intercepts on before an agent started to modify or enhance the agent.

Link copied to clipboard

Intercepts environment creation to allow features to modify or enhance the agent environment.

open override fun interceptEnvironmentCreated(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: AgentEnvironmentTransformingContext, environment: AIAgentEnvironment) -> AIAgentEnvironment)
open override fun interceptEnvironmentCreated(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: AgentEnvironmentTransformingContext, environment: AIAgentEnvironment) -> AIAgentEnvironment)
Link copied to clipboard

Intercepts environment creation to allow features to modify or enhance the agent environment.

Link copied to clipboard
expect open override fun interceptLLMCallCompleted(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMCallCompletedContext) -> Unit)

Intercepts LLM calls after they are made to process or log the response.

open override fun interceptLLMCallCompleted(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMCallCompletedContext) -> Unit)
open override fun interceptLLMCallCompleted(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMCallCompletedContext) -> Unit)
Link copied to clipboard

Intercepts LLM calls after they are made to process or log the response.

Link copied to clipboard
expect open override fun interceptLLMCallFailed(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMCallFailedContext) -> Unit)

Intercepts errors during LLM calls.

open override fun interceptLLMCallFailed(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMCallFailedContext) -> Unit)
open override fun interceptLLMCallFailed(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMCallFailedContext) -> Unit)
Link copied to clipboard

Intercepts a failed call to the Language Learning Model (LLM) within a specific AI agent feature and delegates the handling of the failure context to the provided interceptor.

Link copied to clipboard
expect open override fun interceptLLMCallStarting(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMCallStartingContext) -> Unit)

Intercepts LLM calls before they are made to modify or log the prompt.

open override fun interceptLLMCallStarting(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMCallStartingContext) -> Unit)
open override fun interceptLLMCallStarting(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMCallStartingContext) -> Unit)
Link copied to clipboard

Intercepts LLM calls before they are made to modify or log the prompt.

Link copied to clipboard
expect open override fun interceptLLMStreamingCompleted(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMStreamingCompletedContext) -> Unit)

Intercepts streaming operations after they complete to perform post-processing or cleanup.

open override fun interceptLLMStreamingCompleted(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMStreamingCompletedContext) -> Unit)
open override fun interceptLLMStreamingCompleted(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMStreamingCompletedContext) -> Unit)
Link copied to clipboard

Intercepts streaming operations after they complete to perform post-processing or cleanup.

Link copied to clipboard
expect open override fun interceptLLMStreamingFailed(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMStreamingFailedContext) -> Unit)

Intercepts errors during the streaming process.

open override fun interceptLLMStreamingFailed(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMStreamingFailedContext) -> Unit)
open override fun interceptLLMStreamingFailed(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMStreamingFailedContext) -> Unit)
Link copied to clipboard

Intercepts errors during the streaming process.

Link copied to clipboard
expect open override fun interceptLLMStreamingFrameReceived(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMStreamingFrameReceivedContext) -> Unit)

Intercepts stream frames as they are received during the streaming process.

open override fun interceptLLMStreamingFrameReceived(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMStreamingFrameReceivedContext) -> Unit)
open override fun interceptLLMStreamingFrameReceived(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMStreamingFrameReceivedContext) -> Unit)

Intercepts stream frames as they are received during the streaming process.

Link copied to clipboard
expect open override fun interceptLLMStreamingStarting(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMStreamingStartingContext) -> Unit)

Intercepts streaming operations before they begin to modify or log the streaming request.

open override fun interceptLLMStreamingStarting(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMStreamingStartingContext) -> Unit)
open override fun interceptLLMStreamingStarting(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: LLMStreamingStartingContext) -> Unit)
Link copied to clipboard

Intercepts streaming operations before they begin to modify or log the streaming request.

Intercepts plan completion evaluation completed event to perform actions when a plan is evaluated for completion.

Intercepts plan completion evaluation completed event to perform actions when a plan is evaluated for completion.

Intercepts plan completion evaluation completed event to perform actions when a plan is evaluated for completion.

Intercepts plan completion evaluation completed event to perform actions when evaluating if a plan is completed.

expect open override fun interceptPlanCompletionEvaluationStarting(feature: AIAgentFeature<*, *>, handle: suspend (PlanCompletionEvaluationStartingContext) -> Unit)

Intercepts plan completion evaluation starting event to perform actions when a plan is about to be evaluated for completion.

Intercepts plan completion evaluation starting event to perform actions when a plan is about to be evaluated for completion.

Intercepts plan completion evaluation starting event to perform actions when a plan is about to be evaluated for completion.

Intercepts plan completion evaluation starting event to perform actions when a plan is about to be evaluated for completion.

Link copied to clipboard
expect open override fun interceptPlanCreationCompleted(feature: AIAgentFeature<*, *>, handle: suspend (PlanCreationCompletedContext) -> Unit)

Intercepts plan creation completed event to perform actions when a plan completes creation.

open override fun interceptPlanCreationCompleted(feature: AIAgentFeature<*, *>, handle: suspend (PlanCreationCompletedContext) -> Unit)

Intercepts plan creation completed event to perform actions when a plan completes creation.

open override fun interceptPlanCreationCompleted(feature: AIAgentFeature<*, *>, handle: suspend (PlanCreationCompletedContext) -> Unit)

Intercepts plan creation completed event to perform actions when a plan completes creation.

Link copied to clipboard

Intercepts plan creation completed event to perform actions when a plan completes creation.

Link copied to clipboard
expect open override fun interceptPlanCreationStarting(feature: AIAgentFeature<*, *>, handle: suspend (PlanCreationStartingContext) -> Unit)

Intercepts plan creation starting event to perform actions when a plan begins creation.

open override fun interceptPlanCreationStarting(feature: AIAgentFeature<*, *>, handle: suspend (PlanCreationStartingContext) -> Unit)

Intercepts plan creation starting event to perform actions when a plan begins creation.

open override fun interceptPlanCreationStarting(feature: AIAgentFeature<*, *>, handle: suspend (PlanCreationStartingContext) -> Unit)

Intercepts plan creation starting event to perform actions when a plan begins creation.

Link copied to clipboard

Intercepts plan creation starting event to perform actions when a plan begins creation.

Link copied to clipboard
expect open override fun interceptStepExecutionCompleted(feature: AIAgentFeature<*, *>, handle: suspend (StepExecutionCompletedContext) -> Unit)

Intercepts step execution completed event to perform actions when a plan step completes execution.

open override fun interceptStepExecutionCompleted(feature: AIAgentFeature<*, *>, handle: suspend (StepExecutionCompletedContext) -> Unit)

Intercepts step execution completed event to perform actions when a plan step completes execution.

open override fun interceptStepExecutionCompleted(feature: AIAgentFeature<*, *>, handle: suspend (StepExecutionCompletedContext) -> Unit)

Intercepts step execution completed event to perform actions when a plan step completes execution.

Link copied to clipboard

Intercepts step execution completed event to perform actions when a plan step completes execution.

Link copied to clipboard
expect open override fun interceptStepExecutionStarting(feature: AIAgentFeature<*, *>, handle: suspend (StepExecutionStartingContext) -> Unit)

Intercepts step execution starting event to perform actions when a plan step begins execution.

open override fun interceptStepExecutionStarting(feature: AIAgentFeature<*, *>, handle: suspend (StepExecutionStartingContext) -> Unit)

Intercepts step execution starting event to perform actions when a plan step begins execution.

open override fun interceptStepExecutionStarting(feature: AIAgentFeature<*, *>, handle: suspend (StepExecutionStartingContext) -> Unit)

Intercepts step execution starting event to perform actions when a plan step begins execution.

Link copied to clipboard

Intercepts step execution starting event to perform actions when a plan step begins execution.

Link copied to clipboard
expect open override fun interceptStrategyCompleted(feature: AIAgentFeature<*, *>, handle: suspend (StrategyCompletedContext) -> Unit)

Sets up an interceptor to handle the completion of a strategy for the given feature.

open override fun interceptStrategyCompleted(feature: AIAgentFeature<*, *>, handle: suspend (StrategyCompletedContext) -> Unit)
open override fun interceptStrategyCompleted(feature: AIAgentFeature<*, *>, handle: suspend (StrategyCompletedContext) -> Unit)
Link copied to clipboard

Sets up an interceptor to handle the completion of a strategy for the given feature.

Link copied to clipboard
expect open override fun interceptStrategyStarting(feature: AIAgentFeature<*, *>, handle: suspend (StrategyStartingContext) -> Unit)

Intercepts the strategy starting event to perform actions when an agent strategy begins execution.

open override fun interceptStrategyStarting(feature: AIAgentFeature<*, *>, handle: suspend (StrategyStartingContext) -> Unit)
open override fun interceptStrategyStarting(feature: AIAgentFeature<*, *>, handle: suspend (StrategyStartingContext) -> Unit)
Link copied to clipboard

Intercepts starting strategy event to perform actions when an agent strategy begins execution.

Link copied to clipboard
expect open override fun interceptToolCallCompleted(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: ToolCallCompletedContext) -> Unit)

Intercepts the result of a tool call with a custom handler for a specific feature.

open override fun interceptToolCallCompleted(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: ToolCallCompletedContext) -> Unit)
open override fun interceptToolCallCompleted(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: ToolCallCompletedContext) -> Unit)
Link copied to clipboard

Intercepts the result of a tool call with a custom handler for a specific feature.

Link copied to clipboard
expect open override fun interceptToolCallFailed(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: ToolCallFailedContext) -> Unit)

Sets up an interception mechanism to handle tool call failures for a specific feature.

open override fun interceptToolCallFailed(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: ToolCallFailedContext) -> Unit)
open override fun interceptToolCallFailed(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: ToolCallFailedContext) -> Unit)
Link copied to clipboard

Sets up an interception mechanism to handle tool call failures for a specific feature.

Link copied to clipboard
expect open override fun interceptToolCallStarting(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: ToolCallStartingContext) -> Unit)

Intercepts and handles tool calls for the specified feature.

open override fun interceptToolCallStarting(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: ToolCallStartingContext) -> Unit)
open override fun interceptToolCallStarting(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: ToolCallStartingContext) -> Unit)
Link copied to clipboard

Intercepts and handles tool calls for the specified feature.

Link copied to clipboard
expect open override fun interceptToolValidationFailed(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: ToolValidationFailedContext) -> Unit)

Intercepts validation errors encountered during the execution of tools associated with the specified feature.

open override fun interceptToolValidationFailed(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: ToolValidationFailedContext) -> Unit)
open override fun interceptToolValidationFailed(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: ToolValidationFailedContext) -> Unit)
Link copied to clipboard

Intercepts validation errors encountered during the execution of tools associated with the specified feature.

Link copied to clipboard
expect open suspend override fun onAgentClosing(eventId: String, executionInfo: AgentExecutionInfo, agent: AIAgent<*, *>)

Invoked before an agent is closed to perform necessary pre-closure operations.

open suspend override fun onAgentClosing(eventId: String, executionInfo: AgentExecutionInfo, agent: AIAgent<*, *>)
open suspend override fun onAgentClosing(eventId: String, executionInfo: AgentExecutionInfo, agent: AIAgent<*, *>)
Link copied to clipboard
expect open suspend override fun onAgentCompleted(eventId: String, executionInfo: AgentExecutionInfo, agent: AIAgent<*, *>, context: AIAgentContext, runId: String, result: Any?)

Notifies all registered handlers that an agent has finished execution.

open suspend override fun onAgentCompleted(eventId: String, executionInfo: AgentExecutionInfo, agent: AIAgent<*, *>, context: AIAgentContext, runId: String, result: Any?)
open suspend override fun onAgentCompleted(eventId: String, executionInfo: AgentExecutionInfo, agent: AIAgent<*, *>, context: AIAgentContext, runId: String, result: Any?)
Link copied to clipboard
expect open suspend override fun onAgentEnvironmentTransforming(eventId: String, executionInfo: AgentExecutionInfo, agent: AIAgent<*, *>, baseEnvironment: AIAgentEnvironment): AIAgentEnvironment

Transforms the agent environment by applying all registered environment transformers.

open suspend override fun onAgentEnvironmentTransforming(eventId: String, executionInfo: AgentExecutionInfo, agent: AIAgent<*, *>, baseEnvironment: AIAgentEnvironment): AIAgentEnvironment
open suspend override fun onAgentEnvironmentTransforming(eventId: String, executionInfo: AgentExecutionInfo, agent: AIAgent<*, *>, baseEnvironment: AIAgentEnvironment): AIAgentEnvironment
Link copied to clipboard
expect open suspend override fun onAgentExecutionFailed(eventId: String, executionInfo: AgentExecutionInfo, agent: AIAgent<*, *>, context: AIAgentContext, runId: String, error: Throwable)

Notifies all registered handlers about an error that occurred during agent execution.

open suspend override fun onAgentExecutionFailed(eventId: String, executionInfo: AgentExecutionInfo, agent: AIAgent<*, *>, context: AIAgentContext, runId: String, error: Throwable)
open suspend override fun onAgentExecutionFailed(eventId: String, executionInfo: AgentExecutionInfo, agent: AIAgent<*, *>, context: AIAgentContext, runId: String, error: Throwable)
Link copied to clipboard
expect open suspend override fun <TInput, TOutput> onAgentStarting(eventId: String, executionInfo: AgentExecutionInfo, agent: AIAgent<*, *>, context: AIAgentContext, runId: String)

Notifies all registered handlers that an agent has started execution.

open suspend override fun <TInput, TOutput> onAgentStarting(eventId: String, executionInfo: AgentExecutionInfo, agent: AIAgent<*, *>, context: AIAgentContext, runId: String)
open suspend override fun <TInput, TOutput> onAgentStarting(eventId: String, executionInfo: AgentExecutionInfo, agent: AIAgent<*, *>, context: AIAgentContext, runId: String)
Link copied to clipboard
expect open suspend override fun onLLMCallCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>, response: Message.Assistant?, moderationResponse: ModerationResult? = null)

Notifies all registered LLM handlers after a language model call has completed.

open suspend override fun onLLMCallCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: ai/koog/prompt/Prompt, model: ai/koog/prompt/llm/LLModel, tools: List<ai/koog/agents/core/tools/ToolDescriptor>, response: ai/koog/prompt/message/Message.Assistant??, moderationResponse: ai/koog/prompt/dsl/ModerationResult?? = null)
open suspend override fun onLLMCallCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>, response: Message.Assistant?, moderationResponse: ModerationResult? = null)
Link copied to clipboard
expect open suspend override fun onLLMCallFailed(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>, error: Throwable)

Notifies all registered LLM handlers if a validation error occurs during a language model call.

open suspend override fun onLLMCallFailed(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: ai/koog/prompt/Prompt, model: ai/koog/prompt/llm/LLModel, tools: List<ai/koog/agents/core/tools/ToolDescriptor>, error: Throwable)
open suspend override fun onLLMCallFailed(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>, error: Throwable)
Link copied to clipboard
expect open suspend override fun onLLMCallStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>)

Notifies all registered LLM handlers before a language model call is made.

open suspend override fun onLLMCallStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: ai/koog/prompt/Prompt, model: ai/koog/prompt/llm/LLModel, tools: List<ai/koog/agents/core/tools/ToolDescriptor>)
open suspend override fun onLLMCallStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>)
Link copied to clipboard
expect open suspend override fun onLLMStreamingCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>)

Invoked after streaming from a language model completes.

open suspend override fun onLLMStreamingCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: ai/koog/prompt/Prompt, model: ai/koog/prompt/llm/LLModel, tools: List<ai/koog/agents/core/tools/ToolDescriptor>)
open suspend override fun onLLMStreamingCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>)
Link copied to clipboard
expect open suspend override fun onLLMStreamingFailed(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: Prompt, model: LLModel, error: Throwable)

Invoked if an error occurs during the streaming process.

open suspend override fun onLLMStreamingFailed(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: ai/koog/prompt/Prompt, model: ai/koog/prompt/llm/LLModel, error: Throwable)
open suspend override fun onLLMStreamingFailed(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: Prompt, model: LLModel, error: Throwable)
Link copied to clipboard
expect open suspend override fun onLLMStreamingFrameReceived(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: Prompt, model: LLModel, streamFrame: StreamFrame)

Invoked when a stream frame is received during the streaming process.

open suspend override fun onLLMStreamingFrameReceived(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: ai/koog/prompt/Prompt, model: ai/koog/prompt/llm/LLModel, streamFrame: ai/koog/prompt/streaming/StreamFrame)
open suspend override fun onLLMStreamingFrameReceived(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: Prompt, model: LLModel, streamFrame: StreamFrame)
Link copied to clipboard
expect open suspend override fun onLLMStreamingStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>)

Invoked before streaming from a language model begins.

open suspend override fun onLLMStreamingStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: ai/koog/prompt/Prompt, model: ai/koog/prompt/llm/LLModel, tools: List<ai/koog/agents/core/tools/ToolDescriptor>)
open suspend override fun onLLMStreamingStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>)
Link copied to clipboard
expect open suspend override fun onPlanCompletionEvaluationCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: TypeToken?, plan: Any, planType: TypeToken?, stepIndex: Int, isCompleted: Boolean)

Notifies all registered planner handlers when a plan-completion check has been evaluated.

open suspend override fun onPlanCompletionEvaluationCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: ai/koog/serialization/TypeToken??, plan: Any, planType: ai/koog/serialization/TypeToken??, stepIndex: Int, isCompleted: Boolean)

Notifies all registered planner handlers when evaluating whether a plan is completed.

open suspend override fun onPlanCompletionEvaluationCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: TypeToken?, plan: Any, planType: TypeToken?, stepIndex: Int, isCompleted: Boolean)

Notifies all registered planner handlers when evaluating whether a plan is completed.

Link copied to clipboard
expect open suspend override fun onPlanCompletionEvaluationStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: TypeToken?, plan: Any, planType: TypeToken?, stepIndex: Int)

Notifies all registered planner handlers when a plan-completion check is about to be evaluated.

open suspend override fun onPlanCompletionEvaluationStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: ai/koog/serialization/TypeToken??, plan: Any, planType: ai/koog/serialization/TypeToken??, stepIndex: Int)

Notifies all registered planner handlers when evaluating whether a plan is completed.

open suspend override fun onPlanCompletionEvaluationStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: TypeToken?, plan: Any, planType: TypeToken?, stepIndex: Int)

Notifies all registered planner handlers when evaluating whether a plan is completed.

Link copied to clipboard
expect open suspend override fun onPlanCreationCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: TypeToken?, plan: Any?, planType: TypeToken?, stepIndex: Int, updatedPlan: Any)

Notifies all registered planner handlers that a plan creation has completed.

open suspend override fun onPlanCreationCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: ai/koog/serialization/TypeToken??, plan: Any?, planType: ai/koog/serialization/TypeToken??, stepIndex: Int, updatedPlan: Any)

Notifies all registered planner handlers that a plan creation has completed.

open suspend override fun onPlanCreationCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: TypeToken?, plan: Any?, planType: TypeToken?, stepIndex: Int, updatedPlan: Any)

Notifies all registered planner handlers that a plan creation has completed.

Link copied to clipboard
expect open suspend override fun onPlanCreationStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: TypeToken?, plan: Any?, planType: TypeToken?, stepIndex: Int)

Notifies all registered planner handlers that a plan creation has started.

open suspend override fun onPlanCreationStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: ai/koog/serialization/TypeToken??, plan: Any?, planType: ai/koog/serialization/TypeToken??, stepIndex: Int)

Notifies all registered planner handlers that a plan creation has started.

open suspend override fun onPlanCreationStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: TypeToken?, plan: Any?, planType: TypeToken?, stepIndex: Int)

Notifies all registered planner handlers that a plan creation has started.

Link copied to clipboard
expect open suspend override fun onStepExecutionCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: TypeToken?, plan: Any, planType: TypeToken?, stepIndex: Int)

Notifies all registered planner handlers that a plan step execution has completed.

open suspend override fun onStepExecutionCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: ai/koog/serialization/TypeToken??, plan: Any, planType: ai/koog/serialization/TypeToken??, stepIndex: Int)

Notifies all registered planner handlers that a plan step execution has completed.

open suspend override fun onStepExecutionCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: TypeToken?, plan: Any, planType: TypeToken?, stepIndex: Int)

Notifies all registered planner handlers that a plan step execution has completed.

Link copied to clipboard
expect open suspend override fun onStepExecutionStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: TypeToken?, plan: Any, planType: TypeToken?, stepIndex: Int)

Notifies all registered planner handlers that a plan step execution has started.

open suspend override fun onStepExecutionStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: ai/koog/serialization/TypeToken??, plan: Any, planType: ai/koog/serialization/TypeToken??, stepIndex: Int)

Notifies all registered planner handlers that a plan step execution has started.

open suspend override fun onStepExecutionStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, state: Any, stateType: TypeToken?, plan: Any, planType: TypeToken?, stepIndex: Int)

Notifies all registered planner handlers that a plan step execution has started.

Link copied to clipboard
expect open suspend override fun onStrategyCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, strategy: AIAgentStrategy<*, *, *>, result: Any?, resultType: TypeToken)

Notifies all registered strategy handlers that a strategy has finished execution.

open suspend override fun onStrategyCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, strategy: AIAgentStrategy<*, *, *>, result: Any?, resultType: ai/koog/serialization/TypeToken)
open suspend override fun onStrategyCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, strategy: AIAgentStrategy<*, *, *>, result: Any?, resultType: TypeToken)
Link copied to clipboard
expect open suspend override fun onStrategyStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, strategy: AIAgentStrategy<*, *, *>)

Notifies all registered strategy handlers that a strategy has started execution.

open suspend override fun onStrategyStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, strategy: AIAgentStrategy<*, *, *>)
open suspend override fun onStrategyStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, strategy: AIAgentStrategy<*, *, *>)
Link copied to clipboard
expect open suspend override fun onToolCallCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, toolCallId: String?, toolName: String, toolDescription: String?, toolArgs: JSONObject, toolResult: JSONElement?)

Notifies all registered tool handlers about the result of a tool call.

open suspend override fun onToolCallCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, toolCallId: String?, toolName: String, toolDescription: String?, toolArgs: ai/koog/serialization/JSONObject, toolResult: ai/koog/serialization/JSONElement??)
open suspend override fun onToolCallCompleted(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, toolCallId: String?, toolName: String, toolDescription: String?, toolArgs: JSONObject, toolResult: JSONElement?)
Link copied to clipboard
expect open suspend override fun onToolCallFailed(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, toolCallId: String?, toolName: String, toolDescription: String?, toolArgs: JSONObject, message: String, error: Throwable?)

Notifies all registered tool handlers when a tool call fails with an exception.

open suspend override fun onToolCallFailed(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, toolCallId: String?, toolName: String, toolDescription: String?, toolArgs: ai/koog/serialization/JSONObject, message: String, error: Throwable?)
open suspend override fun onToolCallFailed(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, toolCallId: String?, toolName: String, toolDescription: String?, toolArgs: JSONObject, message: String, error: Throwable?)
Link copied to clipboard
expect open suspend override fun onToolCallStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, toolCallId: String?, toolName: String, toolDescription: String?, toolArgs: JSONObject)

Notifies all registered tool handlers when a tool is called.

open suspend override fun onToolCallStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, toolCallId: String?, toolName: String, toolDescription: String?, toolArgs: ai/koog/serialization/JSONObject)
open suspend override fun onToolCallStarting(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, toolCallId: String?, toolName: String, toolDescription: String?, toolArgs: JSONObject)
Link copied to clipboard
expect open suspend override fun onToolValidationFailed(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, toolCallId: String?, toolName: String, toolDescription: String?, toolArgs: JSONObject, message: String, error: Throwable)

Notifies all registered tool handlers when a validation error occurs during a tool call.

open suspend override fun onToolValidationFailed(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, toolCallId: String?, toolName: String, toolDescription: String?, toolArgs: ai/koog/serialization/JSONObject, message: String, error: Throwable)
open suspend override fun onToolValidationFailed(eventId: String, executionInfo: AgentExecutionInfo, context: AIAgentContext, runId: String, toolCallId: String?, toolName: String, toolDescription: String?, toolArgs: JSONObject, message: String, error: Throwable)
Link copied to clipboard
expect open suspend override fun prepareFeatures()
open suspend override fun prepareFeatures()
open suspend override fun prepareFeatures()
Link copied to clipboard
expect open override fun provideToolCallMetadata(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: ToolCallStartingContext) -> Map<String, Any?>)

Registers a handler that contributes per-call metadata before a tool executes.

open override fun provideToolCallMetadata(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: ToolCallStartingContext) -> Map<String, Any?>)

Registers a handler that contributes metadata for every tool call.

open override fun provideToolCallMetadata(feature: AIAgentFeature<*, *>, handle: suspend (eventContext: ToolCallStartingContext) -> Map<String, Any?>)

Registers a handler that contributes metadata for every tool call.

Link copied to clipboard
expect open suspend override fun uninstall(featureKey: AIAgentStorageKey<*>)

Uninstalls the specified feature associated with the given key from storage.

open suspend override fun uninstall(featureKey: AIAgentStorageKey<*>)
open suspend override fun uninstall(featureKey: AIAgentStorageKey<*>)