Record Class PlanningContext
java.lang.Object
java.lang.Record
dev.langchain4j.agentic.planner.PlanningContext
public record PlanningContext(AgenticScope agenticScope, AgentInvocation previousAgentInvocation)
extends Record
-
Constructor Summary
ConstructorsConstructorDescriptionPlanningContext(AgenticScope agenticScope, AgentInvocation previousAgentInvocation) Creates an instance of aPlanningContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theagenticScoperecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisActive(AgentInstance agent) Tells whether the given subagent would run if it were invoked now, according to itsactivation condition.Returns the value of thepreviousAgentInvocationrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PlanningContext
Creates an instance of aPlanningContextrecord class.- Parameters:
agenticScope- the value for theagenticScoperecord componentpreviousAgentInvocation- the value for thepreviousAgentInvocationrecord component
-
-
Method Details
-
isActive
Tells whether the given subagent would run if it were invoked now, according to itsactivation condition. A planner never needs this for correctness, because an inactive agent is skipped when invoked anyway, but a planner selecting its candidates from the state of theAgenticScopecan use it to avoid selecting inactive agents.The condition is evaluated each time this method is called and once more when the agent is invoked, so the agent can still be skipped if the state changed in between: the planner must handle a
skippedinvocation anyway. A condition throwing an exception is considered to hold here, so that the failure is raised, and handled by the error handler, when the agent is invoked.- Parameters:
agent- a subagent of the planner- Returns:
trueif the agent has no activation condition, was already activated, or its condition holds
-
toString
-
hashCode
-
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). -
agenticScope
Returns the value of theagenticScoperecord component.- Returns:
- the value of the
agenticScoperecord component
-
previousAgentInvocation
Returns the value of thepreviousAgentInvocationrecord component.- Returns:
- the value of the
previousAgentInvocationrecord component
-