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/copyright.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,39 +12,39 @@ It is important to ensure that content generated by agentic systems respects int
12
12
!!! danger "Copyright Risks"
13
13
Agents that generate code or other copyrighted material without proper authorization are at risk of violating copyright laws. This could expose your agentic system to legal liability:
14
14
15
-
* You agent may handle, process and reproduce copyrighted material without permission
15
+
* Your agent may handle, process, and reproduce copyrighted material without permission.
16
16
17
-
* You may unknowingly host copyrighted material without permission
17
+
* You may unknowingly host copyrighted material without permission.
18
18
19
-
* You may unknowingly expose copyrighted material to users
19
+
* You may unknowingly expose copyrighted material to users.
20
20
21
21
22
-
Guardrails provides the `copyright` function to detect if any licenses are present in a given piece of text, to protect against exactly this.
22
+
Invariant provides the `copyright` function to detect if any licenses are present in a given piece of text, to protect against exactly this.
23
23
24
24
## copyright <spanclass="detector-badge"></span>
25
25
```python
26
26
defcopyright(
27
-
data: Union[str, List[str]],
28
-
) -> List[str]
27
+
data: str| list[str],
28
+
) -> list[str]
29
29
```
30
30
Detects copyrighted text material if it isin`data`and returns the detected licenses.
Copy file name to clipboardExpand all lines: docs/guardrails/explorer.md
+6-7Lines changed: 6 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Learn how to configure and manage your guardrailing rules in Explorer.
12
12
13
13
[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.
14
14
15
-
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.
15
+
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.
| Block | Blocks the request outright, returning an HTTP error to the client. |
97
-
| 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. |
98
-
| Paused | Pauses the enforcement of the guardrail, allowing all request to pass through without evaluating it. This is useful to temporarily disable a guardrail. |
96
+
| Log |Lets 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. |
97
+
| Paused | Pauses the enforcement of the guardrail, allowing all requests to pass through without evaluating it. This is useful to temporarily disable a guardrail. |
99
98
100
99
101
100
**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.
@@ -105,7 +104,7 @@ Here, you can configure the following parameters:
105
104
106
105
To use a pre-defined guardrail, navigate to the bottom part of the Guardrails configuration page.
107
106
108
-
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.
107
+
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.
109
108
110
109
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.
111
110
@@ -115,9 +114,9 @@ Click on the `Details` button to review and modify any preconfigured rule before
115
114
116
115
All changes made in Explorer are automatically deployed to your Gateway instance, enabling you to deploy new guardrails and security policies within seconds.
117
116
118
-
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.
117
+
This means, that 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.
119
118
120
-
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.
119
+
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 realtime.
Copy file name to clipboardExpand all lines: docs/guardrails/gateway.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ icon: bootstrap/hdd-network
10
10
Learn how Invariant guardrailing rules are enforced and deployed.
11
11
</div>
12
12
13
-
Invariant is a guardrailing layer, located between you and your LLM and MCP servers. This means, it intercepts, analyzes and secures every LLM and tool interaction of your agentic system, without you having to change your code.
13
+
Invariant is a guardrailing layer, located between you and your LLM and MCP servers. This means it intercepts, analyzes, and, secures every LLM and tool interaction of your agentic system, without you having to change your code.
@@ -20,13 +20,13 @@ To use Invariant, you need to integrate [Invariant Gateway](../gateway/index.md)
20
20
21
21
## LLM Proxying and Guardrails
22
22
23
-
In the case of LLM proxying, gateway will intercept every LLM call of you agent system (including the current agent context), apply the configured guardrailing rules to the input, and then invoke the actual LLM provider.
23
+
In the case of LLM proxying, gateway will intercept every LLM call of your agent system (including the current agent context), apply the configured guardrailing rules to the input, and then invoke the actual LLM provider.
24
24
25
25
Once the LLM provider returns the response, the gateway will again apply your guardrailing rules to the LLM response, and ensure that the response and its consequence (e.g. tool calls) are safe to execute, according to your guardrails.
26
26
27
27
**Handling Failure:** In case any of the checks fail, Gateway will return an HTTP error response instead of the LLM response, allowing your agent system to handle the guardrail violation gracefully.
28
28
29
-
To help with that, the error response will include information on the violated guardrail, including the specified error message, the violated rule, and the address of the violating components in your agent's context (e.g. messages indices, contents and sub-ranges).
29
+
To help with that, the error response will include information on the violated guardrail, including the specified error message, the violated rule, and the address of the violating components in your agent's context (e.g. messages indices, contents, and sub-ranges).
@@ -39,15 +39,15 @@ In contrast to traditional guardrailing system, Guardrails follows a pipelined a
39
39
<imgsrc="site:/guardrails/pipelined.svg"alt="Pipelining and Incremental Guardrailing"class="pipelining-incremental-guardrails"style="display: block; margin: 0auto; width: 100%;"/>
40
40
<br/><br/>
41
41
42
-
As illustrated above, input latency can oftentimes be entirely eliminated by our pipelined execution approach, whereas output latency is greatly reduced, because of Invariant's stateful, cached and pre-computed rule evaluation. Guardrails' rule engine will eagerly pre-compute all matching parts of a rule, such that once the LLM response arrives, only very little checking remains. To achieve this, Guardrails automatically orchestrates rule evaluation, including ML model inference, using an optimized execution graph.
42
+
As illustrated above, input latency can oftentimes be entirely eliminated by our pipelined execution approach, whereas output latency is greatly reduced, because of Invariant's stateful, cached, and pre-computed rule evaluation. Guardrails' rule engine will eagerly pre-compute all matching parts of a rule, such that once the LLM response arrives, only very little checking remains. To achieve this, Guardrails automatically orchestrates rule evaluation, including ML model inference, using an optimized execution graph.
43
43
44
44
## Deploying your Guardrails
45
45
46
46
To deploy your guardrailing rules, you have two options:
47
47
48
-
<!-- 1. **Stateless via Header**: You can send your guardrailing rules with every LLM call in a desiganted `Invariant-Guardrails` header field.
48
+
<!-- 1. **Stateless via Header**: You can send your guardrailing rules with every LLM call in a designated `Invariant-Guardrails` header field.
49
49
50
-
2. **Managed Via Exlorer**: You can manage your guardrailing rules via Invariant Explorer. This decouples guardrail management from your agent code, but allows for centralized management of guardrails. -->
50
+
2. **Managed Via Exlorer**: You can manage your guardrailing rules via Invariant Explorer. This decouples guardrail management from your agent code but allows for centralized management of guardrails. -->
51
51
52
52
<divclass='tiles'>
53
53
<ahref="#via-header"class='tile primary'>
@@ -105,11 +105,11 @@ This snippet demonstrates how to use the managed instance of Gateway, accessible
105
105
106
106
Apart from this, you can also use a local instance of Gateway, by setting the `base_url` to your local instance. See the [Gateway documentation](../gateway/self-hosted.md) for more details on local deployment.
107
107
108
-
Passing via header is a stateless approach, meaning that every request will need to include the guardrailing rules. This is useful for quick testing and prototyping, but means that your agentic system must define and send its own guardrailing rules with every request.
108
+
Passing via header is a stateless approach, meaning that every request will need to include the guardrailing rules. This is useful for quick testing and prototyping but means that your agentic system must define and send its own guardrailing rules with every request.
109
109
110
110
<h3id="via-explorer">Configuring Guardrails via Explorer</h3>
111
111
112
-
To configure guardrailing rules outside of the actual agentic system, you can use [Invariant Explorer](https://explorer.invariantlabs.ai). This allows you to manage your guardrailing rules in a centralized way, and decouples guardrail management from your agent code. It is also useful, if you do not control the code of the agentic system itself, but want to constrain its behavior.
112
+
To configure guardrailing rules outside of the actual agentic system, you can use [Invariant Explorer](https://explorer.invariantlabs.ai). This allows you to manage your guardrailing rules in a centralized way and decouples guardrail management from your agent code. It is also useful, if you do not control the code of the agentic system itself, but want to constrain its behavior.
113
113
114
114
Explorer provides a comprehensive user interface to manage and configure your guardrailing rules, including a list of suggested rules, a rule editor, and a rule testing interface.
Copy file name to clipboardExpand all lines: docs/guardrails/images.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
---
2
2
title: Images
3
-
description: Secure images given to, or produced by, your agentic system.
3
+
description: Secure images given to, or produced by your agentic system.
4
4
---
5
5
6
6
# Images
7
7
8
8
<divclass='subtitle'>
9
-
Secure images given to, or produced by your agentic system.
9
+
Secure images given to or produced by your agentic system.
10
10
</div>
11
11
12
12
At the core of computer vision agents is the ability to perceive their environment through images, typically by taking screenshots to assess the current state. This visual perception allows agents to understand interfaces, identify interactive elements, and make decisions based on what they "see."
@@ -19,41 +19,41 @@ Additionally, some systems may allow users to submit images, posing additional r
19
19
20
20
> * Capture **personally identifiable information (PII)** like names or addresses.
21
21
>
22
-
> * View credentials such as **passwords, API keys, or access tokens**like present in passport images or other documents.
22
+
> * View credentials such as **passwords, API keys, or access tokens** present in passport images or other documents.
23
23
>
24
24
> * Get **prompt injected or jailbroken** from text in an image.
25
25
>
26
26
> * Generate images with **explicit or harmful content**.
27
27
28
28
29
-
Guardrails provide you a powerful way to enforce visual security policies, and to limit the agent's perception to only the visual information that is necessary and appropriate for the task at hand.
29
+
Guardrails provide a powerful way to enforce visual security policies, and to limit the agent's perception to only the visual information that is necessary and appropriate for the task at hand.
30
30
31
31
32
32
## ocr <spanclass="parser-badge"/>
33
33
```python
34
34
defocr(
35
-
data: str, List[str],
36
-
config: Optional[dict]
37
-
) -> List[str]
35
+
data: str| list[str],
36
+
config: dict|None=None
37
+
) -> list[str]
38
38
```
39
39
Given an image asinput, this parser extracts and returns the text in the image using [Tesseract](https://github.com/tesseract-ocr/tesseract).
|`List[str]`| A list of extracted pieces of text from`data`. |
51
+
|`list[str]`| A list of extracted pieces of text from`data`. |
52
52
53
53
### Analyzing Text in Images
54
54
The `ocr` function is a <span class="parser-badge" size-mod="small"></span> so it returns the data found from parsing its content; in this case, any text present in an image will be extracted. The extracted text can then be used for further detection, for example detecting a prompt injection in an image, like the example below.
Given some `Content`, this <span class="builtin-badge" size-mod="small"></span> extracts allimages. This is useful when messages may contain mixed content.
76
+
Given some [`Content`](/docs-guardrails/guardrails/basics/#message), this <span class="builtin-badge" size-mod="small"></span> extracts all [`ImageContent`](/docs-guardrails/guardrails/basics/#message). This is useful when messages may contain mixed content.
0 commit comments