Class PendingResponse<T>

java.lang.Object
dev.langchain4j.agentic.internal.DeferredResponse<T>
dev.langchain4j.agentic.internal.PendingResponse<T>
Type Parameters:
T - the type of the response value
All Implemented Interfaces:
DelayedResponse<T>

public class PendingResponse<T> extends DeferredResponse<T>
A DeferredResponse that blocks the calling thread until completed.

When the agentic system encounters this response via readState(), the calling thread blocks on the underlying CompletableFuture until DeferredResponse.complete(Object) is called externally. This is the default behavior for human-in-the-loop agents that do not require crash-resilient suspension.

Usage with HumanInTheLoop:

HumanInTheLoop.builder()
    .responseProvider(scope -> new PendingResponse<>("user-approval"))
    .build();

// From another thread:
scope.completePendingResponse("user-approval", "approved");
See Also:
  • Constructor Details

    • PendingResponse

      public PendingResponse(String responseId)