AgentRunEnded

org.llm4s.trace.TraceEvent.AgentRunEnded
case class AgentRunEnded(threadId: String, runId: String, agent: String, status: String, messages: Seq[Message], usage: UsageSummary, timestamp: Instant) extends TraceEvent

An agent run ended. Emitted once per run, from the run's own final state, by the agent's tracing; it carries the turn's conversation for backends that record it (Langfuse turns it into a trace with one span per message). A blocked turn has been removed from the thread by then, so a blocked run carries no messages.

Value parameters

agent

the agent active when the run ended

messages

this turn's messages, from its user message on; empty when blocked, cancelled, timed out or failed. Not included in toJson, which stays a flat summary.

runId

this run

status

completed, suspended, step_limit_reached, blocked:<guardrail>, cancelled, timed_out or failed

threadId

the conversation's thread; backends use it as the session

usage

this run's own token usage and cost, per model: the model calls the run made, never the thread's earlier runs, so a backend can report it per run (as OpenTelemetry's per-operation gen_ai.usage.*) without double counting

Attributes

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

Members list

Value members

Concrete methods

def eventType: String
def toJson: Value

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product