Class BetaCodeExecutionToolResultBlockContent
-
- All Implemented Interfaces:
public final class BetaCodeExecutionToolResultBlockContent
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaCodeExecutionToolResultBlockContent.VisitorAn interface that defines how to map each variant of BetaCodeExecutionToolResultBlockContent to a value of type T.
-
Method Summary
-
-
Method Detail
-
error
final Optional<BetaCodeExecutionToolResultError> error()
-
resultBlock
final Optional<BetaCodeExecutionResultBlock> resultBlock()
-
encryptedCodeExecutionResultBlock
final Optional<BetaEncryptedCodeExecutionResultBlock> encryptedCodeExecutionResultBlock()
The output and exit code of Python code that Claude ran with the code execution tool, with standard output in encrypted form.
The API returns this block in place of
code_execution_resultwhen the code called the web search tool.See the programmatic tool calling guide to learn more about programmatic tool calling.
-
content
final Optional<List<BetaCodeExecutionOutputBlock>> content()
-
returnCode
final Optional<Long> returnCode()
-
isResultBlock
final Boolean isResultBlock()
-
isEncryptedCodeExecutionResultBlock
final Boolean isEncryptedCodeExecutionResultBlock()
-
asError
final BetaCodeExecutionToolResultError asError()
-
asResultBlock
final BetaCodeExecutionResultBlock asResultBlock()
-
asEncryptedCodeExecutionResultBlock
final BetaEncryptedCodeExecutionResultBlock asEncryptedCodeExecutionResultBlock()
The output and exit code of Python code that Claude ran with the code execution tool, with standard output in encrypted form.
The API returns this block in place of
code_execution_resultwhen the code called the web search tool.See the programmatic tool calling guide to learn more about programmatic tool calling.
-
accept
final <T extends Any> T accept(BetaCodeExecutionToolResultBlockContent.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 = betaCodeExecutionToolResultBlockContent.accept(new BetaCodeExecutionToolResultBlockContent.Visitor<Optional<String>>() { @Override public Optional<String> visitError(BetaCodeExecutionToolResultError error) { return Optional.of(error.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaCodeExecutionToolResultBlockContent 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.
-
ofError
final static BetaCodeExecutionToolResultBlockContent ofError(BetaCodeExecutionToolResultError error)
-
ofError
final static BetaCodeExecutionToolResultBlockContent ofError(BetaCodeExecutionToolResultErrorCode errorCode)
Returns an immutable instance of BetaCodeExecutionToolResultBlockContent whose ofError variant is built from the given required errorCode.
-
ofResultBlock
final static BetaCodeExecutionToolResultBlockContent ofResultBlock(BetaCodeExecutionResultBlock resultBlock)
-
ofEncryptedCodeExecutionResultBlock
final static BetaCodeExecutionToolResultBlockContent ofEncryptedCodeExecutionResultBlock(BetaEncryptedCodeExecutionResultBlock encryptedCodeExecutionResultBlock)
The output and exit code of Python code that Claude ran with the code execution tool, with standard output in encrypted form.
The API returns this block in place of
code_execution_resultwhen the code called the web search tool.See the programmatic tool calling guide to learn more about programmatic tool calling.
-
-
-
-