Package-level declarations

Types

Link copied to clipboard

Represents a basic interface for AI agent.

Link copied to clipboard

A strategy for implementing AI agent behavior that operates in a loop-based manner.

Link copied to clipboard

AIAgentService is a core interface for managing AI agents. The service allows creation, removal, and management of AI agents and provides functionalities to list agents based on their statuses.f

Link copied to clipboard

Abstract base class for implementing an AI Agent Service. This class provides foundational functionality for managing and interacting with AI agents.

Link copied to clipboard
class AIAgentTool<Input, Output>(agentService: AIAgentService<Input, Output, *>, agentName: String, agentDescription: String, inputDescription: String? = null, inputSerializer: KSerializer<Input>, outputSerializer: KSerializer<Output>, parentAgentId: String? = null) : Tool<Input, AIAgentTool.AgentToolResult<Output>>

AIAgentTool is a generic tool that wraps an AI agent to facilitate integration with the context of a tool execution framework. It enables the serialization, deserialization, and execution of an AI agent's operations.

Link copied to clipboard

Provides functionality to generate diagram representations of AI agent strategies configured as graphs. Implementations of this interface are responsible for translating an AIAgentGraphStrategy into a textual or visual format suitable for understanding and visualization of agent workflows.

Link copied to clipboard
class FunctionalAIAgent<Input, Output>(val promptExecutor: PromptExecutor, val agentConfig: AIAgentConfig, val strategy: AIAgentFunctionalStrategy<Input, Output>, val toolRegistry: ToolRegistry = ToolRegistry.EMPTY, id: String? = null, val clock: Clock = Clock.System, val installFeatures: FunctionalAIAgent.FeatureContext.() -> Unit = {}) : StatefulSingleUseAIAgent<Input, Output, AIAgentFunctionalContext>

Represents the core AI agent for processing input and generating output using a defined configuration, toolset, and prompt execution pipeline.

Link copied to clipboard

A service for managing functional AI agents that operate based on a specified execution strategy.

Link copied to clipboard
open class GraphAIAgent<Input, Output>(val inputType: KType, val outputType: KType, val promptExecutor: PromptExecutor, val agentConfig: AIAgentConfig, val strategy: AIAgentGraphStrategy<Input, Output>, val toolRegistry: ToolRegistry = ToolRegistry.EMPTY, id: String? = null, val clock: Clock = Clock.System, val installFeatures: GraphAIAgent.FeatureContext.() -> Unit = {}) : StatefulSingleUseAIAgent<Input, Output, AIAgentGraphContextBase> , Closeable

Represents an implementation of an AI agent that provides functionalities to execute prompts, manage tools, handle agent pipelines, and interact with various configurable strategies and features.

Link copied to clipboard
class GraphAIAgentService<Input, Output>(val promptExecutor: PromptExecutor, val agentConfig: AIAgentConfig, val strategy: AIAgentGraphStrategy<Input, Output>, inputType: KType, outputType: KType, val toolRegistry: ToolRegistry, val installFeatures: GraphAIAgent.FeatureContext.() -> Unit) : AIAgentServiceBase<Input, Output, GraphAIAgent<Input, Output>>

A service class for managing graph-based AI agents, responsible for orchestrating the behavior and execution of agents within a configurable graph-based strategy.

Link copied to clipboard
Link copied to clipboard
abstract class StatefulSingleUseAIAgent<Input, Output, TContext : AIAgentContext>(logger: KLogger, id: String? = null) : AIAgent<Input, Output>

Abstract base class representing a single-use AI agent with state.

Link copied to clipboard

Enum representing the modes in which a single-run strategy for an AI agent can be executed.

Functions

Link copied to clipboard

AIAgentGraphStrategy utility for generating Mermaid diagrams from agent strategies.

Link copied to clipboard
inline fun <Input, Output> AIAgent<Input, Output>.asTool(agentName: String, agentDescription: String, inputDescription: String? = null, inputSerializer: KSerializer<Input> = serializer(), outputSerializer: KSerializer<Output> = serializer(), json: Json = Json.Default): Tool<Input, AIAgentTool.AgentToolResult<Output>>

Converts the current AI agent into a tool to allow using it in other agents as a tool.

Link copied to clipboard
inline fun <Input, Output> AIAgentService<Input, Output, *>.createAgentTool(agentName: String, agentDescription: String, inputDescription: String? = null, inputSerializer: KSerializer<Input> = serializer(), outputSerializer: KSerializer<Output> = serializer(), parentAgentId: String? = null, clock: Clock = Clock.System): Tool<Input, AIAgentTool.AgentToolResult<Output>>

Creates an AIAgent and converts it to a Tool that can be used by other AI Agents.

Link copied to clipboard

Retrieves a feature from the StatefulSingleUseAIAgent.pipeline associated with this agent using the specified key.

Link copied to clipboard

Retrieves a feature from the StatefulSingleUseAIAgent.pipeline associated with this agent using the specified key or throws an exception if it is not available.

Link copied to clipboard

Creates an AIAgentFunctionalStrategy with the specified loop logic and name.

Link copied to clipboard
operator fun AIAgentService.Companion.invoke(promptExecutor: PromptExecutor, agentConfig: AIAgentConfig, strategy: AIAgentGraphStrategy<String, String> = singleRunStrategy(), toolRegistry: ToolRegistry = ToolRegistry.EMPTY, installFeatures: GraphAIAgent.FeatureContext.() -> Unit = {}): GraphAIAgentService<String, String>

Invokes the process to create and return an instance of GraphAIAgentService.

Link copied to clipboard
suspend fun AIAgent<*, *>.isFinished(): Boolean

Checks whether the AI agent has reached a finished state.

Link copied to clipboard
suspend fun AIAgent<*, *>.isRunning(): Boolean

Checks whether the AI agent is currently in a running state.

Link copied to clipboard
fun singleRunStrategy(runMode: ToolCalls = ToolCalls.SINGLE_RUN_SEQUENTIAL): AIAgentGraphStrategy<String, String>

Creates a single-run strategy for an AI agent. This strategy defines a simple execution flow where the agent processes input, calls tools, and sends results back to the agent. The flow consists of the following steps: