Skip to content

Commit 1ad513a

Browse files
committed
docs: clarify blocking vs parallel guardrail behavior
1 parent 3df0d58 commit 1ad513a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docs/guardrails.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Guardrails
22

3-
Guardrails enable you to do checks and validations of user input and agent output. For example, imagine you have an agent that uses a very smart (and hence slow/expensive) model to help with customer requests. You wouldn't want malicious users to ask the model to help them with their math homework. So, you can run a guardrail with a fast/cheap model. If the guardrail detects malicious usage, it can immediately raise an error and prevent the expensive model from running, saving you time and money.
3+
Guardrails enable you to do checks and validations of user input and agent output. For example, imagine you have an agent that uses a very smart (and hence slow/expensive) model to help with customer requests. You wouldn't want malicious users to ask the model to help them with their math homework. So, you can run a guardrail with a fast/cheap model. If the guardrail detects malicious usage, it can immediately raise an error and prevent the expensive model from running, saving you time and money (**when using blocking guardrails; for parallel guardrails, the expensive model may have already started running before the guardrail completes—see "Execution modes" below for details**).
44

55
There are two kinds of guardrails:
66

src/agents/guardrail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class OutputGuardrailResult:
7070

7171
@dataclass
7272
class InputGuardrail(Generic[TContext]):
73-
"""Input guardrails are checks that run in parallel to the agent's execution.
73+
"""Input guardrails are checks that run either in parallel with the agent or before it starts.
7474
They can be used to do things like:
7575
- Check if input messages are off-topic
7676
- Take over control of the agent's execution if an unexpected input is detected

0 commit comments

Comments
 (0)