Class PlannerModelResponse

java.lang.Object
dev.langchain4j.agentic.observability.PlannerModelResponse

public final class PlannerModelResponse extends Object
The token usage and the model name of the response of a model called by the planner of an agent, like the one a supervisor asks which subagent to invoke next or the decision model of a decision router, reported to AgentListener.onPlannerModelResponse(PlannerModelResponse) when the planner receives that response. These are the model calls that the planner makes itself and reports through reportChatModelResponse or reportDecisionModelResponse, and not the ones of its subagents, which are reported by their own invocations.
  • Constructor Details

    • PlannerModelResponse

      public PlannerModelResponse(AgenticScope agenticScope, AgentInstance agent, @Nullable TokenUsage tokenUsage, @Nullable String modelName)
      Parameters:
      agenticScope - the scope of the agentic system running the planner
      agent - the agent whose planner called the model
      tokenUsage - the token usage of this model call, or null if the provider didn't report it
      modelName - the name of the model that answered this call, or null if the provider didn't report it
  • Method Details

    • agenticScope

      public AgenticScope agenticScope()
    • agent

      public AgentInstance agent()
    • tokenUsage

      public @Nullable TokenUsage tokenUsage()
      Returns the token usage of this model call, or null if the provider didn't report it.
    • modelName

      public @Nullable String modelName()
      Returns the name of the model that answered this call, or null if the provider didn't report it.
    • agentName

      public String agentName()
    • agentId

      public String agentId()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object