Package-level declarations

Types

Link copied to clipboard
open class AIAgent<Input, Output>(val inputType: KType, val outputType: KType, val promptExecutor: PromptExecutor, strategy: AIAgentStrategy<Input, Output>, val agentConfig: AIAgentConfigBase, val id: String = Uuid.random().toString(), val toolRegistry: ToolRegistry = ToolRegistry.EMPTY, val clock: Clock = Clock.System, installFeatures: AIAgent.FeatureContext.() -> Unit = {}) : AIAgentBase<Input, Output> , AIAgentEnvironment, 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

Represents a basic interface for AI agent.

Link copied to clipboard
open class AIAgentException(problem: String, throwable: Throwable? = null) : Exception

Represents a custom exception class for use in AI Agent-related processes.

Link copied to clipboard
class AIAgentTool<Input, Output>(agent: AIAgentBase<Input, Output>, agentName: String, agentDescription: String, inputDescriptor: ToolParameterDescriptor, inputSerializer: KSerializer<Input>, outputSerializer: KSerializer<Output>, json: Json = Json.Default) : Tool<AIAgentTool.AgentToolArgs, AIAgentTool.AgentToolResult>

AIAgentTool is a specialized tool that integrates an AI agent for processing tasks by leveraging input arguments and producing corresponding results.

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
inline fun <Input, Output> AIAgent(promptExecutor: PromptExecutor, strategy: AIAgentStrategy<Input, Output>, agentConfig: AIAgentConfigBase, id: String = Uuid.random().toString(), toolRegistry: ToolRegistry = ToolRegistry.EMPTY, clock: Clock = Clock.System, noinline installFeatures: AIAgent.FeatureContext.() -> Unit = {}): AIAgent<Input, Output>

Convenience builder that creates an instance of AIAgent, automatically deducing AIAgent.inputType and AIAgent.outputType from Input and Output

fun AIAgent(executor: PromptExecutor, llmModel: LLModel, id: String = Uuid.random().toString(), strategy: AIAgentStrategy<String, String> = singleRunStrategy(), systemPrompt: String = "", temperature: Double = 1.0, numberOfChoices: Int = 1, toolRegistry: ToolRegistry = ToolRegistry.EMPTY, maxIterations: Int = 50, installFeatures: AIAgent.FeatureContext.() -> Unit = {}): AIAgent<String, String>

Convenience builder that creates an instance of an AIAgent with string input and output and the specified parameters.

Link copied to clipboard
inline fun <Input, Output> AIAgentBase<Input, Output>.asTool(agentName: String, agentDescription: String, inputDescriptor: ToolParameterDescriptor, inputSerializer: KSerializer<Input> = serializer(), outputSerializer: KSerializer<Output> = serializer(), json: Json = Json.Default): Tool<AIAgentTool.AgentToolArgs, AIAgentTool.AgentToolResult>

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

Link copied to clipboard
fun singleRunStrategy(runMode: ToolCalls = ToolCalls.SINGLE_RUN_SEQUENTIAL): AIAgentStrategy<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: