AIAgentLLMWriteSession
A session for managing interactions with a language learning model (LLM) and tools in an agent environment. This class provides functionality for executing LLM requests, managing tools, and customizing prompts dynamically within a specific session context.
JVM actual implementation of a mutable LLM session.
In addition to common suspend APIs, this class exposes Java-friendly wrappers that run session operations on the strategy dispatcher.
A session for managing interactions with a language learning model (LLM) and tools in an agent environment. This class provides functionality for executing LLM requests, managing tools, and customizing prompts dynamically within a specific session context.
Constructors
Properties
Represents the active response processor within the session.
Represents the active response processor within the session.
Represents the active response processor within the session.
Provides a list of available tools in the session.
Provides a list of available tools in the session.
Provides a list of available tools in the session.
Functions
Appends messages to the current prompt using PromptBuilder.
Appends messages to the current prompt using PromptBuilder.
Appends messages to the current prompt using PromptBuilder.
Invokes a tool of the specified type with the provided arguments.
Executes the specified tool with the given arguments and returns the result within a SafeTool.Result wrapper.
Executes a tool by its name with the provided arguments.
Executes a tool operation based on the provided tool class and arguments.
Invokes a specified tool function within the AI Agent's write session context.
Executes a tool identified by its name with the provided arguments and returns the raw string result.
Updates LLM parameters on the current prompt.
Updates LLM parameters on the current prompt.
Updates LLM parameters on the current prompt.
Updates the active model in this session.
Updates the active model in this session.
Updates the active model in this session.
Clears the history of messages in the current AI Agent LLM Write Session.
Clears the history of messages in the current AI Agent LLM Write Session.
Clears the history of messages in the current AI Agent LLM Write Session.
Removes the last n messages from the current prompt in the write session.
Removes the last n messages from the current prompt in the write session.
Removes the last n messages from the current prompt in the write session.
Drops all trailing tool call messages from the current prompt
Drops all trailing tool call messages from the current prompt
Drops all trailing tool call messages from the current prompt
Finds a specific tool instance from the tool registry by a tool instance type.
Finds a specific tool instance from the tool registry by tool class.
Finds a specific tool instance from the tool registry by a tool instance type.
Finds a specific tool instance from the tool registry by tool class.
Finds a tool by its name and ensures its arguments are compatible with the specified type.
Finds and retrieves a tool by its name and argument/result types.
Appends a prompt using the provided prompt update action.
Keeps only the last N messages in the session's prompt by removing all earlier messages.
Keeps only the last N messages in the session's prompt by removing all earlier messages.
Keeps only the last N messages in the session's prompt by removing all earlier messages.
Removes all messages from the current session's prompt that have a timestamp earlier than the specified timestamp.
Removes all messages from the current session's prompt that have a timestamp earlier than the specified timestamp.
Removes all messages from the current session's prompt that have a timestamp earlier than the specified timestamp.
Parses a structured response from an assistant message using the specified configuration.
Parses an assistant response into a strongly typed StructuredResponse according to the given configuration.
Parses a structured response from an assistant message using the specified configuration.
Parses a structured response from an assistant message using the specified configuration.
Rewrites LLM message history, leaving only user message and resulting TLDR.
Rewrites LLM message history, leaving only user message and resulting TLDR.
Rewrites LLM message history, leaving only user message and resulting TLDR.
Sends a request to LLM and appends the response to the prompt.
Sends a request to the language model using the current session configuration and returns a single response.
Sends a request to LLM and appends the response to the prompt.
Sends a request to LLM and appends the response to the prompt.
Sends a request while forcing a specific tool and appends the response to the prompt.
Sends a request to the language model and forces it to use exactly one specific tool instance.
Sends a request to the language model and forces it to use exactly one specific tool, identified by a ToolDescriptor.
Sends a request while forcing a specific tool and appends the response to the prompt.
Sends a request while forcing a specific tool and appends the response to the prompt.
Sends a request to LLM and appends all received responses to the prompt.
Sends a request to the language model and returns multiple responses.
Sends a request to LLM and appends all received responses to the prompt.
Sends a request to LLM and appends all received responses to the prompt.
Sends a request to LLM and returns all available response choices.
Sends a request to the language model and returns multiple choice alternatives.
Sends a request to LLM and returns all available response choices.
Sends a request to LLM and returns all available response choices.
Sends a request that enforces tool calling and appends all received responses to the prompt.
Requests a response from the Language Model (LLM) enforcing tool usage (ToolChoice.Required), validates the session, and processes all returned messages (e.g. thinking + tool call).
Sends a request that enforces tool calling and appends all received responses to the prompt.
Sends a request that enforces tool calling and appends all received responses to the prompt.
Sends a request without tool usage and appends all received responses to the prompt.
Sends a request to the language model without utilizing any tools and returns multiple responses.
Sends a request without tool usage and appends all received responses to the prompt.
Sends a request without tool usage and appends all received responses to the prompt.
Sends a request that enforces tool calling and appends the received response to the prompt.
Sends a request to the language model that is allowed to only perform tool calls without generating a regular text response.
Sends a request that enforces tool calling and appends the received response to the prompt.
Sends a request that enforces tool calling and appends the received response to the prompt.
Sends a streaming request to LLM.
Streams a response from LLM, optionally adding a structure definition to the prompt beforehand.
Sends a request to the language model and returns a streaming response as a Flow of StreamFrame.
Sends a streaming request to LLM.
Streams a response from LLM, optionally adding a structure definition to the prompt beforehand.
Sends a streaming request to LLM.
Streams a response from LLM, optionally adding a structure definition to the prompt beforehand.
Sends a request to LLM and gets a structured response, appending the assistant message on success.
Requests a structured response from the language model using a reified serializer.
Sends a structured request to the language model using a StructuredRequestConfig.
Sends a structured request to the language model using an explicit serializer and example values.
Sends a request to LLM and gets a structured response, appending the assistant message on success.
Requests a structured response from the language model using a reified serializer.
Sends a request to LLM and gets a structured response, appending the assistant message on success.
Requests a structured response from the language model using a reified serializer.
Sends a request without tool usage and appends the received response to the prompt.
Sends a request to the language model without utilizing any tools and returns a single response.
Sends a request without tool usage and appends the received response to the prompt.
Sends a request without tool usage and appends the received response to the prompt.
Sends a moderation request using the specified moderating model or the session model.
Sends a moderation request to the moderation model.
Sends a moderation request using the specified moderating model or the session model.
Sends a moderation request using the specified moderating model or the session model.
Rewrites the current prompt by applying a transformation function.
Rewrites the current prompt by applying a transformation function.
Rewrites the current prompt by applying a transformation function.
Sets the ai.koog.prompt.params.LLMParams.ToolChoice for this LLM session.
Sets the ai.koog.prompt.params.LLMParams.ToolChoice for this LLM session.
Sets the ai.koog.prompt.params.LLMParams.ToolChoice for this LLM session.
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.Auto to make LLM automatically decide between calling tools and generating text
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.Auto to make LLM automatically decide between calling tools and generating text
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.Auto to make LLM automatically decide between calling tools and generating text
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.None to make LLM call one specific tool toolName
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.None to make LLM call one specific tool toolName
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.None to make LLM call one specific tool toolName
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.None to make LLM never call tools
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.None to make LLM never call tools
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.None to make LLM never call tools
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.Required to make LLM always call tools
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.Required to make LLM always call tools
Set the ai.koog.prompt.params.LLMParams.ToolChoice to ai.koog.prompt.params.LLMParams.ToolChoice.Required to make LLM always call tools
Converts each flow item into a parallel tool call using an already resolved SafeTool.
Converts each flow item into a parallel tool call using a tool instance.
Converts each flow item into a parallel tool call using a tool class.
Converts each flow item into a parallel tool call using a tool instance.
Converts each flow item into a parallel tool call using an already resolved SafeTool.
Converts each flow item into a parallel tool call using a tool class.
Converts each flow item into a parallel tool call using an already resolved SafeTool.
Converts each flow item into a parallel tool call using a tool instance.
Converts each flow item into a parallel tool call using a tool class.
Converts each flow item into a parallel tool call and emits only raw string content.
Converts each flow item into a parallel tool call using a tool class and emits raw string content.
Converts each flow item into a parallel tool call and emits only raw string content.
Converts each flow item into a parallel tool call using a tool class and emits raw string content.
Converts each flow item into a parallel tool call and emits only raw string content.
Converts each flow item into a parallel tool call using a tool class and emits raw string content.
Unset the ai.koog.prompt.params.LLMParams.ToolChoice. Mostly, if left unspecified, the default value of this parameter is ai.koog.prompt.params.LLMParams.ToolChoice.Auto
Unset the ai.koog.prompt.params.LLMParams.ToolChoice. Mostly, if left unspecified, the default value of this parameter is ai.koog.prompt.params.LLMParams.ToolChoice.Auto
Unset the ai.koog.prompt.params.LLMParams.ToolChoice. Mostly, if left unspecified, the default value of this parameter is ai.koog.prompt.params.LLMParams.ToolChoice.Auto
Updates the current prompt by applying modifications defined in the provided block.
Updates the current prompt by applying modifications defined in the provided block.
Updates the current prompt by applying modifications defined in the provided block.