AIAgentLLMContext

data class AIAgentLLMContext(tools: List<ToolDescriptor>, val toolRegistry: ToolRegistry = ToolRegistry.Companion.EMPTY, prompt: Prompt, model: LLModel, promptExecutor: PromptExecutor, environment: AIAgentEnvironment, config: AIAgentConfigBase)(source)

Represents the context for an AI agent LLM, managing tools, prompt handling, and interaction with the environment and execution layers. It provides mechanisms for concurrent read and write operations through sessions, ensuring thread safety.

Constructors

Link copied to clipboard
constructor(tools: List<ToolDescriptor>, toolRegistry: ToolRegistry = ToolRegistry.Companion.EMPTY, prompt: Prompt, model: LLModel, promptExecutor: PromptExecutor, environment: AIAgentEnvironment, config: AIAgentConfigBase)

Properties

Link copied to clipboard

A registry that contains metadata about available tools.

Functions

Link copied to clipboard
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
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.