Class BetaManagedAgentsWorkflowRunResult
-
- All Implemented Interfaces:
public final class BetaManagedAgentsWorkflowRunResultHow a workflow run ended.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaManagedAgentsWorkflowRunResult.VisitorAn interface that defines how to map each variant of BetaManagedAgentsWorkflowRunResult to a value of type T.
public final classBetaManagedAgentsWorkflowRunResult.Type
-
Method Summary
Modifier and Type Method Description final Optional<BetaManagedAgentsWorkflowRunResultCompleted>completed()The run's plan, a program that the agent wrote, finished. final Optional<BetaManagedAgentsWorkflowRunResultError>error()The run failed or reached its time limit. final Optional<BetaManagedAgentsWorkflowRunResultStopped>stopped()The agent stopped the run. final Optional<JsonValue>_json()final BetaManagedAgentsWorkflowRunResult.Typetype()final BooleanisCompleted()final BooleanisError()final BooleanisStopped()final BetaManagedAgentsWorkflowRunResultCompletedasCompleted()The run's plan, a program that the agent wrote, finished. final BetaManagedAgentsWorkflowRunResultErrorasError()The run failed or reached its time limit. final BetaManagedAgentsWorkflowRunResultStoppedasStopped()The agent stopped the run. final <T extends Any> Taccept(BetaManagedAgentsWorkflowRunResult.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaManagedAgentsWorkflowRunResultvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaManagedAgentsWorkflowRunResultofCompleted(BetaManagedAgentsWorkflowRunResultCompleted completed)The run's plan, a program that the agent wrote, finished. final static BetaManagedAgentsWorkflowRunResultofError(BetaManagedAgentsWorkflowRunResultError error)The run failed or reached its time limit. final static BetaManagedAgentsWorkflowRunResultofError(BetaManagedAgentsWorkflowRunError error)Returns an immutable instance of BetaManagedAgentsWorkflowRunResult whose ofError variant is built from the given required error. final static BetaManagedAgentsWorkflowRunResultofError(BetaManagedAgentsTimeoutWorkflowRunError timeout)Alias for calling ofError with BetaManagedAgentsWorkflowRunError.ofTimeout(timeout).final static BetaManagedAgentsWorkflowRunResultofError(BetaManagedAgentsProgramWorkflowRunError program)Alias for calling ofError with BetaManagedAgentsWorkflowRunError.ofProgram(program).final static BetaManagedAgentsWorkflowRunResultofError(BetaManagedAgentsUnknownWorkflowRunError unknown)Alias for calling ofError with BetaManagedAgentsWorkflowRunError.ofUnknown(unknown).final static BetaManagedAgentsWorkflowRunResultofError(BetaManagedAgentsThreadLimitWorkflowRunError threadLimit)Alias for calling ofError with BetaManagedAgentsWorkflowRunError.ofThreadLimit(threadLimit).final static BetaManagedAgentsWorkflowRunResultofError(BetaManagedAgentsMaxWorkflowRunsWorkflowRunError maxWorkflowRuns)Alias for calling ofError with BetaManagedAgentsWorkflowRunError.ofMaxWorkflowRuns(maxWorkflowRuns).final static BetaManagedAgentsWorkflowRunResultofStopped(BetaManagedAgentsWorkflowRunResultStopped stopped)The agent stopped the run. -
-
Method Detail
-
completed
final Optional<BetaManagedAgentsWorkflowRunResultCompleted> completed()
The run's plan, a program that the agent wrote, finished. This does not say whether the work succeeded.
-
error
final Optional<BetaManagedAgentsWorkflowRunResultError> error()
The run failed or reached its time limit.
-
stopped
final Optional<BetaManagedAgentsWorkflowRunResultStopped> stopped()
The agent stopped the run.
-
type
final BetaManagedAgentsWorkflowRunResult.Type type()
-
isCompleted
final Boolean isCompleted()
-
asCompleted
final BetaManagedAgentsWorkflowRunResultCompleted asCompleted()
The run's plan, a program that the agent wrote, finished. This does not say whether the work succeeded.
-
asError
final BetaManagedAgentsWorkflowRunResultError asError()
The run failed or reached its time limit.
-
asStopped
final BetaManagedAgentsWorkflowRunResultStopped asStopped()
The agent stopped the run.
-
accept
final <T extends Any> T accept(BetaManagedAgentsWorkflowRunResult.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.anthropic.core.JsonValue; import java.util.Optional; Optional<String> result = betaManagedAgentsWorkflowRunResult.accept(new BetaManagedAgentsWorkflowRunResult.Visitor<Optional<String>>() { @Override public Optional<String> visitCompleted(BetaManagedAgentsWorkflowRunResultCompleted completed) { return Optional.of(completed.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaManagedAgentsWorkflowRunResult validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofCompleted
final static BetaManagedAgentsWorkflowRunResult ofCompleted(BetaManagedAgentsWorkflowRunResultCompleted completed)
The run's plan, a program that the agent wrote, finished. This does not say whether the work succeeded.
-
ofError
final static BetaManagedAgentsWorkflowRunResult ofError(BetaManagedAgentsWorkflowRunResultError error)
The run failed or reached its time limit.
-
ofError
final static BetaManagedAgentsWorkflowRunResult ofError(BetaManagedAgentsWorkflowRunError error)
Returns an immutable instance of BetaManagedAgentsWorkflowRunResult whose ofError variant is built from the given required error.
-
ofError
final static BetaManagedAgentsWorkflowRunResult ofError(BetaManagedAgentsTimeoutWorkflowRunError timeout)
Alias for calling ofError with
BetaManagedAgentsWorkflowRunError.ofTimeout(timeout).
-
ofError
final static BetaManagedAgentsWorkflowRunResult ofError(BetaManagedAgentsProgramWorkflowRunError program)
Alias for calling ofError with
BetaManagedAgentsWorkflowRunError.ofProgram(program).
-
ofError
final static BetaManagedAgentsWorkflowRunResult ofError(BetaManagedAgentsUnknownWorkflowRunError unknown)
Alias for calling ofError with
BetaManagedAgentsWorkflowRunError.ofUnknown(unknown).
-
ofError
final static BetaManagedAgentsWorkflowRunResult ofError(BetaManagedAgentsThreadLimitWorkflowRunError threadLimit)
Alias for calling ofError with
BetaManagedAgentsWorkflowRunError.ofThreadLimit(threadLimit).
-
ofError
final static BetaManagedAgentsWorkflowRunResult ofError(BetaManagedAgentsMaxWorkflowRunsWorkflowRunError maxWorkflowRuns)
Alias for calling ofError with
BetaManagedAgentsWorkflowRunError.ofMaxWorkflowRuns(maxWorkflowRuns).
-
ofStopped
final static BetaManagedAgentsWorkflowRunResult ofStopped(BetaManagedAgentsWorkflowRunResultStopped stopped)
The agent stopped the run.
-
-
-
-