Package akka.javasdk.ledger
Record Class InteractionRecord
- Record Components:
interactionId- the globally unique id of the interactionsessionId- the id of the session the interaction belongs toagentComponentId- the component id of the agent that produced the interactionflowId- the id of the flow this interaction was part of, or empty for a request-based agent interactionmetadata- metadata about the model call(s) of the interactionsystemMessage- the system message the model was giveninputMessage- the input message content given to the model, in ordermodelResponses- the model call(s) of the interaction, in ordertoolCallResponses- tool call responses that arrived as input to a model calltaskContext- autonomous-agent task metadata, present only for flow interactionsfailure- the failure that terminated the interaction, if it failedtimestamp- 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 Summary
ConstructorsConstructorDescriptionInteractionRecord(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) Creates an instance of aInteractionRecordrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theagentComponentIdrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanfailed()Whether this interaction terminated in a failure.failure()Returns the value of thefailurerecord component.A human-readable summary of the failure that terminated the interaction (reason: description), or empty if the interaction did not fail.The text of the last model response that has text, or an empty string when no model response has text.flowId()Returns the value of theflowIdrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of theinputMessagerecord component.The input message rendered as plain text: the text of everyMessageContent.TextMessageContentininputMessage(), joined by newlines.Returns the value of theinteractionIdrecord component.booleanWhether this interaction was produced by an agent running as part of a flow.metadata()Returns the value of themetadatarecord component.Returns the value of themodelResponsesrecord component.Returns the value of thesessionIdrecord component.Returns the value of thesystemMessagerecord component.Returns the value of thetaskContextrecord component.Returns the value of thetimestamprecord component.Returns the value of thetoolCallResponsesrecord component.Every tool call the model requested across all model responses, in order.final StringtoString()Returns a string representation of this record class.intThe total number of input tokens across all model calls of the interaction.intThe total number of output tokens across all model calls of the interaction.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.
-
Constructor Details
-
InteractionRecord
public 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) Creates an instance of aInteractionRecordrecord class.- Parameters:
interactionId- the value for theinteractionIdrecord componentsessionId- the value for thesessionIdrecord componentagentComponentId- the value for theagentComponentIdrecord componentflowId- the value for theflowIdrecord componentmetadata- the value for themetadatarecord componentsystemMessage- the value for thesystemMessagerecord componentinputMessage- the value for theinputMessagerecord componentmodelResponses- the value for themodelResponsesrecord componenttoolCallResponses- the value for thetoolCallResponsesrecord componenttaskContext- the value for thetaskContextrecord componentfailure- the value for thefailurerecord componenttimestamp- the value for thetimestamprecord component
-
-
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
The input message rendered as plain text: the text of everyMessageContent.TextMessageContentininputMessage(), joined by newlines. Non-text content (images, PDFs) is omitted. -
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 checkfailed()first. -
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
A human-readable summary of the failure that terminated the interaction (reason: description), or empty if the interaction did not fail. -
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 isFailure:followed by the text thatfailureSummary()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
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
interactionId
Returns the value of theinteractionIdrecord component.- Returns:
- the value of the
interactionIdrecord component
-
sessionId
Returns the value of thesessionIdrecord component.- Returns:
- the value of the
sessionIdrecord component
-
agentComponentId
Returns the value of theagentComponentIdrecord component.- Returns:
- the value of the
agentComponentIdrecord component
-
flowId
Returns the value of theflowIdrecord component.- Returns:
- the value of the
flowIdrecord component
-
metadata
Returns the value of themetadatarecord component.- Returns:
- the value of the
metadatarecord component
-
systemMessage
Returns the value of thesystemMessagerecord component.- Returns:
- the value of the
systemMessagerecord component
-
inputMessage
Returns the value of theinputMessagerecord component.- Returns:
- the value of the
inputMessagerecord component
-
modelResponses
Returns the value of themodelResponsesrecord component.- Returns:
- the value of the
modelResponsesrecord component
-
toolCallResponses
Returns the value of thetoolCallResponsesrecord component.- Returns:
- the value of the
toolCallResponsesrecord component
-
taskContext
Returns the value of thetaskContextrecord component.- Returns:
- the value of the
taskContextrecord component
-
failure
Returns the value of thefailurerecord component.- Returns:
- the value of the
failurerecord component
-
timestamp
Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-