diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.py index ba78833248..a7c81c0b94 100644 --- a/agent/auxiliary_client.py +++ b/agent/auxiliary_client.py @@ -707,6 +707,14 @@ class _CodexCompletionsAdapter: # Tools support for auxiliary callers (e.g. skills_hub) that pass function schemas tools = kwargs.get("tools") if tools: + # xAI's Responses endpoint rejects ``pattern`` and ``format`` JSON Schema + # keywords (HTTP 400). Strip them here to match the parity guarantee that + # chat_completion_helpers.py provides for the main-agent xAI path. + try: + from tools.schema_sanitizer import strip_pattern_and_format + tools, _ = strip_pattern_and_format(list(tools)) + except Exception: + pass converted = [] for t in tools: fn = t.get("function", {}) if isinstance(t, dict) else {}