Interface AgentResolver


public interface AgentResolver
Interface for resolving agents from various sources.

This interface abstracts the agent resolution logic, allowing different implementations for different scenarios (e.g., simple registry lookup, session-based resolution with memory management).

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    hasMemory(io.agentscope.core.agent.RuntimeContext runtimeContext)
    Check if a thread has existing memory/conversation history.
    io.agentscope.core.agent.Agent
    resolveAgent(String agentId, String threadId)
    Resolve an agent by its ID and thread ID.
    default io.agentscope.core.agent.Agent
    resolveAgent(String agentId, String threadId, String userId)
    Resolve an agent by its ID, thread ID and user ID.
  • Method Details

    • resolveAgent

      io.agentscope.core.agent.Agent resolveAgent(String agentId, String threadId)
      Resolve an agent by its ID and thread ID.
      Parameters:
      agentId - The agent ID to resolve
      threadId - The thread ID for session management
      Returns:
      The resolved agent
      Throws:
      AguiException.AgentNotFoundException - if the agent is not found
    • resolveAgent

      default io.agentscope.core.agent.Agent resolveAgent(String agentId, String threadId, String userId)
      Resolve an agent by its ID, thread ID and user ID.

      The default implementation ignores userId. Session-aware resolvers should override this so tenants with the same thread id do not share an agent instance.

      Parameters:
      agentId - The agent ID to resolve
      threadId - The thread ID for session management
      userId - The user ID, may be null for anonymous
      Returns:
      The resolved agent
      Throws:
      AguiException.AgentNotFoundException - if the agent is not found
    • hasMemory

      boolean hasMemory(io.agentscope.core.agent.RuntimeContext runtimeContext)
      Check if a thread has existing memory/conversation history.

      This is used to determine whether to use frontend-provided history or rely on server-side memory.

      Parameters:
      runtimeContext - The runtime context identifying the thread and user
      Returns:
      true if the thread has existing memory