You can make the following optional configurations for your agent:
Define the package requirements
Provide the set of packages required by the agent for deployment. The set of packages can either be a list of items to be installed by pip, or the path to a file that follows the Requirements File Format. Use the following best practices:
Pin your package versions for reproducible builds. Common packages to keep track of include the following: google-cloud-aiplatform, cloudpickle, langchain, langchain-core, langchain-google-vertexai, and pydantic.
Minimize the number of dependencies in your agent. This reduces the number of breaking changes when updating your dependencies and agent.
If the agent doesn't have any dependencies, you can set requirements to None:
requirements=None
If the agent uses a framework-specific template, you should specify the SDK version that is imported (such as 1.112.0) when developing the agent.
You can include local files or directories that contain local required Python source files. Compared to package requirements, this lets you use private utilities you have developed that aren't otherwise available on PyPI or GitHub.
If the agent does not require any extra packages, you can set extra_packages to None:
extra_packages=None
You can also do the following with extra_packages:
Include a single file (such as agents/agent.py):
extra_packages=["agents/agent.py"]
Include the set of files in an entire directory (for example, agents/):
extra_packages=["agents"]# directory that includes agents/agent.py
requirements=["google-cloud-aiplatform[agent_engines,adk]","cloudpickle==3.0","python_package.whl",# install from the whl file that was uploaded]extra_packages=["path/to/python_package.whl"]# bundle the whl file for uploading
Define environment variables
If there are environment variables that your agent depends on, you can specify them in the env_vars= argument. If the agent does not depend on any environment variables, you can set it to None:
env_vars=None
To specify the environment variables, there are a few different options available:
You can specify runtime resource controls for the agent, such as the minimum and maximum number of application instances, resource limits for each container, and concurrency for each container.
min_instances: The minimum number of application instances to keep running at all times, with a range of [0, 10]. The default value is 1.
max_instances: The maximum number of application instances that can be launched to handle increased traffic, with a range of [1, 1000]. The default value is 100. If VPC-SC or PSC-I is enabled, the acceptable range is [1, 100].
resource_limits: Resource limits for each container. Only cpu and memory keys are supported. The default value is {"cpu": "4", "memory": "4Gi"}.
The only supported values for cpu are 1, 2, 4, 6 and 8. For more information, see Configure CPU allocation.
The only supported values for memory are 1Gi, 2Gi, ... 32Gi.
container_concurrency: Concurrency for each container and agent server. The recommended value is 2 * cpu + 1. The default value is 9.
remote_agent=client.agent_engines.create(agent=local_agent,config={"min_instances":1,"max_instances":10,"resource_limits":{"cpu":"4","memory":"8Gi"},"container_concurrency":9,# ... other configs})
Define build options
You can specify build options for the agent, such as installation scripts to run when building the agent's container image. This is useful for installing system dependencies (for example, gcloud cli, npx) or other custom setups. The scripts are run with root permissions.
To use installation scripts, create a directory named installation_scripts and place your shell scripts inside the directory:
Staging artifacts are overwritten if they correspond to an existing folder in a Cloud Storage bucket. If necessary, you can specify the Cloud Storage folder for the staging artifacts. You can set gcs_dir_name to None if you don't mind potentially overwriting the files in the default folder:
gcs_dir_name=None
To avoid overwriting the files (such as for different environments such as development, staging, and production), you can set up corresponding folder, and specify the folder to stage the artifact under:
gcs_dir_name="dev"# or "staging" or "prod"
If you want or need to avoid collisions, you can generate a random uuid:
importuuidgcs_dir_name=str(uuid.uuid4())
Define the display name
You can set the display name for the ReasoningEngine resource:
You can set the description of the ReasoningEngine resource:
description="""An agent that has access to tools for looking up the exchange rate.If you run into any issues, please contact the dev team."""
Define the labels
You can set the labels of the ReasoningEngine resource as a dictionary of key-value string pairs. The following is an example:
labels={"author":"username","version":"latest"}
Configure a custom service account
You can configure a custom service account as the identity of your deployed agent, instead of the default identity.
To do so, specify the email of your custom service account as the service_account when creating or updating the Agent Engine instance, for example:
# Create a new instanceclient.agent_engines.create(agent=local_agent,config={"service_account":"my-custom-service-account@my-project.iam.gserviceaccount.com",# ...},)# Update an existing instanceresource_name="projects/{project_id}/locations/{location}/reasoningEngines/{reasoning_engine_id}"client.agent_engines.update(name=resource_name,agent=local_agent,config={"service_account":"my-new-custom-service-account@my-project.iam.gserviceaccount.com",# ...},)
NETWORK_ATTACHMENT is the name or full path of your network attachment. If the network attachment is created in a project (such as the Shared VPC host project) different from where you use Agent Engine, you need to pass the full path of your network attachment.
DOMAIN_SUFFIX is the DNS name of the private Cloud DNS zone that you created when setting up the private DNS Peering.
TARGET_PROJECT is the project that hosts the VPC network.
TARGET_NETWORK is the VPC network name.
You can configure multiple agents to use either a single, shared network attachment or unique, dedicated network attachments. To use a shared network attachment, provide the same network attachment in the psc_interface_config for each agent you create.
To configure the custom key (CMEK) for your agent, you need to provide the key resource name to the encryption_spec parameter when creating the Agent Engine instance.
# The fully qualified key namekms_key_name="projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME"remote_agent=client.agent_engines.create(agent=local_agent,config={"encryption_spec":{"kms_key_name":kms_key_name},# ... other parameters},)
Create an AgentEngine instance
To deploy the agent on Vertex AI, use client.agent_engines.create to pass in the local_agent object along with any optional configurations:
dependencies.tar.gz a tar file containing any extra packages.
The bundle is uploaded to Cloud Storage (under the corresponding folder) for staging the artifacts.
The Cloud Storage URIs for the respective artifacts are specified in the PackageSpec.
The Vertex AI Agent Engine service receives the request and builds containers and starts HTTP servers on the backend.
Deployment latency depends on the total time it takes to install required packages. Once deployed, remote_agent corresponds to an instance of local_agent that is running on Vertex AI and can be queried or deleted. It is separate from local instances of the agent.
The remote_agent object corresponds to an AgentEngine class that contains the following attributes:
a remote_agent.api_resource with information about the deployed agent. You can also call agent.operation_schemas() to return the list of operations that the agent supports. See List the supported operations for details.
Each deployed agent has a list of supported operations. You can run the following command to get the list of operations supported by the deployed agent:
remote_agent.operation_schemas()
The schema for each operation is a dictionary that documents the information of a method for the agent that you can call. The set of supported operations depends on the framework you used to develop your agent:
[[["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-10-07 UTC."],[],[]]