Description
** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.
Describe the bug
Hello there,
I want to create root agent who will have agent as a tool (2x) to pass them information gathered from AUDIO
affect_alignment_agent = Agent(
model="gemini-2.0-flash-exp",
name="affect_alignment_agent",
description="Affect alignment agent",
instruction=affect_aligment,
)
engagement_agent = Agent(
model="gemini-2.0-flash-exp",
name="engagement_agent",
description="Engagement agent",
instruction=engagement,
)
affect_alignment_tool = agent_tool.AgentTool(agent=affect_alignment_agent) # Wrap the agent
engagement_tool = agent_tool.AgentTool(agent=engagement_agent) # Wrap the agent
root_agent = Agent(
model="gemini-2.0-flash-exp",
name="root_agent",
description="Root agent that coordinates the affect alignment and engagement agents",
instruction="""
You are responsible for coordinating the affect alignment and engagement agents tools.
Send user input to the tools and wait for their responses.
Combine the responses from the tools and send the final response to the user.
""",
tools=[affect_alignment_tool, engagement_tool],
)
what I can see from the Raw response:
{"candidates":[{"content":{"parts":[{"text":"```text\nDetected Emotional State: Neutral (valence = 0.5, arousal = 0.5). Delta from baseline: No significant change.\nStrategy: Maintain a neutral and friendly tone as the user's emotional state is currently stable.\n\nResponse: \"Hello! I'm doing well, thank you for asking. How can I assist you today?\"\n```\n"}],"role":"model"},"finish_reason":"STOP","avg_logprobs":-0.13121765087812376}],"model_version":"gemini-2.0-flash-exp","usage_metadata":{"candidates_token_count":78,"candidates_tokens_details":[{"modality":"TEXT","token_count":78}],"prompt_token_count":1111,"prompt_tokens_details":[{"modality":"TEXT","token_count":1111}],"total_token_count":1189},"automatic_function_calling_history":[]}
I got some first response but later error occurred:
You are an agent. Your internal name is "affect_alignment_agent".
The description about you is "Affect alignment agent"
-----------------------------------------------------------
Contents:
{"parts":[{"text":"Hello, how are you?"}],"role":"user"}
-----------------------------------------------------------
Functions:
-----------------------------------------------------------
2025-06-06 14:47:49,211 - INFO - models.py:7466 - AFC is enabled with max remote calls: 10.
2025-06-06 14:47:50,227 - INFO - _client.py:1740 - HTTP Request: POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:generateContent "HTTP/1.1 200 OK"
2025-06-06 14:47:50,230 - INFO - google_llm.py:167 -
LLM Response:
-----------------------------------------------------------
Text:
Detected Emotional State: Neutral (valence = 0.5, arousal = 0.5). Delta from baseline: No significant change.
Strategy: Maintain a neutral and friendly tone as the user's emotional state is currently stable.
Response: "Hello! I'm doing well, thank you for asking. How can I assist you today?"
-----------------------------------------------------------
Function calls:
-----------------------------------------------------------
Raw response:
{"candidates":[{"content":{"parts":[{"text":"```text\nDetected Emotional State: Neutral (valence = 0.5, arousal = 0.5). Delta from baseline: No significant change.\nStrategy: Maintain a neutral and friendly tone as the user's emotional state is currently stable.\n\nResponse: \"Hello! I'm doing well, thank you for asking. How can I assist you today?\"\n```\n"}],"role":"model"},"finish_reason":"STOP","avg_logprobs":-0.13121765087812376}],"model_version":"gemini-2.0-flash-exp","usage_metadata":{"candidates_token_count":78,"candidates_tokens_details":[{"modality":"TEXT","token_count":78}],"prompt_token_count":1111,"prompt_tokens_details":[{"modality":"TEXT","token_count":1111}],"total_token_count":1189},"automatic_function_calling_history":[]}
-----------------------------------------------------------
2025-06-06 14:47:50,279 - ERROR - fast_api.py:908 - Error during live websocket communication: BaseEventLoop.create_connection() got an unexpected keyword argument 'extra_headers'
Traceback (most recent call last):
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/genai/live.py", line 1046, in connect
yield AsyncSession(api_client=self._api_client, websocket=ws)
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/models/google_llm.py", line 243, in connect
yield GeminiLlmConnection(live_session)
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 115, in run_live
async for event in self._receive_from_model(
...<36 lines>...
return
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 246, in _receive_from_model
async for event in self._postprocess_live(
...<23 lines>...
yield event
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 439, in _postprocess_live
function_response_event = await functions.handle_function_calls_live(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
invocation_context, model_response_event, llm_request.tools_dict
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/functions.py", line 288, in handle_function_calls_live
trace_tool_call(
~~~~~~~~~~~~~~~^
tool=tool,
^^^^^^^^^^
...<2 lines>...
function_response=function_response,
^^^^^^^^^^^^^^^^^^^^
7D52
^^^^^^^^^^^^^^^^
)
^
TypeError: trace_tool_call() got an unexpected keyword argument 'response_event_id'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/cli/fast_api.py", line 904, in agent_live_run
task.result()
~~~~~~~~~~~^^
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/cli/fast_api.py", line 877, in forward_events
async for event in runner.run_live(
...<4 lines>...
)
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/runners.py", line 325, in run_live
async for event in invocation_context.agent.run_live(invocation_context):
await self.session_service.append_event(session=session, event=event)
yield event
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/agents/base_agent.py", line 174, in run_live
async for event in self._run_live_impl(ctx):
yield event
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/agents/llm_agent.py", line 286, in _run_live_impl
async for event in self._llm_flow.run_live(ctx):
self.__maybe_save_output_to_state(event)
yield event
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 87, in run_live
async with llm.connect(llm_request) as llm_connection:
~~~~~~~~~~~^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py", line 235, in __aexit__
await self.gen.athrow(value)
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/models/google_llm.py", line 240, in connect
async with self._live_api_client.aio.live.connect(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
model=llm_request.model, config=llm_request.live_connect_config
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
) as live_session:
^
File "/opt/homebrew/Cellar/python@3.13/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py", line 235, in __aexit__
await self.gen.athrow(value)
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/genai/live.py", line 1049, in connect
async with ws_connect(uri, extra_headers=headers) as ws:
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/websockets/asyncio/client.py", line 587, in __aenter__
return await self
^^^^^^^^^^
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/websockets/asyncio/client.py", line 541, in __await_impl__
self.connection = await self.create_connection()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/websockets/asyncio/client.py", line 467, in create_connection
_, connection = await loop.create_connection(factory, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
TypeError: BaseEventLoop.create_connection() got an unexpected keyword argument 'extra_headers'
Traceback (most recent call last):
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/genai/live.py", line 1046, in connect
yield AsyncSession(api_client=self._api_client, websocket=ws)
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/models/google_llm.py", line 243, in connect
yield GeminiLlmConnection(live_session)
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 115, in run_live
async for event in self._receive_from_model(
...<36 lines>...
return
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 246, in _receive_from_model
async for event in self._postprocess_live(
...<23 lines>...
yield event
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 439, in _postprocess_live
function_response_event = await functions.handle_function_calls_live(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
invocation_context, model_response_event, llm_request.tools_dict
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/functions.py", line 288, in handle_function_calls_live
trace_tool_call(
~~~~~~~~~~~~~~~^
tool=tool,
^^^^^^^^^^
...<2 lines>...
function_response=function_response,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
TypeError: trace_tool_call() got an unexpected keyword argument 'response_event_id'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/cli/fast_api.py", line 904, in agent_live_run
task.result()
~~~~~~~~~~~^^
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/cli/fast_api.py", line 877, in forward_events
async for event in runner.run_live(
...<4 lines>...
)
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/runners.py", line 325, in run_live
async for event in invocation_context.agent.run_live(invocation_context):
await self.session_service.append_event(session=session, event=event)
yield event
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/agents/base_agent.py", line 174, in run_live
async for event in self._run_live_impl(ctx):
yield event
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/agents/llm_agent.py", line 286, in _run_live_impl
async for event in self._llm_flow.run_live(ctx):
self.__maybe_save_output_to_state(event)
yield event
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 87, in run_live
async with llm.connect(llm_request) as llm_connection:
~~~~~~~~~~~^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py", line 235, in __aexit__
await self.gen.athrow(value)
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/adk/models/google_llm.py", line 240, in connect
async with self._live_api_client.aio.live.connect(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
model=llm_request.model, config=llm_request.live_connect_config
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
) as live_session:
^
File "/opt/homebrew/Cellar/python@3.13/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py", line 235, in __aexit__
await self.gen.athrow(value)
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/google/genai/live.py", line 1049, in connect
async with ws_connect(uri, extra_headers=headers) as ws:
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/websockets/asyncio/client.py", line 587, in __aenter__
return await self
^^^^^^^^^^
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/websockets/asyncio/client.py", line 541, in __await_impl__
self.connection = await self.create_connection()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pretbc/Workspace/affect-gadk-prompts/.venv/lib/python3.13/site-packages/websockets/asyncio/client.py", line 467, in create_connection
_, connection = await loop.create_connection(factory, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
TypeError: BaseEventLoop.create_connection() got an unexpected keyword argument 'extra_headers'
Also Im not pretty sure that these response was base on AUDIO. It looks like it is base on TEXT only.
Is this possible to create custom runner with artifact_service=artifact_service
and base on that other agents will be able to access AUDIO ?
To Reproduce
Steps to reproduce the behavior:
- Create agents from my code
- Run using
adk web
and enable MIC - See error logs
Expected behavior
I would expect that agent will run tools and return to the user
Desktop (please complete the following information):
- OS: MacBook
- Python version(python -V): 3.13
- ADK version(pip show google-adk): 1.2.1