adk-python
adk-python copied to clipboard
adk eval command fails when root_agent is a coroutine
As described in the docs here, my root_agent is a coroutine. However, the adk eval command doesn't support this and errors out:
(agents) vscode ➜ /workspaces/agents (tests) $ adk eval agent_dir/ my_agent/tests/integration/huntr.eval.json
Using evaluation creiteria: {'tool_trajectory_avg_score': 1.0, 'response_match_score': 0.8}
Running Eval: my_agent/tests/integration/huntr.eval.json:huntr_agent
Exception in thread Thread-1 (_asyncio_thread_main):
Traceback (most recent call last):
File "/usr/local/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.12/threading.py", line 1012, in run
self._target(*self._args, **self._kwargs)
File "/workspaces/agents/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 138, in _asyncio_thread_main
asyncio.run(_invoke_run_async())
File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/workspaces/agents/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 126, in _invoke_run_async
async for event in self.run_async(
File "/workspaces/agents/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 181, in run_async
invocation_context = self._new_invocation_context(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspaces/agents/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 397, in _new_invocation_context
return InvocationContext(
^^^^^^^^^^^^^^^^^^
File "/workspaces/agents/.venv/lib/python3.12/site-packages/pydantic/main.py", line 253, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for InvocationContext
agent
Input should be a valid dictionary or instance of BaseAgent [type=model_type, input_value=<coroutine object ...agent at 0xffff80b78370>, input_type=coroutine]
For further information visit https://errors.pydantic.dev/2.11/v/model_type
Does adk run in cli normally? I'm seeing similar issue in adk run, web works fine. I'm using mcp tools.
This has been fixed recently. Please use the latest from github.