Skip to content

Research sub-agent ignores the main model's Bedrock inference-profile prefix #184

@taxfree-python

Description

@taxfree-python

Bug

When the main model is a bedrock/ Anthropic profile, the research sub-agent forces a us. inference-profile prefix regardless of what the user chose for the main model. This breaks the sub-agent for any user whose AWS account/region cannot call the us.* cross-region profile, with:

Research sub-agent LLM error: litellm.BadRequestError: BedrockException -
{"message":"The provided model identifier is invalid."}

Cause

agent/tools/research_tool.py:225 hard-codes the prefix:

if main_model.startswith("bedrock/") and "anthropic" in main_model:
    return "bedrock/us.anthropic.claude-sonnet-4-6"

AWS Bedrock exposes the same Sonnet profile under multiple prefixes (us., apac., global., ...); only us. is hard-coded here. The main agent passes the user-chosen profile through to LiteLLM unmodified, so it works — only the sub-agent overrides it.

Reproduction

  1. AWS region without access to us.* Anthropic inference profiles (e.g. ap-northeast-1).
  2. Set the main model to a non-us. Bedrock Anthropic profile, e.g. /model bedrock/global.anthropic.claude-opus-4-7.
  3. Send any prompt that triggers the research tool. The sub-agent fails with the error above; the main agent itself is unaffected.

Confirmed with a direct LiteLLM call from ap-northeast-1:

bedrock/us.anthropic.claude-sonnet-4-6  -> BedrockException "The provided model identifier is invalid."
bedrock/jp.anthropic.claude-sonnet-4-6  -> OK

Fix

Make the sub-agent inherit the prefix from the main model rather than overriding it. The cheaper sub-agent model name (claude-sonnet-4-6) is preserved; only the prefix follows the main agent's choice. PR: #185.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions