AgentEvent

org.llm4s.agent.streaming.AgentEvent
See theAgentEvent companion trait
object AgentEvent

Attributes

Companion
trait
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
AgentEvent.type

Members list

Type members

Classlikes

final case class AgentCompleted(finalState: AgentState, totalSteps: Int, durationMs: Long, timestamp: Instant) extends AgentEvent

Agent execution completed successfully.

Agent execution completed successfully.

Value parameters

durationMs

Total execution time in milliseconds

finalState

The final agent state

timestamp

When execution completed

totalSteps

Total number of steps taken

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all
final case class AgentFailed(error: LLMError, stepNumber: Option[Int], timestamp: Instant) extends AgentEvent

Agent execution failed.

Agent execution failed.

Value parameters

error

The error that caused failure

stepNumber

Step where failure occurred (if known)

timestamp

When failure occurred

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all
final case class AgentStarted(query: String, toolCount: Int, timestamp: Instant) extends AgentEvent

Agent execution started.

Agent execution started.

Value parameters

query

The user's query

timestamp

When execution started

toolCount

Number of tools available

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all
final case class HandoffCompleted(targetAgentName: String, success: Boolean, timestamp: Instant) extends AgentEvent

Handoff completed - control returned from target agent.

Handoff completed - control returned from target agent.

Value parameters

success

Whether the target agent succeeded

targetAgentName

Name of the agent that handled the request

timestamp

When handoff completed

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all
final case class HandoffStarted(targetAgentName: String, reason: Option[String], preserveContext: Boolean, timestamp: Instant) extends AgentEvent

Agent is handing off to another agent.

Agent is handing off to another agent.

Value parameters

preserveContext

Whether context is being transferred

reason

Reason for the handoff (if provided)

targetAgentName

Name/description of the target agent

timestamp

When handoff was initiated

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all
final case class InputGuardrailCompleted(guardrailName: String, passed: Boolean, timestamp: Instant) extends AgentEvent

Input guardrail validation completed.

Input guardrail validation completed.

Value parameters

guardrailName

Name of the guardrail

passed

Whether validation passed

timestamp

When validation completed

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all
final case class InputGuardrailStarted(guardrailName: String, timestamp: Instant) extends AgentEvent

Input guardrail validation started.

Input guardrail validation started.

Value parameters

guardrailName

Name of the guardrail

timestamp

When validation started

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all
final case class OutputGuardrailCompleted(guardrailName: String, passed: Boolean, timestamp: Instant) extends AgentEvent

Output guardrail validation completed.

Output guardrail validation completed.

Value parameters

guardrailName

Name of the guardrail

passed

Whether validation passed

timestamp

When validation completed

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all
final case class OutputGuardrailStarted(guardrailName: String, timestamp: Instant) extends AgentEvent

Output guardrail validation started.

Output guardrail validation started.

Value parameters

guardrailName

Name of the guardrail

timestamp

When validation started

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all
final case class StepCompleted(stepNumber: Int, hasToolCalls: Boolean, timestamp: Instant) extends AgentEvent

An execution step completed.

An execution step completed.

Value parameters

hasToolCalls

Whether this step produced tool calls

stepNumber

Zero-based step index

timestamp

When the step completed

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all
final case class StepStarted(stepNumber: Int, timestamp: Instant) extends AgentEvent

A new execution step started.

A new execution step started.

An agent may take multiple steps when tools are involved: Step 0: Initial LLM call Step 1: Process tool results Step N: Continue until complete

Value parameters

stepNumber

Zero-based step index

timestamp

When the step started

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all
final case class TextComplete(fullText: String, timestamp: Instant) extends AgentEvent

Text generation for the current step completed.

Text generation for the current step completed.

Value parameters

fullText

The complete generated text for this step

timestamp

When generation completed

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all
final case class TextDelta(delta: String, timestamp: Instant) extends AgentEvent

A chunk of text was generated by the LLM.

A chunk of text was generated by the LLM.

These events are emitted in real-time during streaming generation, allowing incremental display to users.

Value parameters

delta

The text chunk (may be partial words)

timestamp

When the chunk was received

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all
final case class ToolCallCompleted(toolCallId: String, toolName: String, result: String, success: Boolean, durationMs: Long, timestamp: Instant) extends AgentEvent

A tool call completed execution.

A tool call completed execution.

Value parameters

durationMs

Execution time in milliseconds

result

The result returned by the tool (as string)

success

Whether the tool executed successfully

timestamp

When the tool completed

toolCallId

Unique identifier matching the start event

toolName

Name of the tool that was invoked

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all
final case class ToolCallFailed(toolCallId: String, toolName: String, error: String, timestamp: Instant) extends AgentEvent

A tool call failed during execution.

A tool call failed during execution.

Value parameters

error

Description of the failure

timestamp

When the failure occurred

toolCallId

Unique identifier matching the start event

toolName

Name of the tool that failed

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all
final case class ToolCallStarted(toolCallId: String, toolName: String, arguments: String, timestamp: Instant) extends AgentEvent

A tool call was requested by the LLM.

A tool call was requested by the LLM.

Emitted when the LLM decides to invoke a tool. The tool has not yet been executed at this point.

Value parameters

arguments

JSON string of arguments passed to the tool

timestamp

When the tool call was requested

toolCallId

Unique identifier for this tool call

toolName

Name of the tool being invoked

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait AgentEvent
class Object
trait Matchable
class Any
Show all

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def agentCompleted(finalState: AgentState, totalSteps: Int, durationMs: Long): AgentCompleted

Create an AgentCompleted event with current timestamp.

Create an AgentCompleted event with current timestamp.

Attributes

def agentFailed(error: LLMError, stepNumber: Option[Int]): AgentFailed

Create an AgentFailed event with current timestamp.

Create an AgentFailed event with current timestamp.

Attributes

def agentStarted(query: String, toolCount: Int): AgentStarted

Create an AgentStarted event with current timestamp.

Create an AgentStarted event with current timestamp.

Attributes

def stepCompleted(stepNumber: Int, hasToolCalls: Boolean): StepCompleted

Create a StepCompleted event with current timestamp.

Create a StepCompleted event with current timestamp.

Attributes

def stepStarted(stepNumber: Int): StepStarted

Create a StepStarted event with current timestamp.

Create a StepStarted event with current timestamp.

Attributes

def textComplete(fullText: String): TextComplete

Create a TextComplete event with current timestamp.

Create a TextComplete event with current timestamp.

Attributes

def textDelta(delta: String): TextDelta

Create a TextDelta event with current timestamp.

Create a TextDelta event with current timestamp.

Attributes

def toolCompleted(toolCallId: String, toolName: String, result: String, success: Boolean, durationMs: Long): ToolCallCompleted

Create a ToolCallCompleted event with current timestamp.

Create a ToolCallCompleted event with current timestamp.

Attributes

def toolStarted(toolCallId: String, toolName: String, arguments: String): ToolCallStarted

Create a ToolCallStarted event with current timestamp.

Create a ToolCallStarted event with current timestamp.

Attributes