Record Class AgentInvocationResult

java.lang.Object
java.lang.Record
com.agentforge4j.runtime.llm.AgentInvocationResult
Record Components:
rawResponse - raw model output text before command parsing
commands - parsed commands from the response
modelUsed - the concrete model the provider ran; sourced from LlmExecutionResponse.modelUsed(); nullable — absent when invocation did not go through an LLM (e.g. test doubles) or when the provider did not report it
tokenUsage - token counts for this invocation; sourced from LlmExecutionResponse.tokenUsage(); nullable — absent when invocation did not go through an LLM or when the provider did not report usage
resolvedModel - the model string the runtime resolved and sent on the request; non-null for ModelSource.PIN and ModelSource.TIER, null for ModelSource.PROVIDER_DEFAULT (no model was sent)
modelSource - how resolvedModel was determined; never null
requestedModelTier - the capability tier requested for this call (step tier overriding agent tier), or null when no tier applied

public record AgentInvocationResult(String rawResponse, List<LlmCommand> commands, String modelUsed, TokenUsageReport tokenUsage, String resolvedModel, ModelSource modelSource, ModelTier requestedModelTier) extends Record
The parsed result of a single LLM call: the raw response text plus the parsed list of commands.

Keeping the raw text alongside the commands allows the runtime to record the original output on the event log for auditing, even after the structured commands have been applied.

  • Constructor Details

  • Method Details

    • builder

      public static AgentInvocationResult.Builder builder()
      Returns a new AgentInvocationResult.Builder for assembling an AgentInvocationResult without positional arguments. The tier-resolution metadata is optional: modelSource defaults to ModelSource.PROVIDER_DEFAULT and both resolvedModel and requestedModelTier default to null, so callers on non-LLM paths (chiefly tests) only set the four core components. Required fields are validated when AgentInvocationResult.Builder.build() is called.
      Returns:
      new builder; never null
    • 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.
    • rawResponse

      public String rawResponse()
      Returns the value of the rawResponse record component.
      Returns:
      the value of the rawResponse record component
    • commands

      public List<LlmCommand> commands()
      Returns the value of the commands record component.
      Returns:
      the value of the commands record component
    • modelUsed

      public String modelUsed()
      Returns the value of the modelUsed record component.
      Returns:
      the value of the modelUsed record component
    • tokenUsage

      public TokenUsageReport tokenUsage()
      Returns the value of the tokenUsage record component.
      Returns:
      the value of the tokenUsage record component
    • resolvedModel

      public String resolvedModel()
      Returns the value of the resolvedModel record component.
      Returns:
      the value of the resolvedModel record component
    • modelSource

      public ModelSource modelSource()
      Returns the value of the modelSource record component.
      Returns:
      the value of the modelSource record component
    • requestedModelTier

      public ModelTier requestedModelTier()
      Returns the value of the requestedModelTier record component.
      Returns:
      the value of the requestedModelTier record component