Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent/moa_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _slot_runtime(slot: dict[str, str]) -> dict[str, Any]:
# provider-backed targets whose provider branch adds auth refresh,
# request metadata, or request-shape adapters. Keep those providers
# identified by name.
if resolved_provider in {"nous", "openai-codex", "xai-oauth"}:
if resolved_provider in {"nous", "openai-codex", "xai-oauth", "anthropic"}:
return out
# Pass the resolved endpoint through so call_llm builds the request for
# the provider's actual API surface instead of auto-detecting. base_url
Expand Down
26 changes: 26 additions & 0 deletions tests/run_agent/test_moa_loop_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,32 @@ def fake_resolve(*, requested, target_model=None):
assert rt == {"provider": "openai-codex", "model": "gpt-5.5"}


def test_moa_anthropic_slot_preserves_provider_identity(monkeypatch):
"""Anthropic slots must not become custom chat-completions endpoints.

call_llm treats explicit base_url as provider=custom. For Anthropic and
Anthropic-compatible providers this loses the Messages API adapter and can
send the request to the wrong path.
"""
from agent import moa_loop

def fake_resolve(*, requested, target_model=None):
return {
"provider": requested,
"api_mode": "anthropic_messages",
"base_url": "https://api.anthropic.com",
"api_key": "test-token",
}

monkeypatch.setattr(
"hermes_cli.runtime_provider.resolve_runtime_provider", fake_resolve
)

rt = moa_loop._slot_runtime({"provider": "anthropic", "model": "claude-sonnet-4"})

assert rt == {"provider": "anthropic", "model": "claude-sonnet-4"}


def test_moa_slot_runtime_falls_back_on_resolution_error(monkeypatch):
"""A slot whose provider can't be resolved still attempts the call with the
bare provider/model rather than aborting the whole MoA turn."""
Expand Down