#8963: fix(bedrock): fix amazon bedrock model problem of dealing with profile
agents
stale
Cluster:
Bedrock and Caching Improvements
### Problem
AWS Bedrock requires inference profile IDs (with regional prefixes like us., eu., global.) for newer models like Claude Opus 4.5. OpenClaw's model lookup failed because:
1. Auto-discovery returns base IDs (e.g., anthropic.claude-opus-4-5-20251101-v1:0)
2. Users need to use prefixed IDs (e.g., us.anthropic.claude-opus-4-5-20251101-v1:0)
3. Exact match lookup failed since the IDs don't match
### Solution (in src/agents/pi-embedded-runner/model.ts):
- Added stripBedrockInferenceProfilePrefix() to parse regional prefixes
- Added findInlineModel() helper for flexible Bedrock model matching
- Updated resolveModel() to match prefixed IDs against base model definitions
- The prefixed ID is preserved and sent to AWS for correct inference profile usage
### Usage: Configure with the prefixed model ID:
```
{
"agents": {
"defaults": {
"model": {
"primary": "amazon-bedrock/us.anthropic.claude-opus-4-5-20251101-v1:0"
}
}
}
}
```
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This change teaches `resolveModel` to handle Amazon Bedrock “inference profile” model IDs that include regional prefixes (`us.`, `eu.`, `ap.`, `global.`). It does this by stripping the prefix for lookup (registry + inline provider config), while preserving the original prefixed ID on the returned `Model` so the Bedrock API call still uses the required inference-profile identifier.
Tests were expanded to cover prefixed/unprefixed Bedrock IDs and to unit-test the prefix stripping helper.
<h3>Confidence Score: 4/5</h3>
- This PR is close to safe to merge once the obvious dead-code/unused-local is removed.
- Core lookup logic for Bedrock-prefixed IDs is straightforward and covered by tests, but `model.ts` currently contains a computed-and-unused variable block that is likely to trigger lint/TS unused-local checks and should be fixed before merging.
- src/agents/pi-embedded-runner/model.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#5500: Fix #5290 Bedrock Auto Discovery fails to retrieve or support Inferen…
by heqiqi · 2026-01-31
85.4%
#22303: fix: extend cacheRetention auto-injection and runtime pass-through ...
by snese · 2026-02-21
80.7%
#20866: fix: disable prompt caching for non-Anthropic Bedrock models
by pierreeurope · 2026-02-19
80.1%
#13401: fix: slug generator should use agent's primary model instead of har...
by pahud · 2026-02-10
80.0%
#11198: fix(models): strip @profile suffix from model selection
by mcaxtr · 2026-02-07
77.3%
#19841: feat: add Amazon Bedrock as first-class onboarding provider
by elbeyf · 2026-02-18
77.1%
#12949: fix(bedrock): sanitize tool names for Bedrock Converse API constraints
by omair445 · 2026-02-09
76.7%
#7570: fix: allow models from providers with auth profiles configured
by DonSqualo · 2026-02-03
76.5%
#12220: fix: forward-compat models now respect user-configured contextWindow
by Batuhan4 · 2026-02-09
76.4%
#11882: fix: accept openai-codex/gpt-5.3-codex model refs
by jackberger03 · 2026-02-08
75.9%