Class MessagesAgentHook
java.lang.Object
com.alibaba.cloud.ai.graph.agent.hook.messages.MessagesAgentHook
- All Implemented Interfaces:
Hook,Prioritized
- Direct Known Subclasses:
InstructionAgentHook
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInternal static class that proxies MessagesAgentHook and implements AsyncNodeActionWithConfig interface for afterAgent hook.static classInternal static class that proxies MessagesAgentHook and implements AsyncNodeActionWithConfig interface. -
Field Summary
Fields inherited from interface com.alibaba.cloud.ai.graph.agent.Prioritized
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionafterAgent(List<org.springframework.ai.chat.messages.Message> previousMessages, RunnableConfig config) Creates an AfterAgentAction instance for the given MessagesAgentHook.beforeAgent(List<org.springframework.ai.chat.messages.Message> previousMessages, RunnableConfig config) Creates a BeforeAgentAction instance for the given MessagesAgentHook.Gets the name of the agent that owns this hook.voidsetAgentName(String agentName) Sets the name of the agent that owns this hook.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.alibaba.cloud.ai.graph.agent.hook.Hook
canJumpTo, getAgent, getHookPositions, getKeyStrategys, getModelInterceptors, getName, getToolInterceptors, getTools, setAgentMethods inherited from interface com.alibaba.cloud.ai.graph.agent.Prioritized
getOrder
-
Constructor Details
-
MessagesAgentHook
public MessagesAgentHook()
-
-
Method Details
-
beforeAgent
public AgentCommand beforeAgent(List<org.springframework.ai.chat.messages.Message> previousMessages, RunnableConfig config) -
afterAgent
public AgentCommand afterAgent(List<org.springframework.ai.chat.messages.Message> previousMessages, RunnableConfig config) -
setAgentName
Description copied from interface:HookSets the name of the agent that owns this hook. This is typically called by the framework during agent initialization.- Specified by:
setAgentNamein interfaceHook- Parameters:
agentName- the agent name, must not be null
-
getAgentName
Description copied from interface:HookGets the name of the agent that owns this hook.- Specified by:
getAgentNamein interfaceHook- Returns:
- the agent name, or null if not set
-
beforeAgentAction
Creates a BeforeAgentAction instance for the given MessagesAgentHook.- Parameters:
hook- the MessagesAgentHook instance to proxy- Returns:
- a BeforeAgentAction instance
-
afterAgentAction
Creates an AfterAgentAction instance for the given MessagesAgentHook.- Parameters:
hook- the MessagesAgentHook instance to proxy- Returns:
- an AfterAgentAction instance
-