AIAgentLLMReadSession

Represents a session for interacting with a language model (LLM) in a read-only context within an AI agent setup.

JVM actual implementation of a read-only LLM session.

In addition to common suspend APIs, this class exposes Java-friendly wrappers that run session operations on the strategy dispatcher.

Represents a session for interacting with a language model (LLM) in a read-only context within an AI agent setup.

Constructors

Link copied to clipboard
actual constructor(tools: List<ERROR CLASS: Symbol not found for ToolDescriptor>, executor: ERROR CLASS: Symbol not found for PromptExecutor, prompt: ERROR CLASS: Symbol not found for Prompt, model: ERROR CLASS: Symbol not found for LLModel, responseProcessor: ERROR CLASS: Symbol not found for ResponseProcessor??, config: AIAgentConfig)
actual constructor(tools: List<ToolDescriptor>, executor: PromptExecutor, prompt: Prompt, model: LLModel, responseProcessor: ResponseProcessor?, config: AIAgentConfig)

Properties

Link copied to clipboard

Config of the agent running the session.

Config of the agent running the session.

Config of the agent running the session.

Link copied to clipboard

Represents the active language model used within the session.

val model: ai/koog/prompt/llm/LLModel

Represents the active language model used within the session.

Represents the active language model used within the session.

Link copied to clipboard

Represents the current prompt associated with the LLM session. The prompt contains the input messages, model configuration, and parameters.

val prompt: ai/koog/prompt/Prompt

Represents the current prompt associated with the LLM session. The prompt contains the input messages, model configuration, and parameters.

Represents the current prompt associated with the LLM session. The prompt contains the input messages, model configuration, and parameters.

Link copied to clipboard

Represents the active response processor within the session.

val responseProcessor: ai/koog/prompt/processor/ResponseProcessor??

Represents the active response processor within the session.

Represents the active response processor within the session.

Link copied to clipboard

Provides a list of available tools in the session.

val tools: List<ai/koog/agents/core/tools/ToolDescriptor>

Provides a list of available tools in the session.

Provides a list of available tools in the session.

Functions

Link copied to clipboard
open override fun close()
open override fun close()
open override fun close()
Link copied to clipboard
fun executeBlocking(prompt: ERROR CLASS: Symbol not found for Prompt, tools: List<ERROR CLASS: Symbol not found for ToolDescriptor>): ERROR CLASS: Symbol not found for Message.Assistant
Link copied to clipboard

Parses a structured response from a language model message using the specified configuration.

suspend fun <T> parseResponseToStructuredResponse(response: ai/koog/prompt/message/Message.Assistant, config: ai/koog/prompt/structure/StructuredRequestConfig<T>, fixingParser: ai/koog/prompt/executor/model/StructureFixingParser?? = null): ai/koog/prompt/structure/StructuredResponse<T>

Parses a structured response from a language model message using the specified configuration.

Parses a structured response from a language model message using the specified configuration.

fun <T> parseResponseToStructuredResponseBlocking(response: ERROR CLASS: Symbol not found for Message.Assistant, config: ERROR CLASS: Symbol not found for StructuredRequestConfig<T>, fixingParser: ERROR CLASS: Symbol not found for StructureFixingParser?? = null): ERROR CLASS: Symbol not found for StructuredResponse<T>
Link copied to clipboard

Sends a request to the underlying LLM and returns the first non-reasoning response.

suspend fun requestLLM(): ai/koog/prompt/message/Message.Assistant

Sends a request to the underlying LLM and returns the first non-reasoning response.

Sends a request to the underlying LLM and returns the first non-reasoning response.

Link copied to clipboard
fun requestLLMBlocking(): ERROR CLASS: Symbol not found for Message.Assistant
Link copied to clipboard

Sends a request to the language model while enforcing the use of a specific tool.

suspend fun requestLLMForceOneTool(tool: ai/koog/agents/core/tools/ToolBase<*, *>): ai/koog/prompt/message/Message.Assistant
suspend fun requestLLMForceOneTool(tool: ai/koog/agents/core/tools/ToolDescriptor): ai/koog/prompt/message/Message.Assistant

Sends a request to the language model while enforcing the use of a specific tool.

Sends a request to the language model while enforcing the use of a specific tool.

Link copied to clipboard
fun requestLLMForceOneToolBlocking(tool: ERROR CLASS: Symbol not found for ToolBase<*, *>): ERROR CLASS: Symbol not found for Message.Assistant
fun requestLLMForceOneToolBlocking(tool: ERROR CLASS: Symbol not found for ToolDescriptor): ERROR CLASS: Symbol not found for Message.Assistant
Link copied to clipboard

Sends a request to the language model and returns all available response choices.

suspend fun requestLLMMultipleChoices(): List<ai/koog/prompt/message/Message.Assistant>

Sends a request to the language model and returns all available response choices.

Sends a request to the language model and returns all available response choices.

Link copied to clipboard
fun requestLLMMultipleChoicesBlocking(): ERROR CLASS: Symbol not found for LLMChoice
Link copied to clipboard

Sends a request to the language model that enforces the usage of tools and retrieves all responses.

suspend fun requestLLMOnlyCallingTools(): ai/koog/prompt/message/Message.Assistant

Sends a request to the language model that enforces the usage of tools and retrieves all responses.

Sends a request to the language model that enforces the usage of tools and retrieves all responses.

Link copied to clipboard
fun requestLLMOnlyCallingToolsBlocking(): ERROR CLASS: Symbol not found for Message.Assistant
Link copied to clipboard

Sends a streaming request to the underlying LLM and returns the streamed response.

suspend fun requestLLMStreaming(): kotlinx/coroutines/flow/Flow<ai/koog/prompt/streaming/StreamFrame>

Sends a streaming request to the underlying LLM and returns the streamed response.

Sends a streaming request to the underlying LLM and returns the streamed response.

Link copied to clipboard
fun requestLLMStreamingBlocking(): Flow.Publisher<ERROR CLASS: Symbol not found for StreamFrame>
Link copied to clipboard
suspend fun <T> requestLLMStructured(serializer: KSerializer<T>, examples: List<T> = emptyList(), fixingParser: StructureFixingParser? = null): Result<StructuredResponse<T>>

Sends a request to LLM and gets a structured response.

inline suspend fun <T> requestLLMStructured(examples: List<T> = emptyList(), fixingParser: StructureFixingParser? = null): Result<StructuredResponse<T>>

Requests a structured response from the language model using a reified serializer.

suspend fun <T> requestLLMStructured(config: ai/koog/prompt/structure/StructuredRequestConfig<T>, fixingParser: ai/koog/prompt/executor/model/StructureFixingParser?? = null): kotlin/Result<ai/koog/prompt/structure/StructuredResponse<T>>
suspend fun <T> requestLLMStructured(serializer: kotlinx/serialization/KSerializer<T>, examples: List<T> = emptyList(), fixingParser: ai/koog/prompt/executor/model/StructureFixingParser?? = null): kotlin/Result<ai/koog/prompt/structure/StructuredResponse<T>>

Sends a request to LLM and gets a structured response.

inline suspend fun <T> requestLLMStructured(examples: List<T> = emptyList(), fixingParser: ai/koog/prompt/executor/model/StructureFixingParser?? = null): kotlin/Result<ai/koog/prompt/structure/StructuredResponse<T>>

Requests a structured response from the language model using a reified serializer.

suspend fun <T> requestLLMStructured(serializer: KSerializer<T>, examples: List<T> = emptyList(), fixingParser: StructureFixingParser? = null): Result<StructuredResponse<T>>

Sends a request to LLM and gets a structured response.

inline suspend fun <T> requestLLMStructured(examples: List<T> = emptyList(), fixingParser: StructureFixingParser? = null): Result<StructuredResponse<T>>

Requests a structured response from the language model using a reified serializer.

Link copied to clipboard
fun <T> requestLLMStructuredBlocking(config: ERROR CLASS: Symbol not found for StructuredRequestConfig<T>, fixingParser: ERROR CLASS: Symbol not found for StructureFixingParser?? = null): ERROR CLASS: Symbol not found for Result<ERROR CLASS: Symbol not found for StructuredResponse<T>>
fun <T> requestLLMStructuredBlocking(serializer: ERROR CLASS: Symbol not found for KSerializer<T>, examples: List<T> = emptyList(), fixingParser: ERROR CLASS: Symbol not found for StructureFixingParser?? = null): ERROR CLASS: Symbol not found for Result<ERROR CLASS: Symbol not found for StructuredResponse<T>>
Link copied to clipboard

Sends a request to the language model without utilizing any tools and returns multiple responses.

suspend fun requestLLMWithoutTools(): ai/koog/prompt/message/Message.Assistant

Sends a request to the language model without utilizing any tools and returns multiple responses.

Sends a request to the language model without utilizing any tools and returns multiple responses.

Link copied to clipboard
fun requestLLMWithoutToolsBlocking(): ERROR CLASS: Symbol not found for Message.Assistant
Link copied to clipboard
suspend fun requestModeration(moderatingModel: LLModel? = null): ModerationResult

Sends a moderation request to the specified or default model.

suspend fun requestModeration(moderatingModel: ai/koog/prompt/llm/LLModel?? = null): ai/koog/prompt/dsl/ModerationResult

Sends a moderation request to the specified or default model.

suspend fun requestModeration(moderatingModel: LLModel? = null): ModerationResult

Sends a moderation request to the specified or default model.

Link copied to clipboard
fun requestModerationBlocking(moderatingModel: ERROR CLASS: Symbol not found for LLModel?? = null): ERROR CLASS: Symbol not found for ModerationResult