@@ -33,6 +33,8 @@ def version():
3333def list_agents (
3434 location : Annotated [str , typer .Option ("--location" , "-l" , help = "Google Cloud region" )],
3535 project : Annotated [str | None , typer .Option ("--project" , "-p" , help = "Google Cloud project ID (defaults to ADC project)" )] = None ,
36+ base_url : Annotated [str | None , typer .Option ("--base-url" , help = "Override the Vertex AI base URL" )] = None ,
37+ api_version : Annotated [str | None , typer .Option ("--api-version" , help = "Override the API version" )] = None ,
3638) -> None :
3739 """List all agents in the project."""
3840 try :
@@ -42,7 +44,7 @@ def list_agents(
4244 raise typer .Exit (code = 1 )
4345
4446 try :
45- client = get_client (project = project , location = location )
47+ client = get_client (project = project , location = location , base_url = base_url , api_version = api_version )
4648 agents = list (client .list_agents ())
4749
4850 if not agents :
@@ -99,6 +101,8 @@ def get_agent(
99101 location : Annotated [str , typer .Option ("--location" , "-l" , help = "Google Cloud region" )],
100102 project : Annotated [str | None , typer .Option ("--project" , "-p" , help = "Google Cloud project ID (defaults to ADC project)" )] = None ,
101103 full : Annotated [bool , typer .Option ("--full" , "-f" , help = "Show full JSON output" )] = False ,
104+ base_url : Annotated [str | None , typer .Option ("--base-url" , help = "Override the Vertex AI base URL" )] = None ,
105+ api_version : Annotated [str | None , typer .Option ("--api-version" , help = "Override the API version" )] = None ,
102106) -> None :
103107 """Get details for a specific agent."""
104108 try :
@@ -108,7 +112,7 @@ def get_agent(
108112 raise typer .Exit (code = 1 )
109113
110114 try :
111- client = get_client (project = project , location = location )
115+ client = get_client (project = project , location = location , base_url = base_url , api_version = api_version )
112116 agent = client .get_agent (agent_id )
113117
114118 # v1beta1 api_resource uses 'name' instead of 'resource_name'
@@ -239,6 +243,8 @@ def create_agent(
239243 str | None ,
240244 typer .Option ("--service-account" , "-s" , help = "Service account email (only used with --identity service_account)" ),
241245 ] = None ,
246+ base_url : Annotated [str | None , typer .Option ("--base-url" , help = "Override the Vertex AI base URL" )] = None ,
247+ api_version : Annotated [str | None , typer .Option ("--api-version" , help = "Override the API version" )] = None ,
242248) -> None :
243249 """Create a new agent (without deploying code)."""
244250 try :
@@ -248,7 +254,7 @@ def create_agent(
248254 raise typer .Exit (code = 1 )
249255
250256 try :
251- client = get_client (project = project , location = location )
257+ client = get_client (project = project , location = location , base_url = base_url , api_version = api_version )
252258 console .print (f"Creating agent '{ escape (display_name )} '..." )
253259
254260 agent = client .create_agent (
@@ -274,6 +280,8 @@ def delete_agent(
274280 project : Annotated [str | None , typer .Option ("--project" , "-p" , help = "Google Cloud project ID (defaults to ADC project)" )] = None ,
275281 force : Annotated [bool , typer .Option ("--force" , "-f" , help = "Force deletion of agents with sessions/memory" )] = False ,
276282 yes : Annotated [bool , typer .Option ("--yes" , "-y" , help = "Skip confirmation prompt" )] = False ,
283+ base_url : Annotated [str | None , typer .Option ("--base-url" , help = "Override the Vertex AI base URL" )] = None ,
284+ api_version : Annotated [str | None , typer .Option ("--api-version" , help = "Override the API version" )] = None ,
277285) -> None :
278286 """Delete an agent."""
279287 try :
@@ -289,7 +297,7 @@ def delete_agent(
289297 raise typer .Exit ()
290298
291299 try :
292- client = get_client (project = project , location = location )
300+ client = get_client (project = project , location = location , base_url = base_url , api_version = api_version )
293301 client .delete_agent (agent_id , force = force )
294302 console .print (f"[red]Agent '{ escape (agent_id )} ' deleted.[/red]" )
295303 except Exception as e :
@@ -307,6 +315,8 @@ def list_sessions(
307315 agent_id : Annotated [str , typer .Argument (help = "Agent ID or full resource name" )],
308316 location : Annotated [str , typer .Option ("--location" , "-l" , help = "Google Cloud region" )],
309317 project : Annotated [str | None , typer .Option ("--project" , "-p" , help = "Google Cloud project ID (defaults to ADC project)" )] = None ,
318+ base_url : Annotated [str | None , typer .Option ("--base-url" , help = "Override the Vertex AI base URL" )] = None ,
319+ api_version : Annotated [str | None , typer .Option ("--api-version" , help = "Override the API version" )] = None ,
310320) -> None :
311321 """List all sessions for an agent."""
312322 try :
@@ -316,7 +326,7 @@ def list_sessions(
316326 raise typer .Exit (code = 1 )
317327
318328 try :
319- client = get_client (project = project , location = location )
329+ client = get_client (project = project , location = location , base_url = base_url , api_version = api_version )
320330 sessions = list (client .list_sessions (agent_id ))
321331
322332 if not sessions :
@@ -375,6 +385,8 @@ def list_sandboxes(
375385 agent_id : Annotated [str , typer .Argument (help = "Agent ID or full resource name" )],
376386 location : Annotated [str , typer .Option ("--location" , "-l" , help = "Google Cloud region" )],
377387 project : Annotated [str | None , typer .Option ("--project" , "-p" , help = "Google Cloud project ID (defaults to ADC project)" )] = None ,
388+ base_url : Annotated [str | None , typer .Option ("--base-url" , help = "Override the Vertex AI base URL" )] = None ,
389+ api_version : Annotated [str | None , typer .Option ("--api-version" , help = "Override the API version" )] = None ,
378390) -> None :
379391 """List all sandboxes for an agent."""
380392 try :
@@ -384,7 +396,7 @@ def list_sandboxes(
384396 raise typer .Exit (code = 1 )
385397
386398 try :
387- client = get_client (project = project , location = location )
399+ client = get_client (project = project , location = location , base_url = base_url , api_version = api_version )
388400 sandboxes = list (client .list_sandboxes (agent_id ))
389401
390402 if not sandboxes :
@@ -449,6 +461,8 @@ def list_memories(
449461 agent_id : Annotated [str , typer .Argument (help = "Agent ID or full resource name" )],
450462 location : Annotated [str , typer .Option ("--location" , "-l" , help = "Google Cloud region" )],
451463 project : Annotated [str | None , typer .Option ("--project" , "-p" , help = "Google Cloud project ID (defaults to ADC project)" )] = None ,
464+ base_url : Annotated [str | None , typer .Option ("--base-url" , help = "Override the Vertex AI base URL" )] = None ,
465+ api_version : Annotated [str | None , typer .Option ("--api-version" , help = "Override the API version" )] = None ,
452466) -> None :
453467 """List all memories for an agent."""
454468 try :
@@ -458,7 +472,7 @@ def list_memories(
458472 raise typer .Exit (code = 1 )
459473
460474 try :
461- client = get_client (project = project , location = location )
475+ client = get_client (project = project , location = location , base_url = base_url , api_version = api_version )
462476 memories = list (client .list_memories (agent_id ))
463477
464478 table = Table (title = "Memories" )
@@ -525,6 +539,8 @@ def chat(
525539 project : Annotated [str | None , typer .Option ("--project" , "-p" , help = "Google Cloud project ID (defaults to ADC project)" )] = None ,
526540 user : Annotated [str , typer .Option ("--user" , "-u" , help = "User ID for the chat session" )] = "cli-user" ,
527541 debug : Annotated [bool , typer .Option ("--debug" , "-d" , help = "Enable verbose HTTP debug logging" )] = False ,
542+ base_url : Annotated [str | None , typer .Option ("--base-url" , help = "Override the Vertex AI base URL" )] = None ,
543+ api_version : Annotated [str | None , typer .Option ("--api-version" , help = "Override the API version" )] = None ,
528544) -> None :
529545 """Start an interactive chat session with an agent."""
530546 try :
@@ -540,6 +556,8 @@ def chat(
540556 agent_id = agent_id ,
541557 user_id = user ,
542558 debug = debug ,
559+ base_url = base_url ,
560+ api_version = api_version ,
543561 ))
544562 except KeyboardInterrupt :
545563 console .print ("\n [yellow]Chat session ended.[/yellow]" )
0 commit comments