Class AbstractAgentInvoker
java.lang.Object
dev.langchain4j.agentic.internal.AbstractAgentInvoker
- All Implemented Interfaces:
AgentInvoker, InternalAgent, AgentInstance
- Direct Known Subclasses:
MapperAgentInvoker, MethodAgentInvoker, UntypedAgentInvoker
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe condition under which this agent runs when it is invoked as a subagent, ornullwhen it always runs.agentId()void<T extends AgentInstance>
Tbooleanasync()booleanvoidbooleaninthashCode()invoke(DefaultAgenticScope agenticScope, Object agent, AgentInvocationArguments args) Invokes the agent, reports the invocation to its listeners with the response of the model it called, and registers the messages it exchanged in the context of the scope.listener()method()name()booleanoptional()parent()voidregisterInheritedParentListener(AgentListener parentListener) voidsetParent(InternalAgent parent) toInvocationArguments(AgenticScope agenticScope) topology()toString()Class<?> type()Methods inherited from interface AgentInstance
leafMethods inherited from interface InternalAgent
allowChatMemory, allowStreamingOutput, setAgentId
-
Field Details
-
method
-
agent
-
-
Constructor Details
-
AbstractAgentInvoker
-
-
Method Details
-
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
-
toInvocationArguments
public AgentInvocationArguments toInvocationArguments(AgenticScope agenticScope) throws MissingArgumentException - Specified by:
toInvocationArgumentsin interfaceAgentInvoker- Throws:
MissingArgumentException
-
invoke
public Object invoke(DefaultAgenticScope agenticScope, Object agent, AgentInvocationArguments args) throws AgentInvocationException Description copied from interface:AgentInvokerInvokes the agent, reports the invocation to its listeners with the response of the model it called, and registers the messages it exchanged in the context of the scope. Everything happens on the calling thread, which for an asynchronous agent is the thread of its executor.- Specified by:
invokein interfaceAgentInvoker- Throws:
AgentInvocationException
-
listener
- Specified by:
listenerin interfaceInternalAgent
-
topology
- Specified by:
topologyin interfaceAgentInstance
-
method
- Specified by:
methodin interfaceAgentInvoker
-
parent
- Specified by:
parentin interfaceAgentInstance
-
as
- Specified by:
asin interfaceAgentInstance
-
equals
-
hashCode
-
toString
-
compensateOnError
public boolean compensateOnError()- Specified by:
compensateOnErrorin interfaceInternalAgent
-
enableCrossAgentCompensation
public void enableCrossAgentCompensation()- Specified by:
enableCrossAgentCompensationin interfaceInternalAgent
-
setParent
- Specified by:
setParentin interfaceInternalAgent
-
registerInheritedParentListener
- Specified by:
registerInheritedParentListenerin interfaceInternalAgent
-
appendId
- Specified by:
appendIdin interfaceInternalAgent
-