adk-python icon indicating copy to clipboard operation
adk-python copied to clipboard

Sub-agent not working for voice agents

Open ghost opened this issue 1 year ago • 16 comments

I'm trying to create an agent with 2 sub-agents and run it on voice. But I'm facing an issue where the agent stops replying on voice when the step related to sub-agent transfer gets executed.

It is working completely fine when testing on text. I'm using gemini 2.0 flash-exp as the model for root agent as well as both the sub-agents.

ghost avatar May 26 '25 15:05 ghost

Hi @saurabh-emvo , do you use adk web for testing? Do you see the transfer calls in the UI?

wyf7107 avatar May 26 '25 17:05 wyf7107

Image

we have tested it on adk web

it works fine with text given the ss of the same

but it doesn't work with voice this error is shown

Error during live websocket communication: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.
Traceback (most recent call last):
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/cli/fast_api.py", line 753, in agent_live_run
    task.result()
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/cli/fast_api.py", line 726, in forward_events
    async for event in runner.run_live(
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/runners.py", line 296, in run_live
    async for event in invocation_context.agent.run_live(invocation_context):
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/agents/base_agent.py", line 160, in run_live
    async for event in self._run_live_impl(ctx):
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/agents/llm_agent.py", line 254, in _run_live_impl
    async for event in self._llm_flow.run_live(ctx):
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 106, in run_live
    async for event in self._receive_from_model(
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 214, in _receive_from_model
    async for event in self._postprocess_live(
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 401, in _postprocess_live
    async for item in agent_to_run.run_live(invocation_context):
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/agents/base_agent.py", line 160, in run_live
    async for event in self._run_live_impl(ctx):
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/agents/llm_agent.py", line 254, in _run_live_impl
    async for event in self._llm_flow.run_live(ctx):
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 91, in run_live
    audio_transcriber = audio_transcriber.AudioTranscriber()
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/flows/llm_flows/audio_transcriber.py", line 29, in __init__
    self.client = speech.SpeechClient()
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/cloud/speech_v1/services/speech/client.py", line 701, in __init__
    self._transport = transport_init(
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/cloud/speech_v1/services/speech/transports/grpc.py", line 235, in __init__
    super().__init__(
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/cloud/speech_v1/services/speech/transports/base.py", line 100, in __init__
    credentials, _ = google.auth.default(
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/auth/_default.py", line 685, in default
    raise exceptions.DefaultCredentialsError(_CLOUD_SDK_MISSING_CREDENTIALS)
google.auth.exceptions.DefaultCredentialsError: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.
Traceback (most recent call last):
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/cli/fast_api.py", line 753, in agent_live_run
    task.result()
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/cli/fast_api.py", line 726, in forward_events
    async for event in runner.run_live(
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/runners.py", line 296, in run_live
    async for event in invocation_context.agent.run_live(invocation_context):
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/agents/base_agent.py", line 160, in run_live
    async for event in self._run_live_impl(ctx):
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/agents/llm_agent.py", line 254, in _run_live_impl
    async for event in self._llm_flow.run_live(ctx):
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 106, in run_live
    async for event in self._receive_from_model(
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 214, in _receive_from_model
    async for event in self._postprocess_live(
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 401, in _postprocess_live
    async for item in agent_to_run.run_live(invocation_context):
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/agents/base_agent.py", line 160, in run_live
    async for event in self._run_live_impl(ctx):
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/agents/llm_agent.py", line 254, in _run_live_impl
    async for event in self._llm_flow.run_live(ctx):
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 91, in run_live
    audio_transcriber = audio_transcriber.AudioTranscriber()
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/adk/flows/llm_flows/audio_transcriber.py", line 29, in __init__
    self.client = speech.SpeechClient()
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/cloud/speech_v1/services/speech/client.py", line 701, in __init__
    self._transport = transport_init(
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/cloud/speech_v1/services/speech/transports/grpc.py", line 235, in __init__
    super().__init__(
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/cloud/speech_v1/services/speech/transports/base.py", line 100, in __init__
    credentials, _ = google.auth.default(
  File "/Users/arkodeepchatterjee/Desktop/adk-voice/adk/lib/python3.9/site-packages/google/auth/_default.py", line 685, in default
    raise exceptions.DefaultCredentialsError(_CLOUD_SDK_MISSING_CREDENTIALS)
google.auth.exceptions.DefaultCredentialsError: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.

the same error comes up when testing it with voice and ws with telephony

arkodeep3404 avatar May 26 '25 17:05 arkodeep3404

Seems like your cloud credentials are not setup, could you checkout https://cloud.google.com/docs/authentication/external/set-up-adc

wyf7107 avatar May 26 '25 17:05 wyf7107

we have setup the gemini api key do we need to setup anything else separately??

arkodeep3404 avatar May 26 '25 18:05 arkodeep3404

@hangfei to help take a look, maybe this helps?https://cloud.google.com/docs/authentication/set-up-adc-local-dev-environment

wyf7107 avatar May 26 '25 18:05 wyf7107

does the code use any other gcp services?? i thought it only needed gemini access

arkodeep3404 avatar May 26 '25 18:05 arkodeep3404

If you are using Google vertex AI, then follow this: https://google.github.io/adk-docs/get-started/quickstart/#env

wyf7107 avatar May 26 '25 19:05 wyf7107

@hangfei please look into this asap we have a product launch coming up and urgently need this resolved

arkodeep3404 avatar May 26 '25 19:05 arkodeep3404

we are also not using vertex ai just the google genai sdk with gemini api

arkodeep3404 avatar May 26 '25 19:05 arkodeep3404

The streaming(live) has the same auth as regular non-live agents. So you should not see auth issues when switching to live or from text to audio.

The error looks pretty weird.

Could you share the full steps to reproduce the errors?

hangfei avatar May 28 '25 20:05 hangfei

same here, was this solved? i am getting the same error as well @hangfei

Mohammedumer7 avatar May 30 '25 10:05 Mohammedumer7

+1 I am alo getting the same error @hangfei @wyf7107

ravi-incred avatar Jul 17 '25 07:07 ravi-incred

getting the same error.

gouravraghuwanshi avatar Jul 21 '25 12:07 gouravraghuwanshi

I was initially getting this as well. After carefully reviewing the docs, I was able to resolve. The issue was that:

  • In https://google.github.io/adk-docs/get-started/quickstart/#set-up-the-model
    • The instruction says: Authenticate to Google Cloud from the terminal by running gcloud auth login
  • In https://cloud.google.com/docs/authentication/set-up-adc-local-dev-environment
    • The instruction says: If you're using a local shell, then create local authentication credentials for your user account: gcloud auth application-default login. This is what needs to be done for testing this out on the laptop.

@hangfei : Might be helpful to update the docs!

samikrc avatar Jul 22 '25 17:07 samikrc

Should be CLOSED, based on this update: https://github.com/google/adk-docs/pull/615

joefernandez avatar Aug 15 '25 18:08 joefernandez

Per @joefernandez closing issue.

tpryan avatar Aug 15 '25 18:08 tpryan