diff --git a/run_agent.py b/run_agent.py index 57e2a13ba7..9b3a7dba35 100644 --- a/run_agent.py +++ b/run_agent.py @@ -2340,7 +2340,10 @@ class AIAgent: "instructions": instructions, "input": self._chat_messages_to_responses_input(payload_messages), "tools": self._responses_tools(), + "tool_choice": "auto", + "parallel_tool_calls": True, "store": False, + "prompt_cache_key": self.session_id, } if reasoning_enabled: diff --git a/tests/test_run_agent_codex_responses.py b/tests/test_run_agent_codex_responses.py index a1e5e817e0..cf2694f098 100644 --- a/tests/test_run_agent_codex_responses.py +++ b/tests/test_run_agent_codex_responses.py @@ -235,6 +235,10 @@ def test_build_api_kwargs_codex(monkeypatch): assert kwargs["tools"][0]["strict"] is False assert "function" not in kwargs["tools"][0] assert kwargs["store"] is False + assert kwargs["tool_choice"] == "auto" + assert kwargs["parallel_tool_calls"] is True + assert isinstance(kwargs["prompt_cache_key"], str) + assert len(kwargs["prompt_cache_key"]) > 0 assert "timeout" not in kwargs assert "max_tokens" not in kwargs assert "extra_body" not in kwargs