Skip to content

Commit d95271b

Browse files
committed
chore: rebrand to agent platform
1 parent e34ed07 commit d95271b

5 files changed

Lines changed: 44 additions & 63 deletions

File tree

src/google/adk/cli/cli_deploy.py

Lines changed: 35 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242

4343
def _ensure_agent_engine_dependency(requirements_txt_path: str) -> None:
44-
"""Ensures staged requirements include Agent Engine dependencies."""
44+
"""Ensures staged requirements include Agent Platform dependencies."""
4545
if not os.path.exists(requirements_txt_path):
4646
raise FileNotFoundError(
4747
f'requirements.txt not found at: {requirements_txt_path}'
@@ -71,11 +71,6 @@ def _ensure_agent_engine_dependency(requirements_txt_path: str) -> None:
7171
FROM python:3.11-slim
7272
WORKDIR /app
7373
74-
RUN apt-get update && \
75-
apt-get upgrade -y && \
76-
apt-get install -y git && \
77-
apt -y autoremove
78-
7974
# Create a non-root user
8075
RUN adduser --disabled-password --gecos "" myuser
8176
@@ -92,7 +87,7 @@ def _ensure_agent_engine_dependency(requirements_txt_path: str) -> None:
9287
# Set up environment variables - End
9388
9489
# Install ADK - Start
95-
# RUN pip install google-adk=={adk_version}
90+
RUN pip install google-adk=={adk_version}
9691
# Install ADK - End
9792
9893
# Copy agent - Start
@@ -468,7 +463,7 @@ def _validate_agent_import(
468463
469464
This pre-deployment validation catches common issues like missing
470465
dependencies or import errors in custom BaseLlm implementations before
471-
the agent is deployed to Agent Engine. This provides clearer error
466+
the agent is deployed to Agent Platform. This provides clearer error
472467
messages and prevents deployments that would fail at runtime.
473468
474469
Args:
@@ -838,7 +833,7 @@ def to_agent_engine(
838833
artifact_service_uri: Optional[str] = None,
839834
adk_version: Optional[str] = None,
840835
):
841-
"""Deploys an agent to Agent Platform Runtime.
836+
"""Deploys an agent to Gemini Enterprise Agent Platform.
842837
843838
`agent_folder` should contain the following files:
844839
@@ -851,7 +846,7 @@ def to_agent_engine(
851846
Args:
852847
agent_folder (str): The folder (absolute path) containing the agent source
853848
code.
854-
temp_folder (str): The temp folder for the generated Agent Engine source
849+
temp_folder (str): The temp folder for the generated Agent Platform source
855850
files. It will be replaced with the generated files if it already exists.
856851
adk_app (str): Deprecated. This argument is no longer required or used.
857852
staging_bucket (str): Deprecated. This argument is no longer required or
@@ -865,8 +860,8 @@ def to_agent_engine(
865860
will be used. It will only be used if GOOGLE_GENAI_USE_VERTEXAI is true.
866861
adk_app_object (str): Deprecated. This argument is no longer required or
867862
used.
868-
agent_engine_id (str): Optional. The ID of the Agent Engine instance to
869-
update. If not specified, a new Agent Engine instance will be created.
863+
agent_engine_id (str): Optional. The ID of the Agent Runtime instance to
864+
update. If not specified, a new Agent Runtime instance will be created.
870865
absolutize_imports (bool): Deprecated. This argument is no longer required
871866
or used.
872867
project (str): Optional. Google Cloud project id for the deployed agent. If
@@ -875,15 +870,15 @@ def to_agent_engine(
875870
region (str): Optional. Google Cloud region for the deployed agent. If not
876871
specified, the region from the `GOOGLE_CLOUD_LOCATION` environment
877872
variable will be used. It will be ignored if `api_key` is specified.
878-
display_name (str): Optional. The display name of the Agent Engine.
879-
description (str): Optional. The description of the Agent Engine.
873+
display_name (str): Optional. The display name of the Agent Runtime.
874+
description (str): Optional. The description of the Agent Runtime.
880875
requirements_file (str): Deprecated. This argument is no longer required or
881876
used.
882877
env_file (str): Optional. The filepath to the `.env` file for environment
883878
variables. If not specified, the `.env` file in the `agent_folder` will be
884879
used. The values of `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION`
885880
will be overridden by `project` and `region` if they are specified.
886-
agent_engine_config_file (str): The filepath to the agent engine config file
881+
agent_engine_config_file (str): The filepath to the agent platform config file
887882
to use. If not specified, the `.agent_engine_config.json` file in the
888883
`agent_folder` will be used.
889884
skip_agent_import_validation (bool): Deprecated. This argument is no longer
@@ -898,7 +893,7 @@ def to_agent_engine(
898893
specified, the session service will be deployed to the same parent
899894
resource as the runtime.
900895
artifact_service_uri (str): Optional. The URI of the artifact service.
901-
adk_version (str): Optional. The ADK version to use in Agent Engine
896+
adk_version (str): Optional. The ADK version to use in Agent Platform
902897
deployment. If not specified, the version in the dev environment will be
903898
used.
904899
"""
@@ -934,7 +929,7 @@ def to_agent_engine(
934929
did_change_cwd = False
935930
if parent_folder != original_cwd:
936931
click.echo(
937-
'Agent Engine deployment uses relative paths; temporarily switching '
932+
'Agent Runtime deployment uses relative paths; temporarily switching '
938933
f'working directory to: {parent_folder}'
939934
)
940935
os.chdir(parent_folder)
@@ -975,29 +970,33 @@ def to_agent_engine(
975970
agent_engine_config_file
976971
):
977972
raise click.ClickException(
978-
'Agent engine config file not found: '
973+
'Agent Platform config file not found: '
979974
f'{parent_folder}/{agent_engine_config_file}'
980975
)
981976
if not agent_engine_config_file:
982-
# Attempt to read the agent engine config from .agent_engine_config.json in the dir (if any).
977+
# Attempt to read the agent platform config from .agent_engine_config.json
978+
# in the dir (if any).
983979
agent_engine_config_file = os.path.join(
984980
agent_folder, '.agent_engine_config.json'
985981
)
986982
if os.path.exists(agent_engine_config_file):
987-
click.echo(f'Reading agent engine config from {agent_engine_config_file}')
983+
click.echo(
984+
f'Reading agent platform config from {agent_engine_config_file}'
985+
)
988986
with open(agent_engine_config_file, 'r') as f:
989987
agent_config = json.load(f)
990988
if display_name:
991989
if 'display_name' in agent_config:
992990
click.echo(
993-
'Overriding display_name in agent engine config with'
991+
'Overriding display_name in agent platform config with'
994992
f' {display_name}'
995993
)
996994
agent_config['display_name'] = display_name
997995
if description:
998996
if 'description' in agent_config:
999997
click.echo(
1000-
f'Overriding description in agent engine config with {description}'
998+
'Overriding description in agent platform config with'
999+
f' {description}'
10011000
)
10021001
agent_config['description'] = description
10031002

@@ -1094,7 +1093,7 @@ def to_agent_engine(
10941093
if env_vars:
10951094
if 'env_vars' in agent_config:
10961095
click.echo(
1097-
f'Overriding env_vars in agent engine config with {env_vars}'
1096+
f'Overriding env_vars in agent platform config with {env_vars}'
10981097
)
10991098
agent_config['env_vars'] = env_vars
11001099
# Set env_vars in agent_config to None if it is not set.
@@ -1104,32 +1103,18 @@ def to_agent_engine(
11041103

11051104
from ..utils._google_client_headers import get_tracking_headers
11061105

1107-
if not (api_key or project or region):
1108-
click.echo(
1109-
'No apikey/project/region provided. Starting onboarding flow...'
1110-
)
1106+
if not project or not region:
1107+
click.echo('No project/region provided. Starting onboarding flow...')
11111108
auth_info = _onboarding.handle_login_with_google()
11121109
project = auth_info.project_id
11131110
region = auth_info.region
11141111

11151112
click.echo('Initializing Agent Platform client...')
1116-
if project and region:
1117-
client = vertexai.Client(
1118-
project=project,
1119-
location=region,
1120-
http_options={'headers': get_tracking_headers()},
1121-
)
1122-
elif api_key:
1123-
client = vertexai.Client(
1124-
api_key=api_key,
1125-
http_options={'headers': get_tracking_headers()},
1126-
)
1127-
else:
1128-
click.echo(
1129-
'Failed to initialize Agent Platform client. Please provide an API'
1130-
'key or project and region.'
1131-
)
1132-
return
1113+
client = vertexai.Client(
1114+
project=project,
1115+
location=region,
1116+
http_options={'headers': get_tracking_headers()},
1117+
)
11331118
click.echo('Agent Platform client initialized.')
11341119

11351120
if skip_agent_import_validation:
@@ -1187,7 +1172,7 @@ def create_dockerfile_for_agent_engine(resource_name: str):
11871172
DeprecationWarning,
11881173
stacklevel=2,
11891174
)
1190-
click.echo('Deploying to agent engine...')
1175+
click.echo('Deploying to Agent Platform...')
11911176
agent_config['source_packages'] = [f'agents/{app_name}', 'Dockerfile']
11921177
agent_config['image_spec'] = {} # Use the Dockerfile
11931178
agent_config['class_methods'] = _AGENT_ENGINE_CLASS_METHODS
@@ -1197,21 +1182,21 @@ def create_dockerfile_for_agent_engine(resource_name: str):
11971182
if not resource_name:
11981183
agent_engine = client.agent_engines.create()
11991184
resource_name = agent_engine.api_resource.name
1200-
click.secho(f'Created a new agent engine: {resource_name}', fg='green')
1185+
click.secho(f'Created a new instance: {resource_name}', fg='green')
12011186
elif project and region and not resource_name.startswith('projects/'):
12021187
resource_name = f'projects/{project}/locations/{region}/reasoningEngines/{agent_engine_id}'
12031188
click.echo('Creating Dockerfile...')
12041189
create_dockerfile_for_agent_engine(resource_name)
12051190
click.echo(f'Dockerfile created at {os.getcwd()}/Dockerfile.')
12061191
try:
12071192
client.agent_engines.update(name=resource_name, config=agent_config)
1208-
click.secho(f'Deployed to agent engine: {resource_name}', fg='green')
1193+
click.secho(f'Deployed to Agent Platform: {resource_name}', fg='green')
12091194
except Exception as e:
1210-
click.secho(f'Failed to deploy to agent engine: {e}', fg='red')
1211-
# Only delete the agent engine if it was newly created in this function.
1195+
click.secho(f'Failed to deploy to Agent Platform: {e}', fg='red')
1196+
# Only delete the instance if it was newly created in this function.
12121197
if agent_engine_id is None:
12131198
client.agent_engines.delete(name=resource_name)
1214-
click.secho(f'Cleaned up the agent engine: {resource_name}', fg='green')
1199+
click.secho(f'Cleaned up the instance: {resource_name}', fg='green')
12151200
raise e
12161201
_print_agent_engine_url(resource_name)
12171202
finally:

src/google/adk/cli/fast_api.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
from ..telemetry._agent_engine import get_propagated_context
5555
from ..telemetry._agent_engine import TopSpanProcessor
5656
from .api_server import ApiServer
57-
from .dev_server import DevServer
5857
from .cli_deploy import _AGENT_ENGINE_CLASS_METHODS
58+
from .dev_server import DevServer
5959
from .service_registry import load_services_module
6060
from .utils import envs
6161
from .utils.agent_change_handler import AgentChangeEventHandler
@@ -746,10 +746,10 @@ async def _get_a2a_runner_async() -> Runner:
746746

747747
import inspect
748748
import json
749-
from pydantic import ValidationError as _ValidationError
750749

751750
from google.adk.agents import Agent
752751
import google.auth
752+
from pydantic import ValidationError as _ValidationError
753753
from vertexai import agent_engines
754754

755755
# The tmp agent will be replaced by the adk server's runner and services.
@@ -847,9 +847,7 @@ async def query(request: Request):
847847
try:
848848
body = await request.json()
849849
except json.JSONDecodeError as exc:
850-
raise HTTPException(
851-
status_code=400, detail=f"Invalid JSON: {exc}"
852-
)
850+
raise HTTPException(status_code=400, detail=f"Invalid JSON: {exc}")
853851
try:
854852
parsed = _QueryRequest.model_validate(body)
855853
except _ValidationError as exc:
@@ -892,9 +890,7 @@ async def stream_query(request: Request):
892890
try:
893891
body = await request.json()
894892
except json.JSONDecodeError as exc:
895-
raise HTTPException(
896-
status_code=400, detail=f"Invalid JSON: {exc}"
897-
)
893+
raise HTTPException(status_code=400, detail=f"Invalid JSON: {exc}")
898894
try:
899895
parsed = _QueryRequest.model_validate(body)
900896
except _ValidationError as exc:

src/google/adk/telemetry/google_cloud.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ def get_gcp_resource(project_id: Optional[str] = None) -> Resource:
252252
resource_attributes["cloud.resource.id"] = cloud_resource_id
253253

254254
if agent_engine_id:
255-
resource = Resource.create(
256-
attributes=resource_attributes
257-
).merge(OTELResourceDetector().detect())
255+
resource = Resource.create(attributes=resource_attributes).merge(
256+
OTELResourceDetector().detect()
257+
)
258258
return resource
259259

260260
resource = Resource(

tests/unittests/cli/utils/test_cli_deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def test_to_agent_engine_raises_when_explicit_config_file_missing(
329329
adk_version="1.2.0",
330330
)
331331

332-
assert "Agent engine config file not found" in str(exc_info.value)
332+
assert "Agent Platform config file not found" in str(exc_info.value)
333333
assert expected_abs in str(exc_info.value)
334334

335335

tests/unittests/telemetry/test_google_cloud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def test_get_gcp_exporters(
6262
)
6363
monkeypatch.setattr(
6464
"google.adk.telemetry.google_cloud._get_gcp_logs_exporter",
65-
lambda project_id: mock.MagicMock(),
65+
lambda project_id, credentials: mock.MagicMock(),
6666
)
6767

6868
# Act.

0 commit comments

Comments
 (0)