AIAgentNonGraphPipeline

class AIAgentNonGraphPipeline(val clock: Clock = Clock.System) : AIAgentPipeline(source)

Represents a specific implementation of an AI agent pipeline that does not use graph-based processing. This class inherits from the base AIAgentPipeline class and may be used for handling workflows or data processing tasks that do not require graph-based data structures.

Parameters

clock

The clock used for time-based operations within the pipeline

Constructors

Link copied to clipboard
constructor(clock: Clock = Clock.System)

Properties

Link copied to clipboard
val clock: Clock

Functions

Link copied to clipboard

Retrieves all features associated with the given agent context.

Link copied to clipboard

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

Link copied to clipboard
fun <TFeature : Any> interceptAfterLLMCall(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: LLMCallCompletedContext) -> Unit)

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

Link copied to clipboard

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

Link copied to clipboard
fun <TFeature : Any> interceptAgentClosing(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: AgentClosingContext) -> Unit)

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

Link copied to clipboard
fun <TFeature : Any> interceptAgentCompleted(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: AgentCompletedContext) -> Unit)

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

Link copied to clipboard
fun <TFeature : Any> interceptAgentExecutionFailed(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: AgentExecutionFailedContext) -> Unit)

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

Link copied to clipboard
fun <TFeature : Any> interceptAgentFinished(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: AgentCompletedContext) -> Unit)

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

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard
fun <TFeature : Any> interceptBeforeLLMCall(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: LLMCallStartingContext) -> Unit)

Intercepts LLM calls before they are made (deprecated name).

Link copied to clipboard

Sets a feature handler for agent context events.

Link copied to clipboard

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

Link copied to clipboard
fun <TFeature : Any> interceptLLMCallCompleted(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: LLMCallCompletedContext) -> Unit)

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

Link copied to clipboard
fun <TFeature : Any> interceptLLMCallStarting(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: LLMCallStartingContext) -> Unit)

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

Link copied to clipboard
fun <TFeature : Any> interceptLLMStreamingCompleted(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: LLMStreamingCompletedContext) -> Unit)

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

Link copied to clipboard
fun <TFeature : Any> interceptLLMStreamingFailed(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: LLMStreamingFailedContext) -> Unit)

Intercepts errors during the streaming process.

Link copied to clipboard

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

Link copied to clipboard
fun <TFeature : Any> interceptLLMStreamingStarting(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: LLMStreamingStartingContext) -> Unit)

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

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard
fun <TFeature : Any> interceptToolCall(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: ToolCallStartingContext) -> Unit)

Intercepts and handles tool calls for the specified feature and its implementation. Updates the tool call handler for the given feature key with a custom handler.

Link copied to clipboard
fun <TFeature : Any> interceptToolCallCompleted(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: ToolCallCompletedContext) -> Unit)

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

Link copied to clipboard
fun <TFeature : Any> interceptToolCallFailed(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: ToolCallFailedContext) -> Unit)

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

Link copied to clipboard
fun <TFeature : Any> interceptToolCallFailure(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: ToolCallFailedContext) -> Unit)

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

Link copied to clipboard
fun <TFeature : Any> interceptToolCallResult(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: ToolCallCompletedContext) -> Unit)

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

Link copied to clipboard
fun <TFeature : Any> interceptToolCallStarting(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: ToolCallStartingContext) -> Unit)

Intercepts and handles tool calls for the specified feature and its implementation. Updates the tool call handler for the given feature key with a custom handler.

Link copied to clipboard
fun <TFeature : Any> interceptToolValidationError(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: ToolValidationFailedContext) -> Unit)

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

Link copied to clipboard
fun <TFeature : Any> interceptToolValidationFailed(interceptContext: InterceptContext<TFeature>, handle: suspend TFeature.(eventContext: ToolValidationFailedContext) -> Unit)

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

Link copied to clipboard
suspend fun onAgentClosing(agentId: String)

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

Link copied to clipboard
suspend fun onAgentCompleted(agentId: String, runId: String, result: Any?)

Notifies all registered handlers that an agent has finished execution.

Link copied to clipboard

Transforms the agent environment by applying all registered environment transformers.

Link copied to clipboard
suspend fun onAgentExecutionFailed(agentId: String, runId: String, throwable: Throwable)

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

Link copied to clipboard
suspend fun <TInput, TOutput> onAgentStarting(runId: String, agent: AIAgent<*, *>, context: AIAgentContext)

Notifies all registered handlers that an agent has started execution.

Link copied to clipboard
suspend fun onLLMCallCompleted(runId: String, prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>, responses: List<Message.Response>, moderationResponse: ModerationResult? = null)

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

Link copied to clipboard
suspend fun onLLMCallStarting(runId: String, prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>)

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

Link copied to clipboard
suspend fun onLLMStreamingCompleted(runId: String, prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>)

Invoked after streaming from a language model completes.

Link copied to clipboard
suspend fun onLLMStreamingFailed(runId: String, throwable: Throwable)

Invoked if an error occurs during the streaming process.

Link copied to clipboard
suspend fun onLLMStreamingFrameReceived(runId: String, streamFrame: StreamFrame)

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

Link copied to clipboard
suspend fun onLLMStreamingStarting(runId: String, prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>)

Invoked before streaming from a language model begins.

Link copied to clipboard
suspend fun onStrategyCompleted(strategy: AIAgentStrategy<*, *, *>, context: AIAgentContext, result: Any?, resultType: KType)

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

Link copied to clipboard
suspend fun onStrategyStarting(strategy: AIAgentStrategy<*, *, *>, context: AIAgentContext)

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

Link copied to clipboard
suspend fun onToolCallCompleted(runId: String, toolCallId: String?, tool: Tool<*, *>, toolArgs: Any?, result: Any?)

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

Link copied to clipboard
suspend fun onToolCallFailed(runId: String, toolCallId: String?, tool: Tool<*, *>, toolArgs: Any?, throwable: Throwable)

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

Link copied to clipboard
suspend fun onToolCallStarting(runId: String, toolCallId: String?, tool: Tool<*, *>, toolArgs: Any?)

Notifies all registered tool handlers when a tool is called.

Link copied to clipboard
suspend fun onToolValidationFailed(runId: String, toolCallId: String?, tool: Tool<*, *>, toolArgs: Any?, error: String)

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