strands-agents/sdk-python

[FEATURE]: Add Model-Agnostic Guardrails Documentation Using LiteLLM and Hooks

Opened this issue · 0 comments

Problem Statement

  • Only Bedrock guardrails are documented
  • No examples for LiteLLM-based providers (OpenAI, Anthropic, Nebius, etc.)
  • Hooks are provider-specific
  • Missing reusable, cross-provider guardrails pattern

Proposed Solution

Add a new section “Model-Agnostic Guardrails” under the Guardrails documentation with:

  • Basic Implementation: Hook-based guardrails using BeforeInvocationEvent and AfterInvocationEvent
  • Multi-Provider Examples: Show the same guardrails working with OpenAI, Anthropic, and Nebius via LiteLLM
  • Advanced Patterns: Use a dedicated LiteLLM model for content safety evaluation
  • Best Practices: Performance and reliability guidance

Use Case

People who're using Open Source Models via LIteLLM can also use Guardrails.

Alternatives Solutions

No response

Additional Context

I've implemented one similar use case here: AWS Strands Litellm Guardrails