diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.py index a04c347a9..49dea65f9 100644 --- a/agent/auxiliary_client.py +++ b/agent/auxiliary_client.py @@ -1223,8 +1223,12 @@ def _to_async_client(sync_client, model: str): return AsyncCodexAuxiliaryClient(sync_client), model if isinstance(sync_client, AnthropicAuxiliaryClient): return AsyncAnthropicAuxiliaryClient(sync_client), model - if sync_client.__class__.__name__ == "CopilotACPClient": - return sync_client, model + try: + from agent.copilot_acp_client import CopilotACPClient + if isinstance(sync_client, CopilotACPClient): + return sync_client, model + except ImportError: + pass async_kwargs = { "api_key": sync_client.api_key, diff --git a/run_agent.py b/run_agent.py index 3069a190a..5005153b3 100644 --- a/run_agent.py +++ b/run_agent.py @@ -705,10 +705,12 @@ class AIAgent: except Exception: pass - # GPT-5.x models often require the Responses API path — they are - # rejected on /v1/chat/completions by both OpenAI and OpenRouter. - # Also auto-upgrade for direct OpenAI URLs (api.openai.com) since + # GPT-5.x models require the Responses API path — they are rejected + # on /v1/chat/completions by both OpenAI and OpenRouter. Also + # auto-upgrade for direct OpenAI URLs (api.openai.com) since all # newer tool-calling models prefer Responses there. + # ACP runtimes are excluded: CopilotACPClient handles its own + # routing and does not implement the Responses API surface. if ( self.api_mode == "chat_completions" and self.provider != "copilot-acp"