Skip to content

Wire AWS Bedrock into research-run routing (main-process)#154

Merged
blisspixel merged 1 commit into
mainfrom
feature/bedrock-routing
Jul 22, 2026
Merged

Wire AWS Bedrock into research-run routing (main-process)#154
blisspixel merged 1 commit into
mainfrom
feature/bedrock-routing

Conversation

@blisspixel

Copy link
Copy Markdown
Owner

Delivers the on-mission capability from the architecture investigation: AWS Bedrock now actually runs research stages, not just keys test/doctor. Foundry is a scoped follow-up (see below).

Before → after

Previously a Bedrock model id set on a stage fell through to the xAI path and the mandatory cost estimate KeyError'd (no registry price). Now:

  • Registered Amazon Nova Micro/Lite/Pro (us.amazon.nova-*-v1:0 inference-profile ids) with prices verified July 2026 against the AWS Bedrock pricing page — so the cost gate prices them correctly.
  • Wired routing: get_provider_for_model routes provider=bedrock|foundry through the registry builder; llm()'s cross-provider dispatch tuple now includes them (no more fall-through to Gemini/xAI).
  • Usage: set a Nova id on a stage env var — AI_REASONING_MODEL=us.amazon.nova-pro-v1:0, AI_REPORT_MODEL=…, AI_FAST_MODEL=us.amazon.nova-lite-v1:0.

Security boundary (the key decision)

Bedrock/Foundry routing is main-process only. A supervised MCP worker deliberately never inherits AWS/Azure secrets (config/env.py), so routing refuses with a clear error when PRIMR_SUPERVISED_WORKER=1. No allowlist was widened, and a regression test pins that AWS_*/AZURE_OPENAI_API_KEY stay stripped from workers. Worker-side Bedrock (scoped short-lived STS tokens) is a separate, larger design, intentionally not bundled.

Foundry follow-up

Foundry's model id is the user's arbitrary deployment name, so a fixed-price registry entry doesn't fit — it needs a small deployment→pricing mechanism. Routing is plumbed for provider=foundry; registering priced Foundry entries is the next step (no guessed prices in the cost gate).

Verified — $0

  • tests/test_ai/test_bedrock_routing.py (9): models priced, main-process routing reaches the provider, worker routing refused, allowlist pins closed.
  • Affected suites (routing, llm dispatch, stage routing, provider registry, cost estimator, config, architecture): 371 passed; ruff clean; doc-link test green.
  • BedrockProvider itself was validated live earlier this session (Nova Micro converse → "PRIMR-BEDROCK-OK"). No new spend here — logic is covered by mocked tests.

Bedrock providers previously worked only for `keys test`/`doctor`; a Nova
model id set on a stage fell through to xAI and could not be priced. This makes
Bedrock genuinely routable:

- Register Amazon Nova Micro/Lite/Pro (us.* inference-profile ids) with real
  verified prices so the mandatory cost gate can price them.
- Route `provider=bedrock|foundry` through the registry builder in
  get_provider_for_model, and add bedrock/foundry to the llm() cross-provider
  dispatch tuple (they no longer fall through to Gemini/xAI).
- Guard the credential boundary: refuse bedrock/foundry routing when
  PRIMR_SUPERVISED_WORKER=1 (workers never inherit AWS/Azure secrets); a test
  pins that the env allowlist stays closed.
- Recognize bedrock/foundry in stage_routing._provider_configured.

Foundry routing is a follow-up (its model id is a user deployment name, needing
a deployment-pricing mechanism). Verified with mocked tests (no spend);
BedrockProvider itself was validated live earlier this session.
@blisspixel
blisspixel merged commit a9ab65f into main Jul 22, 2026
10 checks passed
@blisspixel
blisspixel deleted the feature/bedrock-routing branch July 22, 2026 15:28
@blisspixel blisspixel mentioned this pull request Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant