-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Please read this first
- Have you read the docs?Agents SDK docs
- Have you searched for related issues? Others may have faced similar issues.
Describe the bug
Gemini 3 Pro Preview (google/gemini-3-pro-preview) model requires thought_signature similar to response_id for subsequent calls. Using the Agent and Runner the thought_signature is not inject for next loop during call. I have tried to use RunHooks to receive full response from the model but unsuccessfully.
File "C:\Users\dom\anaconda3\envs\genai\Lib\site-packages\openai\_base_client.py", line 1594, in request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - [{'error': {'code': 400, 'message': 'Unable to submit request because function call `default_api:get_current_temperature` in the 2. content block is missing a `thought_signature`. Learn more: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/thought-signatures', 'status': 'INVALID_ARGUMENT'}}]
Debug information
- Agents SDK version: 0.6.1
- Python version: 3.11.13
- OpenAI version: 2.8.1
Repro steps
This snippet using plain OpenAI client returns the thouch_signarute but fails when use Agent and Runner
- OpenAI library:
# Create an async-compatible OpenAI client pointing to GOOGLE's endpoint
# Set up the OpenAI client pointing to GOOGLE endpoint
client = OpenAI(
api_key=creds,
base_url=f"https://aiplatform.googleapis.com/v1/projects/{PROJECT_ID}/locations/global/endpoints/openapi",
)
prompt = """
If it's too hot or too cold in London, set the temperature to a comfortable level.
Make your own reasonable assumption for what 'comfortable' means and do not ask for clarification.
"""
messages = [
{"role": "user", "content": prompt},
]
response1 = client.chat.completions.create(
model=MODEL_NAME,
messages=messages,
tools=tools,
)
print(response1)OUTPUT:
ChatCompletion(id='3Kstacq6MerChcIPi9qngAE', choices=[Choice(finish_reason='tool_calls', index=0, logprobs=None, message=ChatCompletionMessage(content=None, refusal=None, role='assistant', annotations=None, audio=None, function_call=None, tool_calls=[ChatCompletionMessageFunctionToolCall(id='function-call-e37e486d-d21e-4203-a7d5-220fa5c27dac', function=Function(arguments='{"location":"London"}', name='get_current_temperature'), type='function', extra_content={'google': {'thought_signature': 'CsE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4iBhxMtLPjR1tRbaFwLKo+tRqzv32xa1f/vowbahdLv42uFdY/NJuzqsCThoo9Z2E6S5wn6KbP/bGEgjL/KmF1S79qj9U1JCKVV8QKJlQacFdNBWSAHSqiTpIpJqVxiThf0DiW9jKQ5RuKUL8jDN9Ht07S4iAmES2Rg6VylasPibBanB99k71VBmlQR1SBmtGFxEqziPMZ5DWV4lrlgnYTCEM7rZcuaUgDwqDJioUTg2WW/l0M7CkPhM+cETcVEtJz/pY/QzmHQBMnxHRd9CQf1Sa3eZryJt+RygQe7OITwjvVB6izTdKRhBHAYZx3hjqCvrvwK9mso0jF5yXdnbGsGkQF9G79Ab144F+fpGJimcMnvaHI+PPfdndthVAgdLyYK8pTqum9JMco311eLJZBDPKEuMoHPutzVBRkNuU1mrST3iJ+x/O1p/DsApBbVKwFrYkkPWy0Y1hRTVmmRhqAfLqjBWA8eGrnnO9CZJWt+C1bKdUIBEmLJ4G+MKnqA2YI9/VxcYSP+axKDIH/BPiU7NGYpA2E='}})]))], created=1764600796, model='google/gemini-3-pro-preview', object='chat.completion', service_tier=None, system_fingerprint='', usage=CompletionUsage(completion_tokens=11, prompt_tokens=70, total_tokens=400, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=None, audio_tokens=None, reasoning_tokens=319, rejected_prediction_tokens=None), prompt_tokens_details=None, extra_properties={'google': {'traffic_type': 'ON_DEMAND'}}))
- Using OpenAI Agents SDK:
# Create an async-compatible OpenAI client pointing to GOOGLE's endpoint
# Set up the OpenAI client pointing to GOOGLE endpoint
client = AsyncOpenAI(
api_key=creds,
base_url=f"https://aiplatform.googleapis.com/v1/projects/{PROJECT_ID}/locations/global/endpoints/openapi",
)
# Define the orchestrator agent that routes tasks
climatizer_agent = Agent[SharedContext](
name="climatizer_agent",
instructions=(
"You are a smart home climatization agent. "
"Your task is to monitor the temperature in a given city and adjust the thermostat to maintain comfort. "
"Use the provided tools to read the current temperature and set a new thermostat value. "
"If the temperature is too high or too low, adjust it to a reasonable 'comfortable' value, "
"which you must assume without asking for clarification. "
"Consider comfortable indoor temperature to be around 20–22°C (68–72°F) unless otherwise specified. "
"Always perform actions using the tools and provide concise confirmation of the action taken."
),
model=OpenAIChatCompletionsModel(model=MODEL_NAME, openai_client=client),
model_settings=ModelSettings(parallel_tool_calls=False, tool_choice='required', temperature=0, top_p=1.0),
tools=[function_tool(get_current_temperature), function_tool(set_thermostat_temperature),]
)
prompt = """
If it's too hot or too cold in London, set the temperature to a comfortable level.
Make your own reasonable assumption for what 'comfortable' means and do not ask for clarification.
"""
invoke_inputs = [{"role": "user", "content": prompt}]
async def main():
while True:
try:
with trace("Climatization"):
run_result = await Runner.run(climatizer_agent, input=invoke_inputs)
print(run_result)
except KeyboardInterrupt:
breakOUTPUT:
File "C:\Users\dom\anaconda3\envs\genai\Lib\site-packages\openai\_base_client.py", line 1594, in request
raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - [{'error': {'code': 400, 'message': 'Unable to submit request because function call `default_api:get_current_temperature` in the 2. content block is missing a `thought_signature`. Learn more: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/thought-signatures', 'status': 'INVALID_ARGUMENT'}}]
Expected behavior
A clear and concise description of what you expected to happen.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working