Record Class AgentTrace

java.lang.Object
java.lang.Record
dev.dokimos.core.agents.AgentTrace
Record Components:
finalResponse - the agent's final text response
toolCalls - all tool calls made during execution
reasoningSteps - optional reasoning/thought steps
metadata - latency, token usage, and other metadata

public record AgentTrace(String finalResponse, List<ToolCall> toolCalls, List<String> reasoningSteps, Map<String,Object> metadata) extends Record
Wraps a complete agent execution trace for evaluation.

Contains the agent's final text response, all tool calls made during execution, optional reasoning steps, and metadata such as latency and token usage.

The toOutputMap() method converts the trace to a map suitable for returning from a Task implementation.

  • Constructor Details

    • AgentTrace

      public AgentTrace(String finalResponse, List<ToolCall> toolCalls, List<String> reasoningSteps, Map<String,Object> metadata)
      Creates an instance of a AgentTrace record class.
      Parameters:
      finalResponse - the value for the finalResponse record component
      toolCalls - the value for the toolCalls record component
      reasoningSteps - the value for the reasoningSteps record component
      metadata - the value for the metadata record component
  • Method Details

    • toOutputMap

      public Map<String,Object> toOutputMap()
      Converts this agent trace to a map suitable for use as actualOutputs in an EvalTestCase.
      Returns:
      a map with keys "output", "toolCalls", and "reasoningSteps"
    • toolNames

      public Set<String> toolNames()
      Returns the set of tool names used in this trace.
      Returns:
      set of tool names
    • builder

      public static AgentTrace.Builder builder()
      Creates a new builder for constructing agent traces.
      Returns:
      a new builder
    • 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.
    • finalResponse

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

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

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

      public Map<String,Object> metadata()
      Returns the value of the metadata record component.
      Returns:
      the value of the metadata record component