Skip to content

[FEATURE] Native AWS Bedrock Guardrails support in ModelConfig #2320

Description

@GiGi-cloud-76

📋 Prerequisites

📝 Feature Summary

Add an optional guardrail block to the Bedrock provider in ModelConfig so the controller can pass guardrailIdentifier and guardrailVersion to the Converse API natively, without requiring an external proxy.

❓ Problem Statement / Motivation

The Bedrock provider in ModelConfig only exposes region today.

If you want to apply AWS Bedrock Guardrails (content filtering, topic denial, PII redaction) to your agents, you're forced to deploy a separate OpenAI-compatible proxy that injects the guardrail config at the gateway level. This adds an extra service to maintain and forces you to use provider: "OpenAI" with a custom baseUrl instead of the native Bedrock path.

The Bedrock Converse API already accepts guardrailIdentifier and guardrailVersion in the request body — kagent just doesn't expose them.

💡 Proposed Solution

Add an optional guardrail block to the bedrock spec in ModelConfig:

bedrock:
  region: "eu-central-1"
  guardrail:
    identifier: "abc123def456"  # guardrail ID or ARN
    version: "1"                 # guardrail version
    trace: "enabled"            # optional, defaults to disabled

The controller should pass these values as GuardrailConfiguration in the Converse API call (or as headers for InvokeModel). When a guardrail triggers INTERVENED, surface the blocked reason to the agent/user.

Ref: https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-use-converse-api.html

🔄 Alternatives Considered

  • External proxy (what we do today): works but adds operational complexity and breaks native Bedrock provider usage
  • Annotation-based config on the ModelConfig resource: not type-safe, hard to validate
  • Separate GuardrailPolicy CRD referenced by ModelConfig: over-engineered for what's essentially two fields

🎯 Affected Service(s)

Controller Service

📚 Additional Context

Tested on kagent v0.9.0 with provider: Bedrock. The BedrockConfig struct currently only has Region — no guardrail-related fields exist in the CRD.

The AWS SDK Go v2 already exposes the relevant types in github.com/aws/aws-sdk-go-v2/service/bedrockruntime/types:

  • GuardrailConfiguration{GuardrailIdentifier, GuardrailVersion, Trace}

So it's mostly wiring: add the field to the CRD, read it in the controller, pass it to the SDK call.

We're running kagent in production on AWS and would be happy to validate any implementation against real Bedrock Guardrails in our environment.

🙋 Are you willing to contribute?

  • I am willing to submit a PR for this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions