Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/google/adk/agents/remote_a2a_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ async def _handle_a2a_response(
TaskState.submitted,
TaskState.working,
)
and event.content is not None
and event.content.parts
):
event.content.parts[0].thought = True
elif (
Expand All @@ -431,7 +433,7 @@ async def _handle_a2a_response(
event = convert_a2a_message_to_event(
update.status.message, self.name, ctx, self._a2a_part_converter
)
if event.content and update.status.state in (
if event.content is not None and update.status.state in (
TaskState.submitted,
TaskState.working,
):
Expand Down
6 changes: 3 additions & 3 deletions src/google/adk/cli/browser/index.html

Large diffs are not rendered by default.

4,093 changes: 0 additions & 4,093 deletions src/google/adk/cli/browser/main-5V5675GB.js

This file was deleted.

4,060 changes: 4,060 additions & 0 deletions src/google/adk/cli/browser/main-MTHA237R.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/google/adk/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ async def run_cli(
session_id: Optional[str] = None,
session_service_uri: Optional[str] = None,
artifact_service_uri: Optional[str] = None,
use_local_storage: bool = True,
) -> None:
"""Runs an interactive CLI for a certain agent.

Expand All @@ -153,6 +154,7 @@ async def run_cli(
session_id: Optional[str], the session ID to save the session to on exit.
session_service_uri: Optional[str], custom session service URI.
artifact_service_uri: Optional[str], custom artifact service URI.
use_local_storage: bool, whether to use local .adk storage by default.
"""
agent_parent_path = Path(agent_parent_dir).resolve()
agent_root = agent_parent_path / agent_folder_name
Expand All @@ -169,17 +171,19 @@ async def run_cli(
if isinstance(agent_or_app, App) and agent_or_app.name != agent_folder_name:
app_name_to_dir = {agent_or_app.name: agent_folder_name}

# Create session and artifact services using factory functions
# Sessions persist under <agents_dir>/<agent>/.adk/session.db by default.
# Create session and artifact services using factory functions.
# Sessions persist under <agents_dir>/<agent>/.adk/session.db when enabled.
session_service = create_session_service_from_options(
base_dir=agent_parent_path,
session_service_uri=session_service_uri,
app_name_to_dir=app_name_to_dir,
use_local_storage=use_local_storage,
)

artifact_service = create_artifact_service_from_options(
base_dir=agent_root,
artifact_service_uri=artifact_service_uri,
use_local_storage=use_local_storage,
)

credential_service = InMemoryCredentialService()
Expand Down
55 changes: 40 additions & 15 deletions src/google/adk/cli/cli_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

_IS_WINDOWS = os.name == 'nt'
_GCLOUD_CMD = 'gcloud.cmd' if _IS_WINDOWS else 'gcloud'
_LOCAL_STORAGE_FLAG_MIN_VERSION: Final[str] = '1.21.0'

_DOCKERFILE_TEMPLATE: Final[str] = """
FROM python:3.11-slim
Expand Down Expand Up @@ -442,26 +443,38 @@ def _get_service_option_by_adk_version(
session_uri: Optional[str],
artifact_uri: Optional[str],
memory_uri: Optional[str],
use_local_storage: Optional[bool] = None,
) -> str:
"""Returns service option string based on adk_version."""
parsed_version = parse(adk_version)
options: list[str] = []

if parsed_version >= parse('1.3.0'):
session_option = (
f'--session_service_uri={session_uri}' if session_uri else ''
)
artifact_option = (
f'--artifact_service_uri={artifact_uri}' if artifact_uri else ''
)
memory_option = f'--memory_service_uri={memory_uri}' if memory_uri else ''
return f'{session_option} {artifact_option} {memory_option}'
elif parsed_version >= parse('1.2.0'):
session_option = f'--session_db_url={session_uri}' if session_uri else ''
artifact_option = (
f'--artifact_storage_uri={artifact_uri}' if artifact_uri else ''
)
return f'{session_option} {artifact_option}'
if session_uri:
options.append(f'--session_service_uri={session_uri}')
if artifact_uri:
options.append(f'--artifact_service_uri={artifact_uri}')
if memory_uri:
options.append(f'--memory_service_uri={memory_uri}')
else:
return f'--session_db_url={session_uri}' if session_uri else ''
if session_uri:
options.append(f'--session_db_url={session_uri}')
if parsed_version >= parse('1.2.0') and artifact_uri:
options.append(f'--artifact_storage_uri={artifact_uri}')

if use_local_storage is not None and parsed_version >= parse(
_LOCAL_STORAGE_FLAG_MIN_VERSION
):
# Only valid when session/artifact URIs are unset; otherwise the CLI
# rejects the combination to avoid confusing precedence.
if session_uri is None and artifact_uri is None:
options.append((
'--use_local_storage'
if use_local_storage
else '--no_use_local_storage'
))

return ' '.join(options)


def to_cloud_run(
Expand All @@ -482,6 +495,7 @@ def to_cloud_run(
session_service_uri: Optional[str] = None,
artifact_service_uri: Optional[str] = None,
memory_service_uri: Optional[str] = None,
use_local_storage: bool = False,
a2a: bool = False,
extra_gcloud_args: Optional[tuple[str, ...]] = None,
):
Expand Down Expand Up @@ -517,8 +531,12 @@ def to_cloud_run(
session_service_uri: The URI of the session service.
artifact_service_uri: The URI of the artifact service.
memory_service_uri: The URI of the memory service.
use_local_storage: Whether to use local .adk storage in the container.
"""
app_name = app_name or os.path.basename(agent_folder)
if parse(adk_version) >= parse('1.3.0') and not use_local_storage:
session_service_uri = session_service_uri or 'memory://'
artifact_service_uri = artifact_service_uri or 'memory://'

click.echo(f'Start generating Cloud Run source files in {temp_folder}')

Expand Down Expand Up @@ -559,6 +577,7 @@ def to_cloud_run(
session_service_uri,
artifact_service_uri,
memory_service_uri,
use_local_storage,
),
trace_to_cloud_option='--trace_to_cloud' if trace_to_cloud else '',
allow_origins_option=allow_origins_option,
Expand Down Expand Up @@ -944,6 +963,7 @@ def to_gke(
session_service_uri: Optional[str] = None,
artifact_service_uri: Optional[str] = None,
memory_service_uri: Optional[str] = None,
use_local_storage: bool = False,
a2a: bool = False,
):
"""Deploys an agent to Google Kubernetes Engine(GKE).
Expand All @@ -969,6 +989,7 @@ def to_gke(
session_service_uri: The URI of the session service.
artifact_service_uri: The URI of the artifact service.
memory_service_uri: The URI of the memory service.
use_local_storage: Whether to use local .adk storage in the container.
"""
click.secho(
'\n🚀 Starting ADK Agent Deployment to GKE...', fg='cyan', bold=True
Expand All @@ -982,6 +1003,9 @@ def to_gke(
click.echo('--------------------------------------------------\n')

app_name = app_name or os.path.basename(agent_folder)
if parse(adk_version) >= parse('1.3.0') and not use_local_storage:
session_service_uri = session_service_uri or 'memory://'
artifact_service_uri = artifact_service_uri or 'memory://'

click.secho('STEP 1: Preparing build environment...', bold=True)
click.echo(f' - Using temporary directory: {temp_folder}')
Expand Down Expand Up @@ -1024,6 +1048,7 @@ def to_gke(
session_service_uri,
artifact_service_uri,
memory_service_uri,
use_local_storage,
),
trace_to_cloud_option='--trace_to_cloud' if trace_to_cloud else '',
allow_origins_option=allow_origins_option,
Expand Down
Loading
Loading