MCPcopy Index your code
hub / github.com/google/adk-python / cli_run

Function cli_run

src/google/adk/cli/cli_tools_click.py:723–799  ·  view source on GitHub ↗

Runs an agent. If no query is provided, enters interactive mode. AGENT: The path to the agent source code folder. QUERY: Optional. The user message to send to the agent for a single-step run. Example: adk run path/to/my_agent adk run path/to/my_agent "hello"

(
    agent: str,
    query: Optional[str],
    save_session: bool,
    session_id: Optional[str],
    replay: Optional[str],
    resume: Optional[str],
    state: 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,
    log_level: str = "INFO",
)

Source from the content-addressed store, hash-verified

721)
722@click.argument("query", type=str, required=False)
723def cli_run(
724 agent: str,
725 query: Optional[str],
726 save_session: bool,
727 session_id: Optional[str],
728 replay: Optional[str],
729 resume: Optional[str],
730 state: Optional[str] = None,
731 timeout: Optional[str] = None,
732 in_memory: bool = False,
733 jsonl: bool = False,
734 session_service_uri: Optional[str] = None,
735 artifact_service_uri: Optional[str] = None,
736 memory_service_uri: Optional[str] = None,
737 use_local_storage: bool = True,
738 default_llm_model: Optional[str] = None,
739 log_level: str = "INFO",
740):
741 """Runs an agent. If no query is provided, enters interactive mode.
742
743 AGENT: The path to the agent source code folder.
744 QUERY: Optional. The user message to send to the agent for a single-step run.
745
746 Example:
747
748 adk run path/to/my_agent
749 adk run path/to/my_agent "hello"
750 """
751 logs.log_to_tmp_folder(level=getattr(logging, log_level.upper()))
752
753 agent_parent_folder = os.path.dirname(agent)
754 agent_folder_name = os.path.basename(agent)
755
756 # If query is provided, we run in single-step mode (JSONL output)
757 if query is not None:
758 from .cli import run_once_cli
759
760 exit_code = asyncio.run(
761 run_once_cli(
762 agent_parent_dir=agent_parent_folder,
763 agent_folder_name=agent_folder_name,
764 query=query,
765 state_str=state,
766 session_id=session_id,
767 replay=replay,
768 timeout=timeout,
769 in_memory=in_memory,
770 jsonl=jsonl,
771 session_service_uri=session_service_uri,
772 artifact_service_uri=artifact_service_uri,
773 memory_service_uri=memory_service_uri,
774 use_local_storage=use_local_storage,
775 default_llm_model=default_llm_model,
776 )
777 )
778 sys.exit(exit_code)
779 else:
780 # Legacy interactive mode

Callers

nothing calls this directly

Calls 5

getattrFunction · 0.85
run_once_cliFunction · 0.85
run_cliFunction · 0.85
exitMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected