AgentState

org.llm4s.agent.AgentState
See theAgentState companion object
case class AgentState(conversation: Conversation, tools: ToolRegistry, initialQuery: Option[String], status: AgentStatus, logs: Seq[String], systemMessage: Option[SystemMessage], completionOptions: CompletionOptions, availableHandoffs: Seq[Handoff])

Represents the current state of an agent run.

Value parameters

availableHandoffs

Available handoffs for this agent (used for detecting handoff tool calls)

completionOptions

LLM completion options (temperature, maxTokens, etc.)

conversation

The conversation history (without system message - that's in systemMessage field)

initialQuery

The initial user query that started this conversation (optional for multi-turn)

logs

Execution logs for this turn

status

Current agent status (InProgress, WaitingForTools, Complete, or Failed)

systemMessage

The system message (injected at API call time, not stored in conversation)

tools

The available tool registry

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def addMessage(message: Message): AgentState

Adds a message to the conversation and returns a new state

Adds a message to the conversation and returns a new state

Attributes

def addMessages(messages: Seq[Message]): AgentState

Adds multiple messages to the conversation and returns a new state

Adds multiple messages to the conversation and returns a new state

Attributes

def dump(): Unit

Prints a detailed dump of the agent execution state for debugging

Prints a detailed dump of the agent execution state for debugging

Attributes

def log(entry: String): AgentState

Adds a log entry and returns a new state

Adds a log entry and returns a new state

Attributes

Creates a complete conversation by injecting the system message at the beginning. This is used for LLM API calls where system message should be first.

Creates a complete conversation by injecting the system message at the beginning. This is used for LLM API calls where system message should be first.

Attributes

def withStatus(newStatus: AgentStatus): AgentState

Updates the status and returns a new state

Updates the status and returns a new state

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product