AIAgentLLMContextCommon

Common AIAgentLLMContext implementation shared across platforms.

Inheritors

Properties

Link copied to clipboard
@get:JvmName(name = "clock")
val clock: Clock

Represents the clock instance used for time-related operations and scheduling within the context.

Link copied to clipboard
@get:JvmName(name = "config")
val config: AIAgentConfig

Provides access to the configuration settings for an AI agent within the LLM context.

Link copied to clipboard
@get:JvmName(name = "environment")
val environment: AIAgentEnvironment

Represents the execution environment associated with an AI agent within the context of the LLM (Large Language Model) framework.

Link copied to clipboard

LLM currently associated with this context.

Link copied to clipboard
@get:JvmName(name = "prompt")
var prompt: Prompt

The current prompt used within the AIAgentLLMContext.

Link copied to clipboard

The PromptExecutor responsible for performing operations on the current prompt.

Link copied to clipboard

Response processor currently associated with this context.

Link copied to clipboard
@get:JvmName(name = "toolRegistry")
val toolRegistry: ToolRegistry

A ToolRegistry that contains metadata about available tools.

Link copied to clipboard

List of current tools associated with this agent context.

Functions

Link copied to clipboard
open fun copy(tools: List<ToolDescriptor> = this.tools, prompt: Prompt = this.prompt, model: LLModel = this.model, responseProcessor: ResponseProcessor? = this.responseProcessor, promptExecutor: PromptExecutor = this.promptExecutor, environment: AIAgentEnvironment = this.environment, config: AIAgentConfig = this.config, clock: Clock = this.clock): AIAgentLLMContext

Returns the current prompt used in the LLM context.

open suspend fun copy(tools: List<ToolDescriptor> = this.tools, toolRegistry: ToolRegistry = this.toolRegistry, prompt: Prompt = this.prompt, model: LLModel = this.model, responseProcessor: ResponseProcessor? = this.responseProcessor, promptExecutor: PromptExecutor = this.promptExecutor, environment: AIAgentEnvironment = this.environment, config: AIAgentConfig = this.config, clock: Clock = this.clock): AIAgentLLMContext

Creates a deep copy of this LLM context.

Link copied to clipboard
open suspend fun <T> readSession(block: suspend AIAgentLLMReadSession.() -> T): T

Executes a read session within the AIAgentLLMContext, ensuring concurrent safety with active write session and other read sessions.

Link copied to clipboard
open suspend fun withPrompt(block: Prompt.() -> Prompt)

Updates the current AIAgentLLMContext with a new prompt and ensures thread-safe access using a read lock.

Link copied to clipboard
open suspend fun <T> writeSession(block: suspend AIAgentLLMWriteSession.() -> T): T

Executes a write session on the AIAgentLLMContext, ensuring that all active write and read sessions are completed before initiating the write session.