Interface AgentApi<S>

Type Parameters:
S - the type of custom session state
All Known Implementing Classes:
Agent

public interface AgentApi<S>
AgentApi is the typed facade interface exposed by an agent, providing snapshot retrieval, abort, identification, and chat-client creation.
  • Method Details

    • chat

      AgentChat<S> chat()
      Creates a fresh AgentChat for a new conversation, using a default action context built from the registry the agent was defined in.

      This is the convenience overload for the common case. Use chat(ActionContext) when you need to supply request-scoped context (e.g. auth / user info that tools should observe).

      Returns:
      a new chat
    • chat

      AgentChat<S> chat(AgentInit<S> init)
      Creates an AgentChat seeded from init (snapshotId / sessionId / inline state), using a default action context built from the registry the agent was defined in.
      Parameters:
      init - the seed init (may be null for a fresh chat)
      Returns:
      a new chat
    • loadChat

      AgentChat<S> loadChat(GetSnapshotRequest lookup)
      Loads a snapshot and hydrates an AgentChat whose next send resumes it, using a default action context built from the registry the agent was defined in.
      Parameters:
      lookup - which snapshot to load (by snapshotId or sessionId)
      Returns:
      a hydrated chat
    • chat

      Creates a fresh AgentChat for a new conversation.
      Parameters:
      ctx - the action context used to run each turn
      Returns:
      a new chat
    • chat

      AgentChat<S> chat(ActionContext ctx, AgentInit<S> init)
      Creates an AgentChat seeded from init (snapshotId / sessionId / inline state).
      Parameters:
      ctx - the action context used to run each turn
      init - the seed init (may be null for a fresh chat)
      Returns:
      a new chat
    • loadChat

      AgentChat<S> loadChat(ActionContext ctx, GetSnapshotRequest lookup)
      Loads a snapshot and hydrates an AgentChat whose next send resumes it.
      Parameters:
      ctx - the action context used to run each turn
      lookup - which snapshot to load (by snapshotId or sessionId)
      Returns:
      a hydrated chat
    • getSnapshotData

      SessionSnapshot<S> getSnapshotData(GetSnapshotRequest req)
      Retrieves a session snapshot by snapshot ID or session ID.
      Parameters:
      req - the request specifying which snapshot to retrieve
      Returns:
      the matching session snapshot, or null if not found
    • abort

      SnapshotStatus abort(String snapshotId)
      Attempts to abort a snapshot that is currently in SnapshotStatus.PENDING state.

      If the snapshot is already in a terminal state, returns that state unchanged. If the snapshot does not exist, returns null.

      Parameters:
      snapshotId - the ID of the snapshot to abort
      Returns:
      the resulting SnapshotStatus, or null if the snapshot was not found
    • ref

      AgentRef ref()
      Returns a lightweight reference to this agent.
      Returns:
      an AgentRef carrying the agent's name and description