v1

latestOpenAPI 3.0.0Apache 2.0 License2026-07-1465766489.0 KB

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 InvokeCodeInterpreter:

post/code-interpreters/{codeInterpreterIdentifier}/tools/invoke

Path parameters

codeInterpreterIdentifierstring required

The unique identifier of the code interpreter associated with the session. This must match the identifier used when creating the session with <code>StartCodeInterpreterSession</code>.

Headers

x-amzn-code-interpreter-session-idstring

The unique identifier of the code interpreter session to use. This must be an active session created with <code>StartCodeInterpreterSession</code>. If the session has expired or been stopped, the request will fail.

X-Amzn-Trace-Idstring

The trace identifier for request tracking.

traceparentstring

The parent trace information for distributed tracing.

Request body

name'executeCode' | 'executeCommand' | 'readFiles' | 'listFiles' | 'removeFiles' | 'writeFiles' | 'startCommandExecution' | 'getTask' | 'stopTask' required

The name of the code interpreter to invoke.

Response

Success