Class A2ATaskInterruptedException

All Implemented Interfaces:
Serializable

public class A2ATaskInterruptedException extends LangChain4jException
Thrown when an A2A task enters an interrupted state (input-required or auth-required) instead of completing.

The remote agent has paused the task and is waiting for additional input or authentication before it can continue. The A2A server will not advance the task on its own, so the CompletableFuture backing the invocation is completed exceptionally with this exception rather than left pending indefinitely.

Since:
1.19.0
See Also:
  • Constructor Details

    • A2ATaskInterruptedException

      public A2ATaskInterruptedException(String taskId, org.a2aproject.sdk.spec.TaskState state, String reason)
    • A2ATaskInterruptedException

      public A2ATaskInterruptedException(String taskId, String contextId, org.a2aproject.sdk.spec.TaskState state, String reason)
  • Method Details

    • taskId

      public String taskId()
      The id of the task that was interrupted.
      Since:
      1.19.0
    • contextId

      public String contextId()
      The id of the context containing the interrupted task. This can be used together with taskId() when sending the input or authentication needed to resume the task.
      Since:
      1.19.0
    • state

      public org.a2aproject.sdk.spec.TaskState state()
      The interrupted state the task is in, either TASK_STATE_INPUT_REQUIRED or TASK_STATE_AUTH_REQUIRED.
      Since:
      1.19.0
    • reason

      public String reason()
      The status message sent by the remote agent when it interrupted the task — typically the question asking for the missing input, or the authentication challenge. Returns null when the remote agent interrupted the task without sending one; the generic description used in Throwable.getMessage() in that case is not reported here, so callers can tell the two apart.
      Since:
      1.19.0
    • from

      public static A2ATaskInterruptedException from(AgenticScope scope, String responseId)
      Reconstructs the A2A interruption associated with a pending response in an agentic scope. This allows an external event handler to publish the remote task details before completing the pending response asynchronously.
      Parameters:
      scope - the suspended agentic scope
      responseId - the pending response identifier
      Returns:
      the matching A2A task interruption
      Throws:
      IllegalArgumentException - if the response does not belong to an interrupted A2A task
      Since:
      1.19.0