AgentEvent

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

Events emitted during streaming agent execution.

AgentEvent provides fine-grained visibility into agent execution, enabling real-time UIs, progress tracking, and debugging.

Event categories:

  • Text events: Token-level streaming during LLM generation
  • Tool events: Tool invocation lifecycle
  • Agent lifecycle: Start, step, complete, fail
  • Handoff events: Agent-to-agent delegation

Attributes

Example
agent.runWithEvents(
 query = "What's the weather?",
 tools = weatherTools,
 onEvent = {
   case TextDelta(delta, _) => print(delta)
   case ToolCallStarted(_, name, _, _) => println(s"[Calling $$name]")
   case AgentCompleted(state, _) => println("Done!")
   case _ => // ignore
 }
)
Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def timestamp: Instant

When this event occurred.

When this event occurred.

Attributes