@@ -1452,6 +1452,7 @@ def fast_api_common_options():
14521452 """Decorator to add common fast api options to click commands."""
14531453
14541454 def decorator (func ):
1455+
14551456 @click .option (
14561457 "--host" ,
14571458 type = str ,
@@ -1556,6 +1557,17 @@ def decorator(func):
15561557 ),
15571558 default = None ,
15581559 )
1560+ # Parsed into list[str] by the wrapper below (server commands need a list).
1561+ @click .option (
1562+ "--trigger_sources" ,
1563+ type = str ,
1564+ help = (
1565+ "Optional. Comma-separated list of trigger sources to enable"
1566+ " (e.g., 'pubsub,eventarc'). Registers /apps/{app_name}/trigger/*"
1567+ " endpoints for batch and event-driven agent invocations."
1568+ ),
1569+ default = None ,
1570+ )
15591571 @functools .wraps (func )
15601572 @click .pass_context
15611573 def wrapper (ctx , * args , ** kwargs ):
@@ -1567,6 +1579,13 @@ def wrapper(ctx, *args, **kwargs):
15671579 ):
15681580 kwargs ["log_level" ] = "DEBUG"
15691581
1582+ # Parse comma-separated trigger_sources into a list.
1583+ trigger_sources = kwargs .get ("trigger_sources" )
1584+ if trigger_sources is not None :
1585+ kwargs ["trigger_sources" ] = [
1586+ s .strip () for s in trigger_sources .split ("," ) if s .strip ()
1587+ ]
1588+
15701589 return func (* args , ** kwargs )
15711590
15721591 return wrapper
@@ -1609,6 +1628,7 @@ def cli_web(
16091628 extra_plugins : Optional [list [str ]] = None ,
16101629 logo_text : Optional [str ] = None ,
16111630 logo_image_url : Optional [str ] = None ,
1631+ trigger_sources : Optional [list [str ]] = None ,
16121632):
16131633 """Starts a FastAPI server with Web UI for agents.
16141634
@@ -1665,6 +1685,7 @@ async def _lifespan(app: FastAPI):
16651685 extra_plugins = extra_plugins ,
16661686 logo_text = logo_text ,
16671687 logo_image_url = logo_image_url ,
1688+ trigger_sources = trigger_sources ,
16681689 )
16691690 config = uvicorn .Config (
16701691 app ,
@@ -1720,6 +1741,7 @@ def cli_api_server(
17201741 reload_agents : bool = False ,
17211742 extra_plugins : Optional [list [str ]] = None ,
17221743 auto_create_session : bool = False ,
1744+ trigger_sources : Optional [list [str ]] = None ,
17231745):
17241746 """Starts a FastAPI server for agents.
17251747
@@ -1753,6 +1775,7 @@ def cli_api_server(
17531775 reload_agents = reload_agents ,
17541776 extra_plugins = extra_plugins ,
17551777 auto_create_session = auto_create_session ,
1778+ trigger_sources = trigger_sources ,
17561779 ),
17571780 host = host ,
17581781 port = port ,
@@ -1887,6 +1910,17 @@ def cli_api_server(
18871910 default = False ,
18881911 help = "Optional. Whether to enable A2A endpoint." ,
18891912)
1913+ # Kept as raw str (not parsed to list) — interpolated directly into Dockerfile CMD.
1914+ @click .option (
1915+ "--trigger_sources" ,
1916+ type = str ,
1917+ help = (
1918+ "Optional. Comma-separated list of trigger sources to enable"
1919+ " (e.g., 'pubsub,eventarc'). Registers /trigger/* endpoints"
1920+ " for batch and event-driven agent invocations."
1921+ ),
1922+ default = None ,
1923+ )
18901924@click .option (
18911925 "--allow_origins" ,
18921926 help = (
@@ -1923,6 +1957,7 @@ def cli_deploy_cloud_run(
19231957 session_db_url : Optional [str ] = None , # Deprecated
19241958 artifact_storage_uri : Optional [str ] = None , # Deprecated
19251959 a2a : bool = False ,
1960+ trigger_sources : Optional [str ] = None ,
19261961):
19271962 """Deploys an agent to Cloud Run.
19281963
@@ -2000,6 +2035,7 @@ def cli_deploy_cloud_run(
20002035 memory_service_uri = memory_service_uri ,
20012036 use_local_storage = use_local_storage ,
20022037 a2a = a2a ,
2038+ trigger_sources = trigger_sources ,
20032039 extra_gcloud_args = tuple (gcloud_args ),
20042040 )
20052041 except Exception as e :
@@ -2397,6 +2433,17 @@ def cli_deploy_agent_engine(
23972433 " version in the dev environment)"
23982434 ),
23992435)
2436+ # Kept as raw str (not parsed to list) — interpolated directly into Dockerfile CMD.
2437+ @click .option (
2438+ "--trigger_sources" ,
2439+ type = str ,
2440+ help = (
2441+ "Optional. Comma-separated list of trigger sources to enable"
2442+ " (e.g., 'pubsub,eventarc'). Registers /trigger/* endpoints"
2443+ " for batch and event-driven agent invocations."
2444+ ),
2445+ default = None ,
2446+ )
24002447@adk_services_options (default_use_local_storage = False )
24012448@click .argument (
24022449 "agent" ,
@@ -2423,6 +2470,7 @@ def cli_deploy_gke(
24232470 artifact_service_uri : Optional [str ] = None ,
24242471 memory_service_uri : Optional [str ] = None ,
24252472 use_local_storage : bool = False ,
2473+ trigger_sources : Optional [str ] = None ,
24262474):
24272475 """Deploys an agent to GKE.
24282476
@@ -2454,6 +2502,7 @@ def cli_deploy_gke(
24542502 artifact_service_uri = artifact_service_uri ,
24552503 memory_service_uri = memory_service_uri ,
24562504 use_local_storage = use_local_storage ,
2505+ trigger_sources = trigger_sources ,
24572506 )
24582507 except Exception as e :
24592508 click .secho (f"Deploy failed: { e } " , fg = "red" , err = True )
0 commit comments