Class ReactAgent


public class ReactAgent extends BaseAgent
  • Constructor Details

  • Method Details

    • builder

      public static Builder builder()
    • builder

      public static Builder builder(AgentBuilderFactory agentBuilderFactory)
    • call

      public org.springframework.ai.chat.messages.AssistantMessage call(String message) throws GraphRunnerException
      Throws:
      GraphRunnerException
    • call

      public org.springframework.ai.chat.messages.AssistantMessage call(String message, RunnableConfig config) throws GraphRunnerException
      Throws:
      GraphRunnerException
    • call

      public org.springframework.ai.chat.messages.AssistantMessage call(org.springframework.ai.chat.messages.UserMessage message) throws GraphRunnerException
      Throws:
      GraphRunnerException
    • call

      public org.springframework.ai.chat.messages.AssistantMessage call(org.springframework.ai.chat.messages.UserMessage message, RunnableConfig config) throws GraphRunnerException
      Throws:
      GraphRunnerException
    • call

      public org.springframework.ai.chat.messages.AssistantMessage call(List<org.springframework.ai.chat.messages.Message> messages) throws GraphRunnerException
      Throws:
      GraphRunnerException
    • call

      public org.springframework.ai.chat.messages.AssistantMessage call(List<org.springframework.ai.chat.messages.Message> messages, RunnableConfig config) throws GraphRunnerException
      Throws:
      GraphRunnerException
    • interrupt

      public void interrupt(RunnableConfig config)
    • interrupt

      public void interrupt(List<org.springframework.ai.chat.messages.Message> messages, RunnableConfig config)
    • interrupt

      public void interrupt(String userMessage, RunnableConfig config)
    • updateAgentState

      public void updateAgentState(Object state, RunnableConfig config)
      Updates the agent thread state with interruption feedback. This method is thread-safe and can be called concurrently with apply() in InterruptionHook. Thread-safety guarantees: - threadIdStateMap is a ConcurrentHashMap, ensuring thread-safe access - computeIfAbsent ensures atomic creation of the inner map if it doesn't exist - The inner map is always a ConcurrentHashMap, ensuring thread-safe put() operations Concurrency behavior: - If called before apply() processes feedback: the new value will be processed - If called after apply() removes feedback: the new value will be set for next iteration - If called concurrently with apply(): the atomic operations ensure no data loss
    • getStateGraph

      public StateGraph getStateGraph()
    • getCompiledGraph

      public CompiledGraph getCompiledGraph()
    • asNode

      public Node asNode(boolean includeContents, boolean returnReasoningContents)
      Specified by:
      asNode in class BaseAgent
    • initGraph

      protected StateGraph initGraph() throws GraphStateException
      Specified by:
      initGraph in class Agent
      Throws:
      GraphStateException
    • instruction

      public String instruction()
    • setInstruction

      public void setInstruction(String instruction)
    • getThreadState

      public Map<String,Object> getThreadState(String threadId)