Invoke Code Interpreter
| bedrockagentcore_invoke_code_interpreter | R Documentation |
Executes code within an active code interpreter session in Amazon Bedrock AgentCore¶
Description¶
Executes code within an active code interpreter session in Amazon Bedrock AgentCore. This operation processes the provided code, runs it in a secure environment, and returns the execution results including output, errors, and generated visualizations.
To execute code, you must specify the code interpreter identifier, session ID, and the code to run in the arguments parameter. The operation returns a stream containing the execution results, which can include text output, error messages, and data visualizations.
This operation is subject to request rate limiting based on your account's service quotas.
The following operations are related to invoke_code_interpreter:
-
start_code_interpreter_session -
get_code_interpreter_session
Usage¶
bedrockagentcore_invoke_code_interpreter(codeInterpreterIdentifier,
sessionId, traceId, traceParent, name, arguments)
Arguments¶
codeInterpreterIdentifier |
[required] The unique identifier of the code interpreter
associated with the session. This must match the identifier used when
creating the session with
|
sessionId |
The unique identifier of the code interpreter session to use.
This must be an active session created with
|
traceId |
The trace identifier for request tracking. |
traceParent |
The parent trace information for distributed tracing. |
name |
[required] The name of the code interpreter to invoke. |
arguments |
The arguments for the code interpreter. This includes the code to execute and any additional parameters such as the programming language, whether to clear the execution context, and other execution options. The structure of this parameter depends on the specific code interpreter being used. |
Value¶
A list with the following syntax:
list(
sessionId = "string",
stream = list(
result = list(
content = list(
list(
type = "text"|"image"|"resource"|"resource_link",
text = "string",
data = raw,
mimeType = "string",
uri = "string",
name = "string",
description = "string",
size = 123,
resource = list(
type = "text"|"blob",
uri = "string",
mimeType = "string",
text = "string",
blob = raw
)
)
),
structuredContent = list(
taskId = "string",
taskStatus = "submitted"|"working"|"completed"|"canceled"|"failed",
stdout = "string",
stderr = "string",
exitCode = 123,
executionTime = 123.0
),
isError = TRUE|FALSE
),
accessDeniedException = list(
message = "string"
),
conflictException = list(
message = "string"
),
internalServerException = list(
message = "string"
),
resourceNotFoundException = list(
message = "string"
),
serviceQuotaExceededException = list(
message = "string"
),
throttlingException = list(
message = "string"
),
validationException = list(
message = "string",
reason = "CannotParse"|"FieldValidationFailed"|"IdempotentParameterMismatchException"|"EventInOtherSession"|"ResourceConflict",
fieldList = list(
list(
name = "string",
message = "string"
)
)
)
)
)
Request syntax¶
svc$invoke_code_interpreter(
codeInterpreterIdentifier = "string",
sessionId = "string",
traceId = "string",
traceParent = "string",
name = "executeCode"|"executeCommand"|"readFiles"|"listFiles"|"removeFiles"|"writeFiles"|"startCommandExecution"|"getTask"|"stopTask",
arguments = list(
code = "string",
language = "python"|"javascript"|"typescript",
clearContext = TRUE|FALSE,
command = "string",
path = "string",
paths = list(
"string"
),
content = list(
list(
path = "string",
text = "string",
blob = raw
)
),
directoryPath = "string",
taskId = "string",
runtime = "nodejs"|"deno"|"python"
)
)