BedrockAgentCoreClient.invoke_code_interpreter
rboto-bedrock-agentcore==0.4.0 · Service index · Types
Model summary (excerpt): 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...
Install and imports
from rboto import BedrockAgentCoreClient
from rboto_bedrock_agentcore.types import (
InvokeCodeInterpreterOutput,
ToolArguments,
ToolName,
)
Signature
async def invoke_code_interpreter(
*,
code_interpreter_identifier: str,
name: ToolName,
session_id: str | None = None,
trace_id: str | None = None,
trace_parent: str | None = None,
arguments: ToolArguments | None = None,
) -> InvokeCodeInterpreterOutput: ...
Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.
Arguments
| Argument | Required | Model notes (excerpt) |
|---|---|---|
code_interpreter_identifier |
Yes | The unique identifier of the code interpreter associated with the session. This must match the identifier used when creating the session with StartCodeInterpreterSession . |
name |
Yes | The name of the code interpreter to invoke. |
session_id |
No | 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. |
trace_id |
No | The trace identifier for request tracking. |
trace_parent |
No | The parent trace information for distributed tracing. |
arguments |
No | 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. |
Output
InvokeCodeInterpreterOutput.
Typed response mapping, accessed as response["field"].
| Field | Type | Presence | References |
|---|---|---|---|
session_id |
str | None |
Always present | — |
stream |
AsyncIterator[CodeInterpreterStreamOutput] |
Always present | CodeInterpreterStreamOutput |
| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.
Related types
InvokeCodeInterpreterOutput, ToolArguments, ToolName
Follow these links for nested inputs and outputs; recursive types link back to the same type page.
Pagination and streaming
No generated paginator for this operation.
Output streams: InvokeCodeInterpreterOutput.
Consume with async for. Do not reuse a consumed stream.
Errors
Import from rboto_bedrock_agentcore.exceptions:
AccessDeniedError, ConflictError, InternalServerError, ResourceNotFoundError, ServiceQuotaExceededError, ThrottlingError, ValidationError.
Stream decoding may also raise the linked modeled event errors.
Other service failures use the service base error; credential, transport and timeout failures use shared errors.