Commit b846ba5
feat: integrate guardrails into tracing system
- Add guardrails parameter to @trace() and @trace_async() decorators
- Enhance create_step() context manager to support guardrails
- Update add_chat_completion_step_to_trace() for helper function integration
- Add global guardrails configuration via tracer.configure()
- Implement input and output guardrail processing with graceful error handling
- Add comprehensive guardrail metadata to trace steps including action flags
- Support multiple block strategies: graceful handling vs exceptions
- Enable per-call guardrail overrides and global configuration
- Maintain 100% backward compatibility with existing trace decorators
This integration enables automatic protection for both @trace() decorated
functions and LLM helper functions like trace_openai() with rich metadata
for monitoring and analysis.1 parent 0bcc636 commit b846ba5
1 file changed
+585
-55
lines changed
0 commit comments