Class MessagesAgentHook

java.lang.Object
com.alibaba.cloud.ai.graph.agent.hook.messages.MessagesAgentHook
All Implemented Interfaces:
Hook, Prioritized
Direct Known Subclasses:
InstructionAgentHook

public abstract class MessagesAgentHook extends Object implements Hook
  • 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

      public void setAgentName(String agentName)
      Description copied from interface: Hook
      Sets the name of the agent that owns this hook. This is typically called by the framework during agent initialization.
      Specified by:
      setAgentName in interface Hook
      Parameters:
      agentName - the agent name, must not be null
    • getAgentName

      public String getAgentName()
      Description copied from interface: Hook
      Gets the name of the agent that owns this hook.
      Specified by:
      getAgentName in interface Hook
      Returns:
      the agent name, or null if not set
    • beforeAgentAction

      public static MessagesAgentHook.BeforeAgentAction beforeAgentAction(MessagesAgentHook hook)
      Creates a BeforeAgentAction instance for the given MessagesAgentHook.
      Parameters:
      hook - the MessagesAgentHook instance to proxy
      Returns:
      a BeforeAgentAction instance
    • afterAgentAction

      public static MessagesAgentHook.AfterAgentAction afterAgentAction(MessagesAgentHook hook)
      Creates an AfterAgentAction instance for the given MessagesAgentHook.
      Parameters:
      hook - the MessagesAgentHook instance to proxy
      Returns:
      an AfterAgentAction instance