Class SuspendedResponse<T>
java.lang.Object
dev.langchain4j.agentic.internal.DeferredResponse<T>
dev.langchain4j.agentic.internal.SuspendedResponse<T>
- Type Parameters:
T- the type of the response value
- All Implemented Interfaces:
DelayedResponse<T>
A
DeferredResponse that suspends the agentic system instead of blocking.
When the agentic system encounters this response, it checkpoints its state (if a
AgenticScopeStore is configured) and throws
AgenticSystemSuspendedException, releasing the
calling thread. The system can be resumed later by completing the response via
AgenticScope.completePendingResponse(String, Object)
and re-invoking the agent method with the same memory ID.
Usage with HumanInTheLoop:
HumanInTheLoop.builder()
.responseProvider(scope -> new SuspendedResponse<>("user-approval"))
.build();
// After suspension, from an external system:
scope.completePendingResponse("user-approval", "approved");
// Then re-invoke the agent method with the same memory ID
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class DeferredResponse
blockingGet, blockingGet, complete, completeExceptionally, isDone, responseId, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface DelayedResponse
result
-
Constructor Details
-
SuspendedResponse
-