From 0501daa54236603771a4c24e1e040c739961d759 Mon Sep 17 00:00:00 2001 From: Huang Huang Date: Mon, 20 Oct 2025 14:01:36 +0800 Subject: [PATCH 1/2] fix(kagent-adk/cli/test): fix "NotADirectoryError: [Errno 20] Not a directory: 'xxx/agent-card.json'" ## Before ``` $ uv run cli.py test --task 'who are you' --filepath config.json ... NotADirectoryError: [Errno 20] Not a directory: 'config.json/agent-card.json' ``` ## After ``` $ uv run cli.py test --task 'who are you' --agent-config config.json --agent-card agent-card.json ... INFO:root:Starting KAgent INFO:kagent.adk._a2a: >>> User Query: who are you ... ``` Signed-off-by: Huang Huang Signed-off-by: mozillazg --- python/packages/kagent-adk/src/kagent/adk/cli.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/packages/kagent-adk/src/kagent/adk/cli.py b/python/packages/kagent-adk/src/kagent/adk/cli.py index c007b2614..1ab42afa7 100644 --- a/python/packages/kagent-adk/src/kagent/adk/cli.py +++ b/python/packages/kagent-adk/src/kagent/adk/cli.py @@ -98,13 +98,14 @@ async def test_agent(agent_config: AgentConfig, agent_card: AgentCard, task: str @app.command() def test( task: Annotated[str, typer.Option("--task", help="The task to test the agent with")], - filepath: Annotated[str, typer.Option("--filepath", help="The path to the agent config file")], + config_file: Annotated[str, typer.Option("--agent-config", help="The path to the agent config file")], + card_file: Annotated[str, typer.Option("--agent-card", help="The path to the agent card file")], ): - with open(filepath, "r") as f: + with open(config_file, "r") as f: content = f.read() config = json.loads(content) - with open(os.path.join(filepath, "agent-card.json"), "r") as f: + with open(card_file, "r") as f: agent_card = json.load(f) agent_card = AgentCard.model_validate(agent_card) agent_config = AgentConfig.model_validate(config) From c3e6e0d61e33b0f2e2b2df875a487ae0f7155d3f Mon Sep 17 00:00:00 2001 From: mozillazg Date: Wed, 29 Oct 2025 17:42:33 +0800 Subject: [PATCH 2/2] apply review suggests Signed-off-by: mozillazg --- python/packages/kagent-adk/src/kagent/adk/cli.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/python/packages/kagent-adk/src/kagent/adk/cli.py b/python/packages/kagent-adk/src/kagent/adk/cli.py index 1ab42afa7..3aa90c109 100644 --- a/python/packages/kagent-adk/src/kagent/adk/cli.py +++ b/python/packages/kagent-adk/src/kagent/adk/cli.py @@ -98,14 +98,12 @@ async def test_agent(agent_config: AgentConfig, agent_card: AgentCard, task: str @app.command() def test( task: Annotated[str, typer.Option("--task", help="The task to test the agent with")], - config_file: Annotated[str, typer.Option("--agent-config", help="The path to the agent config file")], - card_file: Annotated[str, typer.Option("--agent-card", help="The path to the agent card file")], + filepath: Annotated[str, typer.Option("--filepath", help="The path to the directory of config files")], ): - with open(config_file, "r") as f: - content = f.read() - config = json.loads(content) + with open(os.path.join(filepath, "config.json"), "r") as f: + config = json.load(f) - with open(card_file, "r") as f: + with open(os.path.join(filepath, "agent-card.json"), "r") as f: agent_card = json.load(f) agent_card = AgentCard.model_validate(agent_card) agent_config = AgentConfig.model_validate(config)