2025/10/10 - Amazon Bedrock AgentCore Data Plane Fronting Layer - 5 updated api methods
Changes Bedrock AgentCore release for Runtime, and Memory.
{'traceId': 'string', 'traceParent': 'string'}
Executes code within an active code interpreter session in Amazon Bedrock. 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:
See also: AWS API Documentation
Request Syntax
client.invoke_code_interpreter( codeInterpreterIdentifier='string', sessionId='string', traceId='string', traceParent='string', name='executeCode'|'executeCommand'|'readFiles'|'listFiles'|'removeFiles'|'writeFiles'|'startCommandExecution'|'getTask'|'stopTask', arguments={ 'code': 'string', 'language': 'python'|'javascript'|'typescript', 'clearContext': True|False, 'command': 'string', 'path': 'string', 'paths': [ 'string', ], 'content': [ { 'path': 'string', 'text': 'string', 'blob': b'bytes' }, ], 'directoryPath': 'string', 'taskId': 'string' } )
string
[REQUIRED]
The unique identifier of the code interpreter associated with the session. This must match the identifier used when creating the session with StartCodeInterpreterSession.
string
The unique identifier of the code interpreter session to use. This must be an active session created with StartCodeInterpreterSession. If the session has expired or been stopped, the request will fail.
string
The trace identifier for request tracking.
string
The parent trace information for distributed tracing.
string
[REQUIRED]
The name of the code interpreter to invoke.
dict
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.
code (string) --
The code to execute in a code interpreter session. This is the source code in the specified programming language that will be executed by the code interpreter.
language (string) --
The programming language of the code to execute. This tells the code interpreter which language runtime to use for execution. Common values include 'python', 'javascript', and 'r'.
clearContext (boolean) --
Whether to clear the context for the tool.
command (string) --
The command to execute with the tool.
path (string) --
The path for the tool operation.
paths (list) --
The paths for the tool operation.
(string) --
content (list) --
The content for the tool operation.
(dict) --
A block of input content.
path (string) -- [REQUIRED]
The path to the input content.
text (string) --
The text input content.
blob (bytes) --
The binary input content.
directoryPath (string) --
The directory path for the tool operation.
taskId (string) --
The identifier of the task for the tool operation.
dict
The response of this operation contains an :class:`.EventStream` member. When iterated the :class:`.EventStream` will yield events based on the structure below, where only one of the top level keys will be present for any given event.
Response Syntax
{ 'sessionId': 'string', 'stream': EventStream({ 'result': { 'content': [ { 'type': 'text'|'image'|'resource'|'resource_link', 'text': 'string', 'data': b'bytes', 'mimeType': 'string', 'uri': 'string', 'name': 'string', 'description': 'string', 'size': 123, 'resource': { 'type': 'text'|'blob', 'uri': 'string', 'mimeType': 'string', 'text': 'string', 'blob': b'bytes' } }, ], 'structuredContent': { 'taskId': 'string', 'taskStatus': 'submitted'|'working'|'completed'|'canceled'|'failed', 'stdout': 'string', 'stderr': 'string', 'exitCode': 123, 'executionTime': 123.0 }, 'isError': True|False }, 'accessDeniedException': { 'message': 'string' }, 'conflictException': { 'message': 'string' }, 'internalServerException': { 'message': 'string' }, 'resourceNotFoundException': { 'message': 'string' }, 'serviceQuotaExceededException': { 'message': 'string' }, 'throttlingException': { 'message': 'string' }, 'validationException': { 'message': 'string', 'reason': 'CannotParse'|'FieldValidationFailed'|'IdempotentParameterMismatchException'|'EventInOtherSession'|'ResourceConflict', 'fieldList': [ { 'name': 'string', 'message': 'string' }, ] } }) }
Response Structure
(dict) --
sessionId (string) --
The identifier of the code interpreter session.
stream (:class:`.EventStream`) --
The stream containing the results of the code execution. This includes output, errors, and execution status.
result (dict) --
The output produced by executing code in a code interpreter session in Amazon Bedrock. This structure contains the results of code execution, including textual output, structured data, and error information. Agents use these results to generate responses that incorporate computation, data analysis, and visualization.
content (list) --
The textual content of the execution result. This includes standard output from the code execution, such as print statements, console output, and text representations of results.
(dict) --
A block of content in a response.
type (string) --
The type of content in the block.
text (string) --
The text content of the block.
data (bytes) --
The binary data content of the block.
mimeType (string) --
The MIME type of the content.
uri (string) --
The URI of the content.
name (string) --
The name of the content block.
description (string) --
The description of the content block.
size (integer) --
The size of the content in bytes.
resource (dict) --
The resource associated with the content block.
type (string) --
The type of resource content.
uri (string) --
The URI of the resource content.
mimeType (string) --
The MIME type of the resource content.
text (string) --
The text resource content.
blob (bytes) --
The binary resource content.
structuredContent (dict) --
The structured content of the execution result. This includes additional metadata about the execution, such as execution time, memory usage, and structured representations of output data. The format depends on the specific code interpreter and execution context.
taskId (string) --
The identifier of the task that produced the result.
taskStatus (string) --
The status of the task that produced the result.
stdout (string) --
The standard output from the tool execution.
stderr (string) --
The standard error output from the tool execution.
exitCode (integer) --
The exit code from the tool execution.
executionTime (float) --
The execution time of the tool operation in milliseconds.
isError (boolean) --
Indicates whether the result represents an error. If true, the content contains error messages or exception information. If false, the content contains successful execution results.
accessDeniedException (dict) --
The exception that occurs when you do not have sufficient permissions to perform an action. Verify that your IAM policy includes the necessary permissions for the operation you are trying to perform.
message (string) --
conflictException (dict) --
The exception that occurs when the request conflicts with the current state of the resource. This can happen when trying to modify a resource that is currently being modified by another request, or when trying to create a resource that already exists.
message (string) --
internalServerException (dict) --
The exception that occurs when the service encounters an unexpected internal error. This is a temporary condition that will resolve itself with retries. We recommend implementing exponential backoff retry logic in your application.
message (string) --
resourceNotFoundException (dict) --
The exception that occurs when the specified resource does not exist. This can happen when using an invalid identifier or when trying to access a resource that has been deleted.
message (string) --
serviceQuotaExceededException (dict) --
The exception that occurs when the request would cause a service quota to be exceeded. Review your service quotas and either reduce your request rate or request a quota increase.
message (string) --
throttlingException (dict) --
The exception that occurs when the request was denied due to request throttling. This happens when you exceed the allowed request rate for an operation. Reduce the frequency of requests or implement exponential backoff retry logic in your application.
message (string) --
validationException (dict) --
The exception that occurs when the input fails to satisfy the constraints specified by the service. Check the error message for details about which input parameter is invalid and correct your request.
message (string) --
reason (string) --
fieldList (list) --
(dict) --
Stores information about a field passed inside a request that resulted in an exception.
name (string) --
The name of the field.
message (string) --
A message describing why this field failed validation.
{'traceId': 'string', 'traceParent': 'string'}
Creates and initializes a browser session in Amazon Bedrock. The session enables agents to navigate and interact with web content, extract information from websites, and perform web-based tasks as part of their response generation.
To create a session, you must specify a browser identifier and a name. You can also configure the viewport dimensions to control the visible area of web content. The session remains active until it times out or you explicitly stop it using the StopBrowserSession operation.
The following operations are related to StartBrowserSession:
See also: AWS API Documentation
Request Syntax
client.start_browser_session( traceId='string', traceParent='string', browserIdentifier='string', name='string', sessionTimeoutSeconds=123, viewPort={ 'width': 123, 'height': 123 }, clientToken='string' )
string
The trace identifier for request tracking.
string
The parent trace information for distributed tracing.
string
[REQUIRED]
The unique identifier of the browser to use for this session. This identifier specifies which browser environment to initialize for the session.
string
The name of the browser session. This name helps you identify and manage the session. The name does not need to be unique.
integer
The time in seconds after which the session automatically terminates if there is no activity. The default value is 3600 seconds (1 hour). The minimum allowed value is 60 seconds, and the maximum allowed value is 28800 seconds (8 hours).
dict
The dimensions of the browser viewport for this session. This determines the visible area of the web content and affects how web pages are rendered. If not specified, Amazon Bedrock uses a default viewport size.
width (integer) -- [REQUIRED]
The width of the viewport in pixels. This value determines the horizontal dimension of the visible area. Valid values range from 800 to 1920 pixels.
height (integer) -- [REQUIRED]
The height of the viewport in pixels. This value determines the vertical dimension of the visible area. Valid values range from 600 to 1080 pixels.
string
A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. This parameter helps prevent the creation of duplicate sessions if there are temporary network issues.
This field is autopopulated if not provided.
dict
Response Syntax
{ 'browserIdentifier': 'string', 'sessionId': 'string', 'createdAt': datetime(2015, 1, 1), 'streams': { 'automationStream': { 'streamEndpoint': 'string', 'streamStatus': 'ENABLED'|'DISABLED' }, 'liveViewStream': { 'streamEndpoint': 'string' } } }
Response Structure
(dict) --
browserIdentifier (string) --
The identifier of the browser.
sessionId (string) --
The unique identifier of the created browser session.
createdAt (datetime) --
The timestamp when the browser session was created.
streams (dict) --
The streams associated with this browser session. These include the automation stream and live view stream.
automationStream (dict) --
The stream that enables programmatic control of the browser. This stream allows agents to perform actions such as navigating to URLs, clicking elements, and filling forms.
streamEndpoint (string) --
The endpoint URL for the automation stream. This URL is used to establish a WebSocket connection to the stream for sending commands and receiving responses.
streamStatus (string) --
The current status of the automation stream. This indicates whether the stream is available for use. Possible values include ACTIVE, CONNECTING, and DISCONNECTED.
liveViewStream (dict) --
The stream that provides a visual representation of the browser content. This stream allows agents to observe the current state of the browser, including rendered web pages and visual elements.
streamEndpoint (string) --
The endpoint URL for the live view stream. This URL is used to establish a connection to receive visual updates from the browser session.
{'traceId': 'string', 'traceParent': 'string'}
Creates and initializes a code interpreter session in Amazon Bedrock. The session enables agents to execute code as part of their response generation, supporting programming languages such as Python for data analysis, visualization, and computation tasks.
To create a session, you must specify a code interpreter identifier and a name. The session remains active until it times out or you explicitly stop it using the StopCodeInterpreterSession operation.
The following operations are related to StartCodeInterpreterSession:
See also: AWS API Documentation
Request Syntax
client.start_code_interpreter_session( traceId='string', traceParent='string', codeInterpreterIdentifier='string', name='string', sessionTimeoutSeconds=123, clientToken='string' )
string
The trace identifier for request tracking.
string
The parent trace information for distributed tracing.
string
[REQUIRED]
The unique identifier of the code interpreter to use for this session. This identifier specifies which code interpreter environment to initialize for the session.
string
The name of the code interpreter session. This name helps you identify and manage the session. The name does not need to be unique.
integer
The time in seconds after which the session automatically terminates if there is no activity. The default value is 900 seconds (15 minutes). The minimum allowed value is 60 seconds, and the maximum allowed value is 28800 seconds (8 hours).
string
A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. This parameter helps prevent the creation of duplicate sessions if there are temporary network issues.
This field is autopopulated if not provided.
dict
Response Syntax
{ 'codeInterpreterIdentifier': 'string', 'sessionId': 'string', 'createdAt': datetime(2015, 1, 1) }
Response Structure
(dict) --
codeInterpreterIdentifier (string) --
The identifier of the code interpreter.
sessionId (string) --
The unique identifier of the created code interpreter session.
createdAt (datetime) --
The time at which the code interpreter session was created.
{'traceId': 'string', 'traceParent': 'string'}
Terminates an active browser session in Amazon Bedrock. This operation stops the session, releases associated resources, and makes the session unavailable for further use.
To stop a browser session, you must specify both the browser identifier and the session ID. Once stopped, a session cannot be restarted; you must create a new session using StartBrowserSession.
The following operations are related to StopBrowserSession:
See also: AWS API Documentation
Request Syntax
client.stop_browser_session( traceId='string', traceParent='string', browserIdentifier='string', sessionId='string', clientToken='string' )
string
The trace identifier for request tracking.
string
The parent trace information for distributed tracing.
string
[REQUIRED]
The unique identifier of the browser associated with the session.
string
[REQUIRED]
The unique identifier of the browser session to stop.
string
A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error.
This field is autopopulated if not provided.
dict
Response Syntax
{ 'browserIdentifier': 'string', 'sessionId': 'string', 'lastUpdatedAt': datetime(2015, 1, 1) }
Response Structure
(dict) --
browserIdentifier (string) --
The identifier of the browser.
sessionId (string) --
The identifier of the browser session.
lastUpdatedAt (datetime) --
The time at which the browser session was last updated.
{'traceId': 'string', 'traceParent': 'string'}
Terminates an active code interpreter session in Amazon Bedrock. This operation stops the session, releases associated resources, and makes the session unavailable for further use.
To stop a code interpreter session, you must specify both the code interpreter identifier and the session ID. Once stopped, a session cannot be restarted; you must create a new session using StartCodeInterpreterSession.
The following operations are related to StopCodeInterpreterSession:
See also: AWS API Documentation
Request Syntax
client.stop_code_interpreter_session( traceId='string', traceParent='string', codeInterpreterIdentifier='string', sessionId='string', clientToken='string' )
string
The trace identifier for request tracking.
string
The parent trace information for distributed tracing.
string
[REQUIRED]
The unique identifier of the code interpreter associated with the session.
string
[REQUIRED]
The unique identifier of the code interpreter session to stop.
string
A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error.
This field is autopopulated if not provided.
dict
Response Syntax
{ 'codeInterpreterIdentifier': 'string', 'sessionId': 'string', 'lastUpdatedAt': datetime(2015, 1, 1) }
Response Structure
(dict) --
codeInterpreterIdentifier (string) --
The identifier of the code interpreter.
sessionId (string) --
The identifier of the code interpreter session.
lastUpdatedAt (datetime) --
The timestamp when the code interpreter session was last updated.