◈ AWS AGENTCORE BLUEPRINTS
PART III · TOOLS AND OPERATIONS · CHAPTER 15 / 36
TOCCONSULTING.FR
AMAZON BEDROCK / SERVICE DETAIL S06 (TOOLS)

AGENTCORE CODE INTERPRETER

CHAPTER 15 / 36
IN ONE LINE a safe computer for the agent to run code
REV 2026.07

AI models are weak at exact math and data work, and you should never let them run code on your own machines. Code Interpreter gives the agent a safe, throwaway computer in the cloud to run code, so it can calculate, analyze data, and check its own answers, with no risk to your systems.

New to these words? Read chapter 02 "Key terms" (sandbox, session, microVM).
[ 1 ] WHAT IT IS

Code Interpreter is a secure, fully managed sandbox (a locked-down computer) where the agent writes and runs real code. It is built in to AgentCore, so there is nothing for you to host. The agent uses it for precise work: math, data analysis, charts, file processing, and double-checking an answer by actually running it.

THE AGENT GETS
A real computer to run Python, JavaScript, or TypeScript, with common libraries ready.
YOU ARE PROTECTED
The code runs isolated in the cloud, never on your systems, and the session is thrown away afterward.
[ 2 ] HOW A RUN WORKS
STEP 01

CREATE

Use the built-in interpreter (aws.codeinterpreter.v1) or make your own.

==>
STEP 02

START SESSION

Open a session. It stays alive for a set time (15 minutes by default).

==>
STEP 03

EXECUTE

Send code. It runs, and keeps its state (variables, files) for the next run in the same session.

==>
STEP 04

RESULT

The output streams back to your code.

==>
STEP 05

STOP

Close the session to free resources. You pay only while it runs.

[ 3 ] THREE NETWORK MODES, PICK THE SAFE ONE (THE THIRD, VPC, CONNECTS TO YOUR PRIVATE NETWORK)
SANDBOX most restricted
The code cannot reach the public internet; only limited access to AWS services (Amazon S3). Safest.
Use it for pure computation and data you provide.
The right default for almost everything.
PUBLIC internet allowed
The code can reach the internet.
Use only when a task truly needs it (download a dataset, call a public API).
It widens the risk of data leaving, so turn it off when not needed.
[ 4 ] WHAT YOU CAN DO IN IT
LANGUAGES

Python, JavaScript, TypeScript, with common libraries ready.

KEEP STATE

Variables and files persist across runs in the same session.

FILES

Up to 100 MB inline, or 5 GB through Amazon S3.

SHELL + AWS CLI

Run shell commands and the AWS CLI inside the sandbox.

A custom interpreter can be given an execution role that decides which AWS resources it may touch, and you can watch its activity in CloudWatch. Reminder: keep it in Sandbox mode unless a task truly needs the internet.
Plain definitions: chapter 02 "Key terms". Hands-on code: chapter 16 "Code Interpreter, practical".
SRC: AWS AgentCore Developer Guide (code interpreter tool, session management, direct usage). DRAWN 2026.06, REV 2026.07.26
◄ PREVIOUS · CH 14
AgentCore Identity, Practical
NEXT · CH 16 ►
AgentCore Code Interpreter, Practical
AWS AGENTCORE BLUEPRINTS · CONTENTS
Back to tocconsulting.fr Cover & Table of Contents
PART I · FOUNDATIONS
01AgentCore Overview, Plain LanguageCONCEPT02AgentCore, Key Terms in Plain LanguageCONCEPT03AgentCore, Common Mistakes ExplainedCONCEPT04Inside an AgentCore Agent, BlueprintCONCEPT05Harness, Practical 1, Strands PathPRACTICAL06Harness, Practical 2, Managed HarnessPRACTICAL
PART II · CORE SERVICES
07AgentCore Runtime, Plain LanguageCONCEPT08AgentCore Runtime, PracticalPRACTICAL09AgentCore Memory, Plain LanguageCONCEPT10AgentCore Memory, PracticalPRACTICAL11AgentCore Gateway, Plain LanguageCONCEPT12AgentCore Gateway, PracticalPRACTICAL13AgentCore Identity, Plain LanguageCONCEPT14AgentCore Identity, PracticalPRACTICAL
PART III · TOOLS AND OPERATIONS
15AgentCore Code Interpreter, Plain LanguageCONCEPT16AgentCore Code Interpreter, PracticalPRACTICAL17AgentCore Browser, Plain LanguageCONCEPT18AgentCore Browser, PracticalPRACTICAL19AgentCore Observability, Plain LanguageCONCEPT20AgentCore Observability, PracticalPRACTICAL21AgentCore Evaluations, Plain LanguageCONCEPT22AgentCore Evaluations, PracticalPRACTICAL
PART IV · GOVERNANCE AND TRANSACTIONS
23AgentCore Policy, Plain LanguageCONCEPT24AgentCore Policy, PracticalPRACTICAL25AgentCore Registry, Plain LanguageCONCEPT26AgentCore Registry, PracticalPRACTICAL27AgentCore Payments, Plain LanguageCONCEPT28AgentCore Payments, PracticalPRACTICAL
PART V · MULTI-AGENT AND ARCHITECTURE
29A2A and Multi-Agent, Plain LanguageCONCEPT30A2A and Multi-Agent, PracticalPRACTICAL31Architecture Patterns, Plain LanguageCONCEPT32Multi-Tenant Agents, Plain LanguageCONCEPT33Agent Security and Threat Model, Plain LanguageCONCEPT34Governance at Org Scale, Plain LanguageCONCEPT35Governance at Org Scale, PracticalPRACTICAL36Multi-Region and Distribution, Plain LanguageCONCEPT