Starting April 29, 2025, Gemini 1.5 Pro and Gemini 1.5 Flash models are not available in projects that have no prior usage of these models, including new projects. For details, see Model versions and lifecycle.
Stay organized with collections
Save and categorize content based on your preferences.
Many agent tasks, like financial calculations and data science workflows require
an agent to generate and execute code. Agent Engine Code Execution, allows your
agent to run code in a secure, isolated, and managed sandbox environment.
Features of Code Execution include:
Sandboxes can be created and execute code in under a second.
Sandboxes support file input and output up to 100MB for the entire request
or response.
Sandboxes maintain their execution state (memory) for up to 14 days. This
time to live (TTL) setting is configurable.
Code Execution is part of the Agent Engine suite. However, you don't
need to deploy your agent to Agent Engine to use Code Execution. Your agent can
be running anywhere, even locally.
Code Execution works with any agent framework and any generative model.
Here are the major operations for working with a Code Execution sandbox:
Create sandbox: creates a secure, isolated space to
run untrusted or potentially harmful code. This isolation reduces
security risks by preventing the code from touching your system's resources,
files, or network. A sandbox is vital when you need to run code safely, such
as for data science agents, orchestration scripts, or during development
testing. The sandbox offers a limited file system and no network access.
Get sandbox: shows the configuration and status of a specific Code Execution
sandbox. You can check details like its current state (for
example, running or stopped) and time to live (TTL). This lets you track
your sandboxes and verify their status before or after running code.
List sandboxes: list all of the Code Execution sandboxes in your
project. You can filter the results by criteria like sandbox status or type.
This helps with checking, monitoring, and managing many sandboxes in your
project.
Execute code: sends your code along with any required input files to the
sandbox for safe execution. The response includes the results, such as
standard output (stdout), standard error (stderr), and any files the code
generates. The sandbox can also maintain state, which allows subsequent
Execute Code calls to build on previous calls. This is crucial for
interactive sessions or complex tasks that need the environment to maintain
state across several code runs.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-10 UTC."],[],[],null,["| [VPC-SC security controls](/vertex-ai/docs/general/vpc-service-controls),\n| [Customer-managed encryption keys (CMEK)](/vertex-ai/docs/general/cmek), and\n| [Data residency (DRZ)](/assured-workloads/docs/data-residency) are\n| supported by Vertex AI Agent Engine. Access Transparency (AXT)\n| security controls aren't supported.\n|\n| **Preview**\n|\n|\n| This feature is\n|\n| subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section of the\n| [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nMany agent tasks, like financial calculations and data science workflows require\nan agent to generate and execute code. Agent Engine Code Execution, allows your\nagent to run code in a secure, isolated, and managed sandbox environment.\n\nFeatures of Code Execution include:\n\n- Sandboxes can be created and execute code in under a second.\n\n- Sandboxes support file input and output up to 100MB for the entire request\n or response.\n\n- Sandboxes maintain their execution state (memory) for up to 14 days. This\n time to live (TTL) setting is configurable.\n\n| **Note:** Agent Engine Code Execution is supported in only the `us-central1` region.\n\nCode Execution is part of the Agent Engine suite. However, you don't\nneed to deploy your agent to Agent Engine to use Code Execution. Your agent can\nbe running anywhere, even locally.\n\nCode Execution works with any agent framework and any generative model.\n\nHere are the major operations for working with a Code Execution sandbox:\n\n- **Create sandbox**: creates a secure, isolated space to\n run untrusted or potentially harmful code. This isolation reduces\n security risks by preventing the code from touching your system's resources,\n files, or network. A sandbox is vital when you need to run code safely, such\n as for data science agents, orchestration scripts, or during development\n testing. The sandbox offers a limited file system and no network access.\n\n- **Get sandbox**: shows the configuration and status of a specific Code Execution\n sandbox. You can check details like its current state (for\n example, running or stopped) and time to live (TTL). This lets you track\n your sandboxes and verify their status before or after running code.\n\n- **List sandboxes**: list all of the Code Execution sandboxes in your\n project. You can filter the results by criteria like sandbox status or type.\n This helps with checking, monitoring, and managing many sandboxes in your\n project.\n\n- **Execute code** : sends your code along with any required input files to the\n sandbox for safe execution. The response includes the results, such as\n standard output (`stdout`), standard error (`stderr`), and any files the code\n generates. The sandbox can also maintain *state* , which allows subsequent\n `Execute Code` calls to build on previous calls. This is crucial for\n interactive sessions or complex tasks that need the environment to maintain\n state across several code runs.\n\nWhat's next\n\n- [Code Execution quickstart](/vertex-ai/generative-ai/docs/agent-engine/code-execution/quickstart)"]]