mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-16 04:02:55 -06:00
feat: Add session_db_url to adk deploy
option.
PiperOrigin-RevId: 750355535
This commit is contained in:
parent
956fb912e8
commit
a9da7a8fc3
@ -54,7 +54,7 @@ COPY "agents/{app_name}/" "/app/agents/{app_name}/"
|
|||||||
|
|
||||||
EXPOSE {port}
|
EXPOSE {port}
|
||||||
|
|
||||||
CMD adk {command} --port={port} {trace_to_cloud_option} "/app/agents"
|
CMD adk {command} --port={port} {session_db_option} {trace_to_cloud_option} "/app/agents"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -85,6 +85,7 @@ def to_cloud_run(
|
|||||||
trace_to_cloud: bool,
|
trace_to_cloud: bool,
|
||||||
with_ui: bool,
|
with_ui: bool,
|
||||||
verbosity: str,
|
verbosity: str,
|
||||||
|
session_db_url: str,
|
||||||
):
|
):
|
||||||
"""Deploys an agent to Google Cloud Run.
|
"""Deploys an agent to Google Cloud Run.
|
||||||
|
|
||||||
@ -112,6 +113,7 @@ def to_cloud_run(
|
|||||||
trace_to_cloud: Whether to enable Cloud Trace.
|
trace_to_cloud: Whether to enable Cloud Trace.
|
||||||
with_ui: Whether to deploy with UI.
|
with_ui: Whether to deploy with UI.
|
||||||
verbosity: The verbosity level of the CLI.
|
verbosity: The verbosity level of the CLI.
|
||||||
|
session_db_url: The database URL to connect the session.
|
||||||
"""
|
"""
|
||||||
app_name = app_name or os.path.basename(agent_folder)
|
app_name = app_name or os.path.basename(agent_folder)
|
||||||
|
|
||||||
@ -144,6 +146,9 @@ def to_cloud_run(
|
|||||||
port=port,
|
port=port,
|
||||||
command='web' if with_ui else 'api_server',
|
command='web' if with_ui else 'api_server',
|
||||||
install_agent_deps=install_agent_deps,
|
install_agent_deps=install_agent_deps,
|
||||||
|
session_db_option=f'--session_db_url={session_db_url}'
|
||||||
|
if session_db_url
|
||||||
|
else '',
|
||||||
trace_to_cloud_option='--trace_to_cloud' if trace_to_cloud else '',
|
trace_to_cloud_option='--trace_to_cloud' if trace_to_cloud else '',
|
||||||
)
|
)
|
||||||
dockerfile_path = os.path.join(temp_folder, 'Dockerfile')
|
dockerfile_path = os.path.join(temp_folder, 'Dockerfile')
|
||||||
|
@ -245,12 +245,13 @@ def cli_eval(
|
|||||||
@click.option(
|
@click.option(
|
||||||
"--session_db_url",
|
"--session_db_url",
|
||||||
help=(
|
help=(
|
||||||
"Optional. The database URL to store the session.\n\n - Use"
|
"""Optional. The database URL to store the session.
|
||||||
" 'agentengine://<agent_engine_resource_id>' to connect to Vertex"
|
|
||||||
" managed session service.\n\n - Use 'sqlite://<path_to_sqlite_file>'"
|
- Use 'agentengine://<agent_engine_resource_id>' to connect to Agent Engine sessions.
|
||||||
" to connect to a SQLite DB.\n\n - See"
|
|
||||||
" https://docs.sqlalchemy.org/en/20/core/engines.html#backend-specific-urls"
|
- Use 'sqlite://<path_to_sqlite_file>' to connect to a SQLite DB.
|
||||||
" for more details on supported DB URLs."
|
|
||||||
|
- See https://docs.sqlalchemy.org/en/20/core/engines.html#backend-specific-urls for more details on supported DB URLs."""
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
@ -366,12 +367,13 @@ def cli_web(
|
|||||||
@click.option(
|
@click.option(
|
||||||
"--session_db_url",
|
"--session_db_url",
|
||||||
help=(
|
help=(
|
||||||
"Optional. The database URL to store the session.\n\n - Use"
|
"""Optional. The database URL to store the session.
|
||||||
" 'agentengine://<agent_engine_resource_id>' to connect to Vertex"
|
|
||||||
" managed session service.\n\n - Use 'sqlite://<path_to_sqlite_file>'"
|
- Use 'agentengine://<agent_engine_resource_id>' to connect to Agent Engine sessions.
|
||||||
" to connect to a SQLite DB.\n\n - See"
|
|
||||||
" https://docs.sqlalchemy.org/en/20/core/engines.html#backend-specific-urls"
|
- Use 'sqlite://<path_to_sqlite_file>' to connect to a SQLite DB.
|
||||||
" for more details on supported DB URLs."
|
|
||||||
|
- See https://docs.sqlalchemy.org/en/20/core/engines.html#backend-specific-urls for more details on supported DB URLs."""
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
@ -541,6 +543,18 @@ def cli_api_server(
|
|||||||
default="WARNING",
|
default="WARNING",
|
||||||
help="Optional. Override the default verbosity level.",
|
help="Optional. Override the default verbosity level.",
|
||||||
)
|
)
|
||||||
|
@click.option(
|
||||||
|
"--session_db_url",
|
||||||
|
help=(
|
||||||
|
"""Optional. The database URL to store the session.
|
||||||
|
|
||||||
|
- Use 'agentengine://<agent_engine_resource_id>' to connect to Agent Engine sessions.
|
||||||
|
|
||||||
|
- Use 'sqlite://<path_to_sqlite_file>' to connect to a SQLite DB.
|
||||||
|
|
||||||
|
- See https://docs.sqlalchemy.org/en/20/core/engines.html#backend-specific-urls for more details on supported DB URLs."""
|
||||||
|
),
|
||||||
|
)
|
||||||
@click.argument(
|
@click.argument(
|
||||||
"agent",
|
"agent",
|
||||||
type=click.Path(
|
type=click.Path(
|
||||||
@ -558,6 +572,7 @@ def cli_deploy_cloud_run(
|
|||||||
trace_to_cloud: bool,
|
trace_to_cloud: bool,
|
||||||
with_ui: bool,
|
with_ui: bool,
|
||||||
verbosity: str,
|
verbosity: str,
|
||||||
|
session_db_url: str,
|
||||||
):
|
):
|
||||||
"""Deploys an agent to Cloud Run.
|
"""Deploys an agent to Cloud Run.
|
||||||
|
|
||||||
@ -579,6 +594,7 @@ def cli_deploy_cloud_run(
|
|||||||
trace_to_cloud=trace_to_cloud,
|
trace_to_cloud=trace_to_cloud,
|
||||||
with_ui=with_ui,
|
with_ui=with_ui,
|
||||||
verbosity=verbosity,
|
verbosity=verbosity,
|
||||||
|
session_db_url=session_db_url,
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
click.secho(f"Deploy failed: {e}", fg="red", err=True)
|
click.secho(f"Deploy failed: {e}", fg="red", err=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user