#5500: Fix #5290 Bedrock Auto Discovery fails to retrieve or support Inferen…
agents
Cluster:
Bedrock and Caching Improvements
## Summary
Refactor Bedrock model discovery to use Inference Profiles API and add debug logging for model response troubleshooting.
## Changes
### Bedrock Discovery (bedrock-discovery.ts)
- Switch from ListFoundationModelsCommand to ListInferenceProfilesCommand
- Add pagination support with nextToken handling
- Filter by typeEquals: "SYSTEM_DEFINED"
- Simplify provider extraction from inference profile ID
### Debug Logging (pi-embedded-subscribe.handlers.messages.ts)
- Log raw assistantMessageEvent for debugging streaming responses
- Log assistant response text at message end (truncated to 500 chars)
## Testing
- Verified Claude models work correctly via Bedrock
- Identified Nova model issue (empty responses) - tracked in upstream pi-mono,waiting pi-ai fix it
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This change updates Bedrock model auto-discovery to enumerate **inference profiles** via `ListInferenceProfilesCommand` (with pagination and `typeEquals: "SYSTEM_DEFINED"`) instead of listing foundation models directly. Discovered entries are mapped into `ModelDefinitionConfig` for `amazon-bedrock` in `src/agents/models-config.providers.ts`.
Key behavioral differences: provider filtering is now derived from `inferenceProfileId`, and discovery no longer checks streaming support / output modalities / input modalities from the API response (it always returns `input: ["text"]`).
<h3>Confidence Score: 3/5</h3>
- This PR is likely safe to merge, but there are a couple of edge-case risks that could make discovery return no models depending on Bedrock API response formats.
- The core refactor is straightforward and scoped to one file, but provider/status parsing now relies on assumptions about `ListInferenceProfiles` field casing and ID formatting; if those assumptions don’t hold in some regions/accounts, auto-discovery may silently return an empty list.
- src/agents/bedrock-discovery.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#8963: fix(bedrock): fix amazon bedrock model problem of dealing with profile
by 67ailab · 2026-02-04
85.4%
#19841: feat: add Amazon Bedrock as first-class onboarding provider
by elbeyf · 2026-02-18
77.8%
#20866: fix: disable prompt caching for non-Anthropic Bedrock models
by pierreeurope · 2026-02-19
76.3%
#22303: fix: extend cacheRetention auto-injection and runtime pass-through ...
by snese · 2026-02-21
76.3%
#20191: feat(memory): add Amazon Bedrock embedding provider (Nova 2)
by gabrielkoo · 2026-02-18
73.7%
#8475: models: discover local Windsurf/Cursor/Antigravity models
by gitSITTI · 2026-02-04
73.3%
#13401: fix: slug generator should use agent's primary model instead of har...
by pahud · 2026-02-10
73.1%
#7568: feat(agents): add LM Studio auto-discovery and provider support
by sjseo298 · 2026-02-03
72.7%
#7051: Add io-intelligence model inference provider
by rajagurunath · 2026-02-02
72.7%
#2806: [AI-Assisted] Fix: Repair tool_use/tool_result pairing for Claude o...
by Arthur742Ramos · 2026-01-27
72.5%