start_code_interpreter_session
async
¶
start_code_interpreter_session(
code_interpreter_identifier: str,
*,
config_overrides: Optional[AsyncBedrockAgentCoreClientConfig] = None,
trace_id: Optional[str] = None,
trace_parent: Optional[str] = None,
name: Optional[Name] = None,
session_timeout_seconds: Optional[CodeInterpreterSessionTimeout] = None,
certificates: Optional[Certificates] = None,
filesystem_configurations: Optional[ToolsFileSystemConfigurations] = None,
client_token: Optional[ClientToken] = None,
) -> StartCodeInterpreterSessionResponse
Creates and initializes a code interpreter session in Amazon Bedrock AgentCore. 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:
Parameters:
-
trace_id(Optional[str], default:None) –The trace identifier for request tracking.
-
trace_parent(Optional[str], default:None) –The parent trace information for distributed tracing.
-
code_interpreter_identifier(str) –The unique identifier of the code interpreter to use for this session. This identifier specifies which code interpreter environment to initialize for the session.
-
name(Optional[Name], default:None) –The name of the code interpreter session. This name helps you identify and manage the session. The name does not need to be unique.
-
session_timeout_seconds(Optional[CodeInterpreterSessionTimeout], default:None) –The duration in seconds (time-to-live) after which the session automatically terminates, regardless of ongoing activity. Defaults to 900 seconds (15 minutes). Recommended minimum: 60 seconds. Maximum allowed: 28,800 seconds (8 hours).
-
certificates(Optional[Certificates], default:None) –A list of certificates to install in the code interpreter session.
-
filesystem_configurations(Optional[ToolsFileSystemConfigurations], default:None) –The file system configurations to mount into the code interpreter session. Use these configurations to mount your own Amazon Simple Storage Service (Amazon S3) Files or Amazon Elastic File System (Amazon EFS) access points. Your session can then read and write your data. If you don't specify this field, no additional file systems are mounted.
-
client_token(Optional[ClientToken], default:None) –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 AgentCore ignores the request, but does not return an error. This parameter helps prevent the creation of duplicate sessions if there are temporary network issues.
Raises:
-
AccessDeniedException–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.
-
ConflictException–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.
-
InternalServerException–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.
-
ResourceNotFoundException–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.
-
ServiceQuotaExceededException–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.
-
ThrottlingException–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.
-
ValidationException–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.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_bedrock_agentcore/_services/async_bedrock_agent_core.py
2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 | |