-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Pre/post hooks for agents & Guardrails #4488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
## Summary Describe key changes, mention related issues or motivation for the changes. (If applicable, issue number: #\_\_\_\_) ## Type of change - [ ] Bug fix - [ ] New feature - [ ] Breaking change - [ ] Improvement - [ ] Model update - [ ] Other: --- ## Checklist - [ ] Code complies with style guidelines - [ ] Ran format/validation scripts (`./scripts/format.sh` and `./scripts/validate.sh`) - [ ] Self-review completed - [ ] Documentation updated (comments, docstrings) - [ ] Examples and guides: Relevant cookbook examples have been included or updated (if applicable) - [ ] Tested in clean environment - [ ] Tests added/updated (if applicable) --- ## Additional Notes Add any important context (deployment instructions, screenshots, security considerations, etc.) --------- Co-authored-by: Kaustubh <shuklakaustubh84@gmail.com>
…s/readme (#4310) ## Summary - Added root-level README file with database integration guide - Created database-specific READMEs covering all supported databases - Updated workflows README based on new folder structure ## Type of change - [ ] Bug fix - [x] New feature - [ ] Breaking change - [x] Improvement - [ ] Model update - [ ] Other: --- ## Checklist - [ ] Code complies with style guidelines - [ ] Ran format/validation scripts (`./scripts/format.sh` and `./scripts/validate.sh`) - [x] Self-review completed - [x] Documentation updated (comments, docstrings) - [ ] Examples and guides: Relevant cookbook examples have been included or updated (if applicable) - [ ] Tested in clean environment - [ ] Tests added/updated (if applicable) --- ## Additional Notes Add any important context (deployment instructions, screenshots, security considerations, etc.) --------- Co-authored-by: Kaustubh <shuklakaustubh84@gmail.com> Co-authored-by: Dirk Brand <51947788+dirkbrnd@users.noreply.github.com>
…ession (#4324) ## Summary Reorganize getting started examples with logical learning progression (If applicable, issue number: #\_\_\_\_) ## Type of change - [ ] Bug fix - [ ] New feature - [ ] Breaking change - [x] Improvement - [ ] Model update - [ ] Other: --- ## Checklist - [x] Code complies with style guidelines - [ ] Ran format/validation scripts (`./scripts/format.sh` and `./scripts/validate.sh`) - [x] Self-review completed - [x] Documentation updated (comments, docstrings) - [ ] Examples and guides: Relevant cookbook examples have been included or updated (if applicable) - [ ] Tested in clean environment - [ ] Tests added/updated (if applicable) --- ## Additional Notes Add any important context (deployment instructions, screenshots, security considerations, etc.) --------- Co-authored-by: Dirk Brand <51947788+dirkbrnd@users.noreply.github.com>
try: | ||
if asyncio.iscoroutinefunction(hook): | ||
raise ValueError(f"Cannot use an async hook with `run()`. Use `arun()` instead. Hook #{i + 1}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are going to raise because of this we could do so earlier
team = Team( | ||
name="Guardrails Demo Agent", | ||
model=OpenAIChat(id="gpt-4o-mini"), | ||
pre_hooks=[Guardrails.prompt_injection], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah! Loving the DX
enable_guardrails
to automatically add both of our defaults would also look great imo
Summary
This adds pre/post hooks for agents and some built in validations for guardrails.
Type of change
Checklist
./scripts/format.sh
and./scripts/validate.sh
)Additional Notes
Add any important context (deployment instructions, screenshots, security considerations, etc.)