Runs an interactive CLI for a certain agent. Args: agent_parent_dir: str, the absolute path of the parent folder of the agent folder. agent_folder_name: str, the name of the agent folder. input_file: Optional[str], the absolute path to the json file that contains the initi
(
*,
agent_parent_dir: str,
agent_folder_name: str,
input_file: Optional[str] = None,
saved_session_file: Optional[str] = None,
save_session: bool,
session_id: Optional[str] = None,
state_str: Optional[str] = None,
timeout: Optional[str] = None,
in_memory: bool = False,
jsonl: bool = False,
session_service_uri: Optional[str] = None,
artifact_service_uri: Optional[str] = None,
memory_service_uri: Optional[str] = None,
use_local_storage: bool = True,
default_llm_model: Optional[str] = None,
)
| 395 | |
| 396 | |
| 397 | async def run_cli( |
| 398 | *, |
| 399 | agent_parent_dir: str, |
| 400 | agent_folder_name: str, |
| 401 | input_file: Optional[str] = None, |
| 402 | saved_session_file: Optional[str] = None, |
| 403 | save_session: bool, |
| 404 | session_id: Optional[str] = None, |
| 405 | state_str: Optional[str] = None, |
| 406 | timeout: Optional[str] = None, |
| 407 | in_memory: bool = False, |
| 408 | jsonl: bool = False, |
| 409 | session_service_uri: Optional[str] = None, |
| 410 | artifact_service_uri: Optional[str] = None, |
| 411 | memory_service_uri: Optional[str] = None, |
| 412 | use_local_storage: bool = True, |
| 413 | default_llm_model: Optional[str] = None, |
| 414 | ) -> None: |
| 415 | """Runs an interactive CLI for a certain agent. |
| 416 | |
| 417 | Args: |
| 418 | agent_parent_dir: str, the absolute path of the parent folder of the agent |
| 419 | folder. |
| 420 | agent_folder_name: str, the name of the agent folder. |
| 421 | input_file: Optional[str], the absolute path to the json file that contains |
| 422 | the initial session state and user queries, exclusive with |
| 423 | saved_session_file. |
| 424 | saved_session_file: Optional[str], the absolute path to the json file that |
| 425 | contains a previously saved session, exclusive with input_file. |
| 426 | save_session: bool, whether to save the session on exit. |
| 427 | session_id: Optional[str], the session ID to save the session to on exit. |
| 428 | session_service_uri: Optional[str], custom session service URI. |
| 429 | artifact_service_uri: Optional[str], custom artifact service URI. |
| 430 | memory_service_uri: Optional[str], custom memory service URI. |
| 431 | use_local_storage: bool, whether to use local .adk storage by default. |
| 432 | """ |
| 433 | ( |
| 434 | agent_or_app, |
| 435 | session_service, |
| 436 | artifact_service, |
| 437 | memory_service, |
| 438 | credential_service, |
| 439 | user_id, |
| 440 | session_app_name, |
| 441 | agent_root, |
| 442 | ) = _setup_runner_context( |
| 443 | agent_parent_dir=agent_parent_dir, |
| 444 | agent_folder_name=agent_folder_name, |
| 445 | in_memory=in_memory, |
| 446 | session_service_uri=session_service_uri, |
| 447 | artifact_service_uri=artifact_service_uri, |
| 448 | memory_service_uri=memory_service_uri, |
| 449 | use_local_storage=use_local_storage, |
| 450 | default_llm_model=default_llm_model, |
| 451 | ) |
| 452 | |
| 453 | # Helper function for printing events |
| 454 | if input_file: |
no test coverage detected