Record Class AgentExecutor
java.lang.Object
java.lang.Record
dev.langchain4j.agentic.internal.AgentExecutor
- All Implemented Interfaces:
InternalAgent, AgentInstance
public record AgentExecutor(AgentInvoker agentInvoker, Object agent)
extends Record
implements AgentInstance, InternalAgent
-
Constructor Summary
ConstructorsConstructorDescriptionAgentExecutor(AgentInvoker agentInvoker, Object agent) Creates an instance of aAgentExecutorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionThe condition under which this agent runs when it is invoked as a subagent, ornullwhen it always runs.agent()Returns the value of theagentrecord component.agentId()Returns the value of theagentInvokerrecord component.void<T extends AgentInstance>
Tbooleanasync()booleanvoidfinal booleanIndicates whether some other object is "equal to" this one.execute(DefaultAgenticScope agenticScope, PlannerExecutor planner) final inthashCode()Returns a hash code value for this object.listener()name()booleanoptional()parent()voidregisterInheritedParentListener(AgentListener parentListener) voidsetParent(InternalAgent parent) syncExecute(DefaultAgenticScope agenticScope, PlannerExecutor planner) topology()final StringtoString()Returns a string representation of this record class.Class<?> type()Methods inherited from interface AgentInstance
leafMethods inherited from interface InternalAgent
allowChatMemory, allowStreamingOutput, setAgentId
-
Constructor Details
-
AgentExecutor
Creates an instance of aAgentExecutorrecord class.- Parameters:
agentInvoker- the value for theagentInvokerrecord componentagent- the value for theagentrecord component
-
-
Method Details
-
execute
-
syncExecute
-
type
- Specified by:
typein interfaceAgentInstance
-
plannerType
- Specified by:
plannerTypein interfaceAgentInstance
-
name
- Specified by:
namein interfaceAgentInstance
-
agentId
- Specified by:
agentIdin interfaceAgentInstance
-
description
- Specified by:
descriptionin interfaceAgentInstance
-
outputType
- Specified by:
outputTypein interfaceAgentInstance
-
outputKey
- Specified by:
outputKeyin interfaceAgentInstance
-
arguments
- Specified by:
argumentsin interfaceAgentInstance
-
subagents
- Specified by:
subagentsin interfaceAgentInstance
-
async
public boolean async()- Specified by:
asyncin interfaceAgentInstance
-
optional
public boolean optional()- Specified by:
optionalin interfaceAgentInstance
-
activationCondition
Description copied from interface:AgentInstanceThe condition under which this agent runs when it is invoked as a subagent, ornullwhen it always runs. When the condition is false, the agent is skipped: it is not invoked, it writes nothing to theAgenticScopeand its parent's planner is notified of the skip. The condition is ignored when the agent is invoked directly, as the root of an agentic system.The condition can be evaluated more than once for a single invocation, by the planner of the parent while selecting its next agents and again when the agent is invoked, so it must be cheap and free of side effects.
- Specified by:
activationConditionin interfaceAgentInstance
-
topology
- Specified by:
topologyin interfaceAgentInstance
-
parent
- Specified by:
parentin interfaceAgentInstance
-
setParent
- Specified by:
setParentin interfaceInternalAgent
-
compensateOnError
public boolean compensateOnError()- Specified by:
compensateOnErrorin interfaceInternalAgent
-
enableCrossAgentCompensation
public void enableCrossAgentCompensation()- Specified by:
enableCrossAgentCompensationin interfaceInternalAgent
-
registerInheritedParentListener
- Specified by:
registerInheritedParentListenerin interfaceInternalAgent
-
appendId
- Specified by:
appendIdin interfaceInternalAgent
-
listener
- Specified by:
listenerin interfaceInternalAgent
-
as
- Specified by:
asin interfaceAgentInstance
-
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). -
agentInvoker
Returns the value of theagentInvokerrecord component.- Returns:
- the value of the
agentInvokerrecord component
-
agent
Returns the value of theagentrecord component.- Returns:
- the value of the
agentrecord component
-