Wire Azure AI Foundry into research-run routing (main-process)#155
Merged
Conversation
A Foundry model id is a per-user deployment name, so a fixed priced registry entry cannot be shipped. Instead the operator declares the deployment and its pricing via env, and primr resolves it at lookup time: - AZURE_OPENAI_DEPLOYMENT names the deployment (also the id selected on a stage). - Pricing is declared, never guessed: AZURE_FOUNDRY_PRICE_AS copies a registered model's price/spec, or AZURE_FOUNDRY_INPUT_PRICE/OUTPUT_PRICE set explicit rates. Without a declaration the lookup returns None, so the cost gate fails closed rather than mispricing a run. Centralized model lookup through PrimrModels._resolve_config so get_model_config, get_price, and the cost-breakdown paths all resolve the declared deployment. Routing (get_provider_for_model) and the supervised-worker guard already handle provider=foundry from the Bedrock change. Verified with mocked tests (no spend).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Completes the multi-cloud provider goal — Azure AI Foundry deployments now run research stages, alongside the Bedrock routing already on main. Together they deliver "meet people where they are" for AWS and Azure.
The Foundry wrinkle, solved honestly
A Foundry model id is the user's deployment name (arbitrary), so primr can't ship a fixed priced registry entry. The operator declares the deployment and its pricing via env, and nothing is guessed into the cost gate:
PrimrModels._resolve_configcentralizes model lookup soget_model_config,get_price, and the cost-breakdown paths all resolve the declared deployment. If pricing isn't declared, the lookup returnsNone→ the cost gate fails closed (unknown model) rather than mispricing a run.Security boundary (same as Bedrock)
Main-process only. Foundry routing is refused inside a supervised MCP worker (Azure creds are never inherited); the guard and allowlist regression pin already cover
foundryfrom the Bedrock change.Verified — $0
tests/test_ai/test_foundry_routing.py(6): price-as + explicit pricing resolve; fail-closed without pricing; only the declared deployment name resolves; routing returnsAzureFoundryProviderin-process; refused in a worker..env.example, the Foundry deploy README (corrected the "not yet wired" note), CHANGELOG.After this merges, I'll cut 1.38.0 with both Bedrock + Foundry.