PlannerAIAgent

class PlannerAIAgent<Input, Output>(val promptExecutor: PromptExecutor, val agentConfig: AIAgentConfig, val strategy: AIAgentPlannerStrategy<Input, Output, *>, val toolRegistry: ToolRegistry = ToolRegistry.EMPTY, id: String? = null, val clock: Clock = Clock.System, val installFeatures: PlannerAIAgent.FeatureContext.() -> Unit = {}) : AIAgentBase<Input, Output, AIAgentPlannerContext> (source)

Represents an instance of planner agent using AIAgentPlannerStrategy.

Parameters

State

The type of the state.

Plan

The type of the plan.

Constructors

Link copied to clipboard
constructor(promptExecutor: PromptExecutor, agentConfig: AIAgentConfig, strategy: AIAgentPlannerStrategy<Input, Output, *>, toolRegistry: ToolRegistry = ToolRegistry.EMPTY, id: String? = null, clock: Clock = Clock.System, installFeatures: PlannerAIAgent.FeatureContext.() -> Unit = {})

Types

Link copied to clipboard
object Companion

Companion object providing the static builder() method.

Link copied to clipboard

Represents a context for managing and configuring features in an AI agent. Provides functionality to install and configure features into a specific instance of an AI agent.

Properties

Link copied to clipboard
open override val agentConfig: AIAgentConfig

The configuration for the agent.

Link copied to clipboard

The clock used to calculate message timestamps

Link copied to clipboard
override val id: String

Represents the unique identifier for the AI agent.

Link copied to clipboard

Lambda for installing additional features within the agent environment.

Link copied to clipboard
open override val pipeline: AIAgentPlannerPipeline

Represents the pipeline used by the AI agent for processing tasks or data.

Link copied to clipboard

The executor responsible for processing prompts.

Link copied to clipboard

The strategy for processing input and generating output.

Link copied to clipboard

The registry of tools available for the agent. Defaults to an empty registry if not specified.

Functions

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
open suspend override fun close()

Closes the AI Agent and performs necessary cleanup operations.

Link copied to clipboard

Creates a new AIAgentRunSession for executing the agent with the given input.

Link copied to clipboard
open suspend override fun prepareContext(agentInput: Input, runId: String, eventId: String): AIAgentPlannerContext

Prepares and initializes the agent context required to handle the given input and run ID.

Link copied to clipboard
open suspend override fun run(agentInput: Input, sessionId: String?): Output

Executes the agent's main functionality, coordinating with various components such as pipelines and strategies. Ensures the agent is run in a thread-safe manner using locking mechanisms.