Class ResultWithAgenticScope<T>
java.lang.Object
dev.langchain4j.agentic.scope.ResultWithAgenticScope<T>
- Type Parameters:
T- The type of the result.
Holds the result of an agent invocation along with its associated
AgenticScope.
This is useful for returning results from agents while also providing access to the cognitive
scope through which that result has been generated.
When the invocation is suspended (suspended() returns true), the caller
can provide the human response and resume in a single call via
completePendingResponse(Object).
-
Constructor Summary
ConstructorsConstructorDescriptionResultWithAgenticScope(AgenticScope agenticScope, T result) ResultWithAgenticScope(AgenticScope agenticScope, T result, boolean suspended) ResultWithAgenticScope(AgenticScope agenticScope, T result, boolean suspended, Supplier<ResultWithAgenticScope<T>> resumeCallback) -
Method Summary
Modifier and TypeMethodDescriptioncompletePendingResponse(Object value) Completes the single pending response and re-invokes the agentic system to resume execution.completePendingResponse(String responseId, Object value) Completes the pending response with the given ID and re-invokes the agentic system to resume execution.booleaninthashCode()result()booleantoString()
-
Constructor Details
-
ResultWithAgenticScope
-
ResultWithAgenticScope
-
ResultWithAgenticScope
public ResultWithAgenticScope(AgenticScope agenticScope, T result, boolean suspended, Supplier<ResultWithAgenticScope<T>> resumeCallback)
-
-
Method Details
-
agenticScope
-
result
-
suspended
public boolean suspended() -
completePendingResponse
Completes the single pending response and re-invokes the agentic system to resume execution. The returned result may itself be suspended if the workflow has further human-in-the-loop steps.- Parameters:
value- the human response value- Returns:
- the result of the resumed invocation
- Throws:
IllegalStateException- if this result is not suspended, if there is not exactly one pending response, or if no resume callback is available (e.g. after a crash/restart)
-
completePendingResponse
Completes the pending response with the given ID and re-invokes the agentic system to resume execution. The returned result may itself be suspended if the workflow has further human-in-the-loop steps.- Parameters:
responseId- the identifier of the pending response to completevalue- the human response value- Returns:
- the result of the resumed invocation
- Throws:
IllegalStateException- if this result is not suspended or if no resume callback is available (e.g. after a crash/restart)
-
equals
-
hashCode
-
toString
-