You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guardrails/explorer.md
+121-2Lines changed: 121 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -5,5 +5,124 @@ title: Overview
5
5
# Guardrails in Explorer
6
6
7
7
<divclass="subtitle">
8
-
Learn how to use Guardrails in Explorer.
9
-
</div>
8
+
Learn how to configure and manage your guardrailing rules in Explorer.
9
+
</div>
10
+
11
+
[Explorer](../explorer/index.md) is Invariant's configuration and observability tool. It allows you to configure guardrails, inspect and debug your agent traces and analyze your agentic system for novel failure modes.
12
+
13
+
It exposes a simple configuration interface, that allows you to configure, test and deploy guardrails to your agentic system, as well as inspect guardrail failures in detail.
By default, each Explorer project exposes its own [Gateway](../gateway/index.md) instance, allowing you to easily get started quickly with your first Invariant-augmented agent.
20
+
21
+
You can think of an Explorer project as a _customized version of your LLM and MCP servers_ that automatically adhere to the set of guardrailing rules you configure in Explorer.
22
+
23
+
Apart from this, Explorer will also log all your requests, allowing you to inspect your agent behavior in detail and configure the guardrails to your liking.
messages=[{"role": "user", "content": "What do you know about Fight Club?"}],
51
+
model="gpt-4o",
52
+
)
53
+
```
54
+
55
+
After this change, all your LLM requests will automatically be logged in your Explorer project. If the project does not exist on first use, it will be created automatically.
56
+
57
+
To use Anthropic models instead, you can adjust the `/openai` portion of your base URL to `/anthropic`. Apart from this, functionality like streaming and tool calling are supported seamlessly through Gateway.
58
+
59
+
To learn more about how Gateway works, check out the [Gateway documentation](../gateway/index.md).
60
+
61
+
## Configuring Your First Guardrailing Rules
62
+
63
+
To configure guardrails, switch to the `Guardrails` tab in the top navigation bar of your Explorer project.
| Block | Blocks the request outright, returning an HTTP error to the client. |
90
+
| Log | Let's the request pass, but logs the violation in Explorer via designated Guardrail violation annotations in the resulting agent traces. This is useful to monitor your agent's violation patterns, without disrupting the agentic process. |
91
+
| Paused | Pauses the enforcement of the guardrail, allowing all request to pass through without evaluating it. This is useful to temporarily disable a guardrail. |
92
+
93
+
94
+
**Guardrailing Rule**: The guardrailing rules that need to be matched for the overall guardrail to be triggered. This is an editor of the Guardrails rule language, providing Invariant's full expressive power as described in this documentation.
95
+
96
+
97
+
## Using a Guardrail Suggestion
98
+
99
+
To use a pre-defined guardrail, navigate to the bottom part of the Guardrails configuration page.
100
+
101
+
Here, you will see a list of pre-defined guardrails, along with a short description of the guardrail. These preconfigured rules, are meant to be a starting point for your guardrail configuration.
102
+
103
+
Click on the `Details` button to review and modify any preconfigured rule before deploying it to your project. Each guardrail suggestion comes with comments explaining its functionality.
All changes made in Explorer are automatically deployed to your Gateway instance, enabling you to deploy new guardrails and security policies within seconds.
110
+
111
+
This means, even though your agentic system may be running in a slow-to-update production environment, you can quickly respond to new security threats and update your guardrails to your liking, without having to manually update your agent system or re-deploy.
112
+
113
+
It also enables quick experimentation with new guardrails, without having to worry about the underlying infrastructure. Gateway will automatically pull the latest guardrail configuration from Explorer once a new version is deployed, updating your agent's behavior in real-time.
114
+
115
+
## Inspecting Guardrail Failures
116
+
117
+
Lastly, to inspect guardrail failures in detail, navigate to the `Traces` tab in your Explorer project.
118
+
119
+
Newly pushed traces with Guardrail violations will be automatically annoated with Guardrail violation annotations, highlighting the exact range and location of the guardrail violation in the agent trace.
<figcaptionstyle="text-align: center; font-size: 0.8em; color: #666;">Guardrails precisely highlights the location and cause for guardrail violations in the agent trace, allowing users to exactly pinpoint the cause of the violation.</figcaption>
124
+
</figure>
125
+
126
+
As you can see, the guardrail violation is highlighted in the trace down to the violating character range. Given this information, you can easily inspect and refine your guardrailing rules, to precisely match and constrain the behavior of your agentic system.
127
+
128
+
Further, the shown user annotation view, allows you to comment and collaboratively discuss the guardrail violation with your team, allowing for a collaborative debugging experience, including revisions over time and a full history of past guardrailing behavior.
0 commit comments