Skip to content

fix(adk): allow the Bedrock runtime origin in Harness egress - #3438

Open
xianshujun wants to merge 2 commits into
kagent-dev:mainfrom
xianshujun:fix-3408-bedrock-egress
Open

xianshujun wants to merge 2 commits into
kagent-dev:mainfrom
xianshujun:fix-3408-bedrock-egress

Conversation

@xianshujun

Copy link
Copy Markdown

Fixes #3408.

The kagent Harness compiles its egress allowlist from agentConfigDestinations, which has provider defaults for OpenAI, Anthropic, Gemini, Mistral and Ollama but no Bedrock case. CompileCredentials still binds the Bedrock bearer token to https://bedrock-runtime.<region>.amazonaws.com:443, so egress.CanonicalAccess rejects the credential as "not explicitly allowed" and the revision cannot be admitted or applied to an Actor.

Add the regional Bedrock runtime origin, derived from ModelConfig.spec.bedrock.region, and a regression test that compiles a kagent Harness against a Bedrock bearer-token ModelConfig.

Tests

cd go
go test ./core/internal/translator/... ./core/internal/egress/...

All packages pass. The new test fails without the fix (the allowlist comes back empty for the Bedrock case) and passes with it.

Signed-off-by: xianshujun <xianshupang@gmail.com>
@xianshujun
xianshujun requested a review from a team as a code owner October 29, 2026 12:17
@github-actions github-actions Bot added the bug Something isn't working label Oct 29, 2026
// matching allowlist entry CanonicalAccess rejects the credential and
// the revision cannot be admitted.
if bedrock := modelConfig.Spec.Bedrock; bedrock != nil {
destinations = append(destinations, "https://bedrock-runtime."+bedrock.Region+".amazonaws.com:443")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the third place that builds the Bedrock runtime origin from the region. go/core/internal/translator/credentials.go (~line 279) builds it to bind the bearer token, and go/core/internal/translator/claude/compiler.go (~line 254) builds it again for its egress list. The bug in #3408 came from the credential binding and the allowlist disagreeing, and the Ollama case hit the same problem and fixed it with one shared function (models.OllamaReachesCloud).

Could we add a small helper, e.g. models.BedrockRuntimeOrigin(region), and call it from all three places, so they can't drift apart again?

cc: @EItanya

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I think we take the opportunity while we're here to standardize this into a single helper function

Credential compilation, the Claude and Codex egress lists, and the ADK
egress allowlist each rebuilt https://bedrock-runtime.<region>.amazonaws.com
on their own, so one site could drift from another — which is how the
credential binding and the allowlist disagreed in kagent-dev#3408.
models.BedrockRuntimeOrigin is now the single definition all four call.

Signed-off-by: xianshujun <xianshupang@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] kagent Harness cannot run a Bedrock agent: Bedrock endpoint missing from the runtime egress allow list

3 participants