Class A2ATaskInterruptedException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
dev.langchain4j.exception.LangChain4jException
dev.langchain4j.agentic.a2a.A2ATaskInterruptedException
- All Implemented Interfaces:
Serializable
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 Summary
ConstructorsConstructorDescriptionA2ATaskInterruptedException(String taskId, String contextId, org.a2aproject.sdk.spec.TaskState state, String reason) A2ATaskInterruptedException(String taskId, org.a2aproject.sdk.spec.TaskState state, String reason) -
Method Summary
Modifier and TypeMethodDescriptionThe id of the context containing the interrupted task.static A2ATaskInterruptedExceptionfrom(AgenticScope scope, String responseId) Reconstructs the A2A interruption associated with a pending response in an agentic scope.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.org.a2aproject.sdk.spec.TaskStatestate()The interrupted state the task is in, eitherTASK_STATE_INPUT_REQUIREDorTASK_STATE_AUTH_REQUIRED.taskId()The id of the task that was interrupted.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
A2ATaskInterruptedException
-
A2ATaskInterruptedException
-
-
Method Details
-
taskId
-
contextId
-
state
public org.a2aproject.sdk.spec.TaskState state()The interrupted state the task is in, eitherTASK_STATE_INPUT_REQUIREDorTASK_STATE_AUTH_REQUIRED.- Since:
- 1.19.0
-
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. Returnsnullwhen the remote agent interrupted the task without sending one; the generic description used inThrowable.getMessage()in that case is not reported here, so callers can tell the two apart.- Since:
- 1.19.0
-
from
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 scoperesponseId- 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
-