Skip to content

[NEW CONTENT] Full Observability Access for Guardrails Triggered Responses with Bedrock #502

@pragmaticivan

Description

@pragmaticivan

Proposed Content

I see we have documentation for using Guardrails, and for Observing by triggering the same guardrail "again"

I would like to proce that we have examples of how to fully observe when a guardrail is triggered directly from bedrock, something we can only see in the raw responses.

Location

https://strandsagents.com/latest/documentation/docs/user-guide/safety-security/guardrails/?h=guar

Rationale

An user should be able to have some sort of middleware after a guardrail is triggered (hopefully with a dedicated hook) so that I can register custom metrics with proper labels for each metric with possibly the following labels:

"policy_type": policy_type,
"policy_name": "tbd",
"filter_type": "tbd",
"pii_type": "tbd",
"word_type": "tbd",
"match": "tbd",

User should also be ale to create custom opentelemetry spans from this hook/callback.

I'm not sure if such hook is available, so I had to inject some magic directly on bedrock client in order to intercept the response.

Content Outline (Optional)

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions