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

Thought signature in agent response (no code changes introduced this behavior)

Open Noladev opened this issue 1 year ago • 27 comments

Hi, My agent responses went from: content":{"parts":[{"text":"Ah, hello there, friend! It's good to hear from you. How can I help you on your creative journey today?"}] to: {"content":{"parts":[{"thought_signature":"CpUCAcu98PDiQfIyH8Qj9nB2UX_OMAAoFNMn6C4jFrQH1hkbGeYhaD8W7vIkxIeI9vTeD-wBnJvNpekIX2icWWoBMrYmvojY9ujEdSJUN0QTaXPWzisz_ZP_uEChHwbloQnlLTTsBDmKaKthD9jouRui7E2iaJWVEGR1V9jQETD7jIhu1uF_dn6Cv-FeBypV38_kILv4Ciocl77DR4ZTx

I'm using ADK agents deployed on Vertex AI Agent Engine. The chat feature in my app worked until today...When I checked the logs I noticed the above.

Noladev avatar Jul 09 '25 03:07 Noladev

yes i too got the similar issue but with warning first WARNING: Warning: there are non-text parts in the response: ['thought_signature'], returning concatenated text result from text parts. Check the full candidates.content.parts accessor to get the full model response. ERROR: FastAPI encoder could not JSON-encode chunk of type <class 'dict'> during encoding: 'utf-8' codec can't decode byte 0xd6 in position 1: invalid continuation byte. Chunk data: {'content': {'parts': [{'thought_signature': b'\n\xd6\x01\x01\xcb\xbd\xf0\xf0baT\x00\x80~\x9e\xd6\x8e\x19N\xaf\xcb\xdfD\x05\x83\xc1\xfd>:\x01i\xaa5\x84\x12\xc1\xb3\xa0A\x8e}\xeb\x85\x9d\xa5\x81P\x9e\xb1\xeb\x9b\xaf\xdb\xcb\x92Uy\xcf\xf6\x1f\x92\x86'\x9dDvZ\x93\x8b\xfe\x05\xe4\xc01\n\xf2B\xad\xf6D{\x18r\x8cbN\x89\x89\xb9\x85R}\xf9\x80\xccb!\xca\xbd6\x00mS\xb7g\x00\x8bbo2\xa2\x97\x0c\x80Q '\x14\x10\xb6\\x87,\xbe\x01t\xee\x97K\xf6\xed\xeaoQ~\xdb\xe6\x9e\xce.c%\x8e\xec\x875\xc5\xcb\x87\xa4\xb8\xdbX\xb0X1g{:\xc7\xe2}\n\x0f\x18\x0c\x9f@\x8eM\xbd\xb64)\x04>\xcfL\x9c@h\xee9{\x84\xa6F\x92\xc0\xdd\x91\x93\x87\x8cv\x00\xea:|\xab\xd88\xe9c"\xb9D'\xb5j\x1b$\xa2\x0c\x1d\xb9\x8b', 'text': 'Hello! How can I help you today?'}], 'role': 'model'}, 'usage_metadata': {'candidates_token_count': 9, 'candidates_tokens_details': [{'modality': <MediaModality.TEXT: 'TEXT'>, 'token_count': 9}], 'prompt_token_count': 1864, 'prompt_tokens_details': [{'modality': <MediaModality.TEXT: 'TEXT'>, 'token_count': 1864}], 'thoughts_token_count': 46, 'total_token_count': 1919, 'traffic_type': <TrafficType.ON_DEMAND: 'ON_DEMAND'>}, 'invocation_id': 'e-8c72928f-xxxxxx-0f2d40d84e9b', 'author': 'root_agent', 'actions': {'state_delta': {}, 'artifact_delta': {}, 'requested_auth_configs': {}}, 'id': '', 'timestamp': 1752038537.067571}

akshaygaur-atrium avatar Jul 09 '25 05:07 akshaygaur-atrium

I was able to resolve this for now by changing the model fyi. This was occurring on 2.5 flash

Noladev avatar Jul 09 '25 05:07 Noladev

we were using gemini-2.5-pro which model are you currently using.

akshaygaur-atrium avatar Jul 09 '25 05:07 akshaygaur-atrium

Got the same issue for gemini-2.5-pro

fufufukakaka avatar Jul 09 '25 06:07 fufufukakaka

Got Same Issue for gemini-2.5-flash

sachints-sk avatar Jul 09 '25 07:07 sachints-sk

Same issue with 2.5 flash, downgrading to 2.0 makes the whole agent worthless in my workflow

paul-paturle-anak avatar Jul 09 '25 07:07 paul-paturle-anak

Same our entire prod has stopped, this needs to get fixed asap. Gemini 2.0 is terrible with our agent

evildeedz avatar Jul 09 '25 08:07 evildeedz

It appears that the issue is coming with the Tools usage, for us, Gemini 2.0 cannot manage to use Tools, so we get the response from the AI, but once we use 2.5, it fails to respond correctly with the tool and get the above error message. The tools either 2.0 or 2.5 is not working.

paul-paturle-anak avatar Jul 09 '25 08:07 paul-paturle-anak

same

KSonPham avatar Jul 09 '25 11:07 KSonPham

any solution ? problem in model or in ADK version ?

IECC-NU avatar Jul 09 '25 11:07 IECC-NU

Potential mitigation options ATM -

  1. Turn off thinking
  2. Switch to gemini-2.0-flash

suvigyajain0101 avatar Jul 09 '25 12:07 suvigyajain0101

same

DamiMartinez avatar Jul 09 '25 15:07 DamiMartinez

yes i too got the similar issue but with warning first WARNING: Warning: there are non-text parts in the response: ['thought_signature'], returning concatenated text result from text parts. Check the full candidates.content.parts accessor to get the full model response. ERROR: FastAPI encoder could not JSON-encode chunk of type <class 'dict'> during encoding: 'utf-8' codec can't decode byte 0xd6 in position 1: invalid continuation byte. Chunk data: {'content': {'parts': [{'thought_signature': b'\n\xd6\x01\x01\xcb\xbd\xf0\xf0baT\x00\x80~\x9e\xd6\x8e\x19N\xaf\xcb\xdfD\x05\x83\xc1\xfd>:\x01i\xaa5\x84\x12\xc1\xb3\xa0A\x8e}\xeb\x85\x9d\xa5\x81P\x9e\xb1\xeb\x9b\xaf\xdb\xcb\x92Uy\xcf\xf6\x1f\x92\x86'\x9dDvZ\x93\x8b\xfe\x05\xe4\xc01\n\xf2B\xad\xf6D{\x18r\x8cbN\x89\x89\xb9\x85R}\xf9\x80\xccb!\xca\xbd6\x00mS\xb7g\x00\x8bbo2\xa2\x97\x0c\x80Q '\x14\x10\xb6\x87,\xbe\x01t\xee\x97K\xf6\xed\xeaoQ~\xdb\xe6\x9e\xce.c%\x8e\xec\x875\xc5\xcb\x87\xa4\xb8\xdbX\xb0X1g{:\xc7\xe2}\n\x0f\x18\x0c\x9f@\x8eM\xbd\xb64)\x04>\xcfL\x9c@h\xee9{\x84\xa6F\x92\xc0\xdd\x91\x93\x87\x8cv\x00\xea:|\xab\xd88\xe9c"\xb9D'\xb5j\x1b$\xa2\x0c\x1d\xb9\x8b', 'text': 'Hello! How can I help you today?'}], 'role': 'model'}, 'usage_metadata': {'candidates_token_count': 9, 'candidates_tokens_details': [{'modality': <MediaModality.TEXT: 'TEXT'>, 'token_count': 9}], 'prompt_token_count': 1864, 'prompt_tokens_details': [{'modality': <MediaModality.TEXT: 'TEXT'>, 'token_count': 1864}], 'thoughts_token_count': 46, 'total_token_count': 1919, 'traffic_type': <TrafficType.ON_DEMAND: 'ON_DEMAND'>}, 'invocation_id': 'e-8c72928f-xxxxxx-0f2d40d84e9b', 'author': 'root_agent', 'actions': {'state_delta': {}, 'artifact_delta': {}, 'requested_auth_configs': {}}, 'id': '', 'timestamp': 1752038537.067571}

I'm getting this same error in the logs. This seems to be on the Agent Engine side because I'm able to run the agent locally and with adk api_server I only see the error when calling the agent deployed to Agent Engine.

chalosalvador avatar Jul 09 '25 16:07 chalosalvador

Everything seems to be back to normal now. I didn’t make any changes to my code or configuration, so it appears the issue was resolved on the server-side.

sachints-sk avatar Jul 10 '25 04:07 sachints-sk

gemini-2.5-pro works fine now!(and managed session service)

fufufukakaka avatar Jul 10 '25 04:07 fufufukakaka

@akshaygaur-atrium your thought_signature in https://github.com/google/adk-python/issues/1852#issuecomment-3051171071 contains hexadecimal symbols and not like a base64 bytes as in https://github.com/google/adk-python/issues/1852#issue-3214400499

Can you provide your original prompt/query so we can regenerate it?

shawn-yang-google avatar Jul 11 '25 20:07 shawn-yang-google

Hi folks, we are looking into the issue.

hangfei avatar Jul 12 '25 04:07 hangfei

Cheers. Loving the product, thanks for being responsive.

Noladev avatar Jul 12 '25 04:07 Noladev

@shawn-yang-google is working on a fix.

hangfei avatar Jul 14 '25 18:07 hangfei

@shawn-yang-google is working on a fix.

Cheers!

Noladev avatar Jul 14 '25 18:07 Noladev