Record Class InteractionRecord

Object
Record
akka.javasdk.ledger.InteractionRecord
Record Components:
interactionId - the globally unique id of the interaction
sessionId - the id of the session the interaction belongs to
agentComponentId - the component id of the agent that produced the interaction
flowId - the id of the flow this interaction was part of, or empty for a request-based agent interaction
metadata - metadata about the model call(s) of the interaction
systemMessage - the system message the model was given
inputMessage - the input message content given to the model, in order
modelResponses - the model call(s) of the interaction, in order
toolCallResponses - tool call responses that arrived as input to a model call
taskContext - autonomous-agent task metadata, present only for flow interactions
failure - the failure that terminated the interaction, if it failed
timestamp - when the interaction was recorded

public record InteractionRecord(String interactionId, String sessionId, String agentComponentId, Optional<String> flowId, InteractionMetadata metadata, String systemMessage, List<MessageContent> inputMessage, List<ModelResponse> modelResponses, List<ToolCallResponse> toolCallResponses, Optional<TaskContext> taskContext, Optional<Failure> failure, Instant timestamp) extends Record
The full record of a single agent interaction, as fetched from the ledger.

Beyond the raw fields, this type offers pure convenience accessors (inputText(), finalResponseText(), toolCalls(), token totals, failureSummary()) and a flattened transcript() rendering, for use when evaluating an interaction.

  • Constructor Details

  • Method Details

    • isFlowInteraction

      public boolean isFlowInteraction()
      Whether this interaction was produced by an agent running as part of a flow.
    • failed

      public boolean failed()
      Whether this interaction terminated in a failure.
    • inputText

      public String inputText()
      The input message rendered as plain text: the text of every MessageContent.TextMessageContent in inputMessage(), joined by newlines. Non-text content (images, PDFs) is omitted.
    • finalResponseText

      public String finalResponseText()
      The text of the last model response that has text, or an empty string when no model response has text. The method returns this text for a failed interaction too, so check failed() first.
    • toolCalls

      public List<ToolCall> toolCalls()
      Every tool call the model requested across all model responses, in order.
    • totalInputTokens

      public int totalInputTokens()
      The total number of input tokens across all model calls of the interaction.
    • totalOutputTokens

      public int totalOutputTokens()
      The total number of output tokens across all model calls of the interaction.
    • failureSummary

      public Optional<String> failureSummary()
      A human-readable summary of the failure that terminated the interaction (reason: description), or empty if the interaction did not fail.
    • transcript

      public String transcript()
      A flattened, ordered, readable transcript of the interaction: the system message, the input message, each model response (including any thinking and tool calls), and the tool call responses the model saw as input. For a failed interaction, the last line is Failure: followed by the text that failureSummary() returns. The transcript of a failed interaction can include content that a guardrail blocked.

      Pure rendering over this record; intended for feeding an interaction to an LLM-as-judge or for logging.

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • interactionId

      public String interactionId()
      Returns the value of the interactionId record component.
      Returns:
      the value of the interactionId record component
    • sessionId

      public String sessionId()
      Returns the value of the sessionId record component.
      Returns:
      the value of the sessionId record component
    • agentComponentId

      public String agentComponentId()
      Returns the value of the agentComponentId record component.
      Returns:
      the value of the agentComponentId record component
    • flowId

      public Optional<String> flowId()
      Returns the value of the flowId record component.
      Returns:
      the value of the flowId record component
    • metadata

      public InteractionMetadata metadata()
      Returns the value of the metadata record component.
      Returns:
      the value of the metadata record component
    • systemMessage

      public String systemMessage()
      Returns the value of the systemMessage record component.
      Returns:
      the value of the systemMessage record component
    • inputMessage

      public List<MessageContent> inputMessage()
      Returns the value of the inputMessage record component.
      Returns:
      the value of the inputMessage record component
    • modelResponses

      public List<ModelResponse> modelResponses()
      Returns the value of the modelResponses record component.
      Returns:
      the value of the modelResponses record component
    • toolCallResponses

      public List<ToolCallResponse> toolCallResponses()
      Returns the value of the toolCallResponses record component.
      Returns:
      the value of the toolCallResponses record component
    • taskContext

      public Optional<TaskContext> taskContext()
      Returns the value of the taskContext record component.
      Returns:
      the value of the taskContext record component
    • failure

      public Optional<Failure> failure()
      Returns the value of the failure record component.
      Returns:
      the value of the failure record component
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component