Record Class Interaction

Object
Record
akka.javasdk.testkit.eval.Interaction
Record Components:
input - the command sent to the agent, as text. A String command is used as is, any other command is rendered as JSON by asText(java.lang.Object)
userMessage - the user message the agent sent the model, which is what the model saw. The command handler builds it from the command, so it may differ from input. Empty when the trace did not carry it
reply - the agent's reply
toolCalls - in call order
modelCalls - in call order
guardrails - every guardrail evaluation, in order
latency - from the start of the agent command to its end
finalModelText - the text of the last model response, before the agent mapped it into the reply; empty when the trace did not carry it

public record Interaction(String input, String userMessage, String reply, List<ToolCall> toolCalls, List<ModelCall> modelCalls, List<GuardrailResult> guardrails, Duration latency, String finalModelText) extends Record
One turn: the input the agent was given, its reply as text and what the runtime traced while producing it. This is what an Evaluator and a Judge read.
  • Constructor Details

    • Interaction

      public Interaction(String input, String userMessage, String reply, List<ToolCall> toolCalls, List<ModelCall> modelCalls, List<GuardrailResult> guardrails, Duration latency, String finalModelText)
      Creates an instance of a Interaction record class.
      Parameters:
      input - the value for the input record component
      userMessage - the value for the userMessage record component
      reply - the value for the reply record component
      toolCalls - the value for the toolCalls record component
      modelCalls - the value for the modelCalls record component
      guardrails - the value for the guardrails record component
      latency - the value for the latency record component
      finalModelText - the value for the finalModelText record component
    • Interaction

      public Interaction(String input, String reply, List<ToolCall> toolCalls)
      A reply with tool calls only, and no user message in the evidence.
    • Interaction

      public Interaction(String input, String reply, AgentTrace trace)
      A reply with the traced evidence, including the user message the agent sent the model.
  • Method Details

    • of

      public static Interaction of(String input, String reply)
      A reply with no evidence.
    • asked

      public String asked()
      What the agent was asked, as a judge reads it: the user message the agent sent the model when the trace carried it, otherwise the case's command as text.
    • asText

      public static String asText(Object value)
      A command or a reply as the text an evaluator and a judge read. A String is used as is, any other value is rendered as JSON. Null becomes the empty string.
    • inputTokens

      public long inputTokens()
      Input tokens summed over the model calls.
    • outputTokens

      public long outputTokens()
      Output tokens summed over the model calls.
    • totalTokens

      public long totalTokens()
      Input and output tokens together.
    • blocked

      public boolean blocked()
      Whether any guardrail blocked the turn.
    • 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.
    • input

      public String input()
      Returns the value of the input record component.
      Returns:
      the value of the input record component
    • userMessage

      public String userMessage()
      Returns the value of the userMessage record component.
      Returns:
      the value of the userMessage record component
    • reply

      public String reply()
      Returns the value of the reply record component.
      Returns:
      the value of the reply record component
    • toolCalls

      public List<ToolCall> toolCalls()
      Returns the value of the toolCalls record component.
      Returns:
      the value of the toolCalls record component
    • modelCalls

      public List<ModelCall> modelCalls()
      Returns the value of the modelCalls record component.
      Returns:
      the value of the modelCalls record component
    • guardrails

      public List<GuardrailResult> guardrails()
      Returns the value of the guardrails record component.
      Returns:
      the value of the guardrails record component
    • latency

      public Duration latency()
      Returns the value of the latency record component.
      Returns:
      the value of the latency record component
    • finalModelText

      public String finalModelText()
      Returns the value of the finalModelText record component.
      Returns:
      the value of the finalModelText record component