Skip to content

Commit 82d89f1

Browse files
more style
1 parent cbffc55 commit 82d89f1

File tree

11 files changed

+129
-42
lines changed

11 files changed

+129
-42
lines changed

docs/assets/invariant.css

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,8 @@ label.md-nav__title {
453453
flex-wrap: wrap;
454454
flex-direction: row;
455455
padding: 4pt;
456-
padding-left: 0pt;
457-
padding-top: 7pt;
456+
padding-left: 2pt;
457+
padding-top: 9pt;
458458
align-items: flex-start;
459459
justify-content: flex-start;
460460
}
@@ -532,7 +532,7 @@ label.md-nav__title {
532532
border: none;
533533
padding: 0pt;
534534
display: flex;
535-
width: 65%;
535+
width: 45%;
536536
}
537537

538538
.overview .box.main:hover {
@@ -643,12 +643,40 @@ blockquote pre {
643643
margin-left: -10pt;
644644
}
645645

646-
blockquote code {
646+
blockquote pre code {
647647
border-radius: 0pt !important;
648648
border-left-width: 0pt;
649649
border-right-width: 0pt;
650650
}
651651

652+
blockquote pre {
653+
width: calc(100% + 15pt);
654+
}
655+
652656
ul.md-nav__list {
653657
font-weight: 400;
658+
}
659+
660+
.md-nav__item.md-nav__item--section.md-nav__item--nested {
661+
margin-top: 20pt !important;
662+
}
663+
664+
.md-nav__item.md-nav__item--section.md-nav__item--nested>label {
665+
color: black !important;
666+
}
667+
668+
.risks blockquote {
669+
background-color: rgb(254, 243, 243);
670+
border: 2pt solid #ff6678 !important;
671+
}
672+
673+
.risks blockquote>p>strong:first-child {
674+
margin-bottom: 10pt;
675+
display: inline-block;
676+
padding-left: 25pt;
677+
678+
background: url("/assets/warning.svg") no-repeat 3pt 1pt;
679+
background-size: 1.2em;
680+
padding-top: -1pt;
681+
margin-top: -5pt;
654682
}

docs/assets/warning.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/guardrails/code-validation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Secure the code that your agent generates and executes.
66

77
Code validation is a critical component of any code-generating LLM system, as it helps to ensure that the code generated by the LLM is safe and secure. Guardrails provides a simple way to validate the code generated by your LLM, using a set of pre-defined rules and checks.
88

9+
<div class='risks'/>
910
> **Code Validation Risks**<br/>
1011
> Code validation is a critical component of any code-generating LLM system. For example, an insecure agent could:
1112

docs/guardrails/computer-use.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Guardrail the actions of computer use agents, to enable safe UI interfacing.
66

77
Computer use agents are powerful general-purpose reasoners, equipped with their own computer and the ability to interact with it. However, to ensure security and correctness properties, it is important to guardrail the actions of these agents, to prevent them from performing undesired or harmful actions.
88

9+
<div class='risks'/>
910
> **Computer Use Agent Risks**<br/>
1011
> Computer use agents are powerful general-purpose reasoners, equipped with their own computer and the ability to interact with it. For example, an insecure agent could:
1112

docs/guardrails/dataflow-rules.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Secure the dataflow of your agentic system, to ensure that sensitive data never
66

77
Due to their dynamic nature, agentic systems often mix and combine data from different sources, and can easily leak sensitive information. Guardrails provides a simple way to define dataflow rules, to ensure that sensitive data never leaves the system through unintended channels.
88

9+
<div class='risks'/>
910
> **Dataflow Risks**<br/>
1011
1112
> Due to their dynamic nature, agentic systems often mix and combine data from different sources, and can easily leak sensitive information. For example, an insecure agent could:

docs/guardrails/explorer.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Overview
3+
---
4+
5+
# Guardrails in Explorer
6+
7+
<div class="subtitle">
8+
Learn how to use Guardrails in Explorer.
9+
</div>

docs/guardrails/function-calls.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ At the core of any agentic systems are function and tool calls, i.e. the ability
88

99
For security and safety reasons, it is important to ensure that all tool calls an agent executes are validated and well-scoped, to prevent undesired or harmful actions.
1010

11+
<div class='risks'/>
1112
> **Tool Calling Risks**<br/>
1213
> Since tools are an agent's interface to interact with the world, they can also be used to perform actions that are harmful or undesired. For example, an insecure agent could:
1314

docs/guardrails/loops.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Detect and prevent infinite loops in your agentic system.
77

88
Loop detection is a critical component of any agentic system, as it helps to prevent infinite loops and other undesired behavior. Guardrails provides a simple way to detect and prevent loops in your agentic system.
99

10+
<div class='risks'/>
1011
> **Looping Risks**<br/>
1112
> Loops are a common source of bugs and errors in agentic systems. For example, an insecure agent could:
1213

docs/guardrails/rules.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Overview
3+
---
4+
5+
# Rule Language
6+
7+
<div class="subtitle">
8+
Learn how to write Guardrail rules.
9+
</div>

docs/index.md

Lines changed: 68 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,79 @@
11
---
2-
title: Welcome
2+
title: Invariant Agent Security
33
---
44

5-
# Invariant Agent Security and Debugging
5+
# Invariant Agent Security
66

77
<div class='subtitle'>A security and debugging layer for agentic AI systems.</div>
88

9-
Invariant offers a toolchain for building and securing agentic AI systems. It supports building secure agentic AI systems _from scratch_, and to _secure existing or deployed AI agents_ in an organization.
9+
Invariant is a **security layer to protect agentic AI systems**. It supports building secure agentic AI systems _from scratch_, and to _secure existing or deployed AI agents_ in an organization.
1010

11-
For this, the _Invariant Gateway_ intercepts and traces the LLM calls of your agent. This enables security guardrailing and insights during development and operation, without requiring any code changes.
11+
For this, the _Invariant Gateway_ **intercepts the LLM calls of your agent**, to implement _guardrailing and security analysis_ during development and operation, without requiring any code changes.
1212

1313
<div class='overview small'>
1414
<div class='clear box thirdparty'>
1515
Agent
1616
</div>
17+
1718
<div class='box fill main clear'>
1819
<a class='box clear' href='./gateway'>
1920
<p>Invariant Gateway</p>
20-
<i>Transparent LLM proxy to trace and intercept LLM calls</i>
21-
<i class='more'></i>
21+
<i>Security proxy to intercept LLM and tool calls</i>
22+
<i class='more'></i>
2223
</a>
2324
</div>
25+
2426
<div class='clear box thirdparty'>
2527
LLM Provider
2628
</div>
2729
</div>
2830

29-
## Getting Started as Developer
31+
## Why You Need A Security Layer for Your Agents
32+
33+
Invariant helps you make sure that your agents are safe from malicious actors and prevents fatal malfunction:
34+
35+
* It **blocks prompt injections and agent jailbreaks**.
36+
* It **imposes strict** rules on agent capabilities and behavior, to prevent malfunction and abuse.
37+
* It **analyzes the data flow of your agents**, to ensure that they are not leaking sensitive information.
38+
* It helps you **steer and control your agents**, to ensure that they are not doing anything unexpected.
39+
* It ensures that your agents are **in compliance with your organization's policies**.
40+
* It helps you to **surface novel malicious behavioral patterns** in your agents, and automatically proposes guardrailing rules to prevent them.
41+
42+
Securing your agent is a crucial step in safely deploying AI agents to production or in your organization.
3043

31-
To quickly integrate your agentic application with Invariant, it is enough to rely on our hosted gateway, to automatically trace your agent's LLM calls and to unlock the Invariant eco-system.
44+
## Getting Started as Developer
3245

33-
```python hl_lines="5 6 7 8 9 10 11 12"
46+
To quickly secure your agentic application with Invariant, you can rely on our hosted gateway. It automatically traces and protects your agent's LLM calls and actions by enforcing guardrailing rules:
3447

48+
**Example:** Guardrailing an agent with Invariant
49+
```python hl_lines='8 9 10 16 17 18 19 20 21 22 23 24'
50+
import os
3551
from swarm import Swarm, Agent
3652
from openai import OpenAI
37-
from httpx import Client
3853

39-
# === Invariant integration ===
54+
# 1. Guardrailing Rules
55+
56+
guardrails = """
57+
raise "Rule 1: Do not talk about Fight Club" if:
58+
(msg: Message)
59+
"fight club" in msg.content
60+
"""
61+
62+
63+
# 2. Gateway Integration
64+
4065
client = Swarm(
41-
client=OpenAI(
42-
# redirect and authenticate with the Invariant Gateway
43-
http_client=Client(headers={"Invariant-Authorization": "Bearer <your-token>"}),
44-
base_url="https://explorer.invariantlabs.ai/api/v1/gateway/<your-dataset-id>/openai",
66+
client = OpenAI(
67+
default_headers={
68+
"Invariant-Authorization": "Bearer " + os.getenv("INVARIANT_API_KEY"),
69+
"Invariant-Guardrails": guardrails.encode("unicode_escape"),
70+
},
71+
base_url="https://explorer.invariantlabs.ai/api/v1/gateway/<your-project-id>/openai",
4572
)
4673
)
4774

48-
# === Agent Implementation ===
75+
76+
# 3. Your Agent Implementation
4977

5078
# define a tool
5179
def get_weather():
@@ -61,26 +89,29 @@ agent = Agent(
6189
# run the agent
6290
response = client.run(
6391
agent=agent,
64-
messages=[{"role": "user", "content": "What's the weather?"}],
92+
messages=[{"role": "user", "content": "Tell me more about fight club."}],
6593
)
94+
```
6695

67-
print(response.messages[-1]["content"])
68-
# Output: "It seems to be sunny."
96+
**Output**
97+
```bash
98+
BadRequest: [Invariant] The message did not pass the guardrailing check:
99+
'Rule 1: Do not talk about Fight Club'"
69100
```
70101
71-
With this code, your agent is automatically tracked and all execution traces will be logged in a designated dataset in Explorer ([screenshot here](./explorer/)).
102+
With this code, your agent is automatically secured and all execution traces will be logged in a designated dataset in Explorer ([screenshot here](./explorer/)).
72103
73-
Overall, this integration opens up your agent system to the full Invariant family of tools, allowing you to [observe and debug](./explorer/), [write unit tests](testing/), and [analyze your agent's behavior for security vulnerabilities](https://github.com/invariantlabs-ai/invariant?tab=readme-ov-file#analyzer).
104+
This integration opens up your agent system to the full Invariant family of tools, allowing you to [guardrail and secure](./guardrails/), [observe and debug](./explorer/) and [unit test](testing/) your agents.
74105
75-
This documentation describes how to get started with Invariant eco-system and how to use the different tools, to build and secure your agentic AI systems.
106+
This documentation describes how to get started with the Invariant eco-system and how to use the different tools, to build and secure your agentic AI systems.
76107
77108
## Getting Started as a Security Admin
78109
79110
Looking to observe and secure AI agents in your organization? Read our no-code quickstart guides below, for configuring different agents directly with the Invariant Gateway.
80111
81-
This way, you can keep track of your organization's agents, without having to change their code.
112+
This way, you can keep track and secure your organization's agents, without having to change their code.
82113
83-
If you are interested in deploying your own dedicated instance of the Invariant Gateway, see [self-hosting](./gateway/self-hosted.md).
114+
If you are interested in deploying your own dedicated instance of the Invariant Gateway, see our [self-hosting guide](./gateway/self-hosted.md).
84115
85116
<div class='tiles'>
86117
@@ -114,15 +145,15 @@ You can use each tool independently, or in combination with each other. The foll
114145
<div class='box fill main clear'>
115146
<a class='box clear' href='./gateway'>
116147
<p>Invariant Gateway</p>
117-
<i>Transparent LLM proxy to trace and intercept LLM calls</i>
118-
<i class='more'></i>
148+
<i>Security proxy to trace and intercept LLM calls</i>
149+
<i class='more'></i>
119150
</a>
120151
<!-- <div class='online'>
121152
<div class='title'>Online Guardrails</div>
122153
<div class='box fill clear' style="flex: 1;">
123154
<p>Analyzer</p>
124155
<i>Agent Security Scanner</i>
125-
<i class='more'></i>
156+
<i class='more'></i>
126157
</div>
127158
</div> -->
128159
</div>
@@ -136,21 +167,21 @@ You can use each tool independently, or in combination with each other. The foll
136167
</div>
137168
<div class='offline'>
138169
<div class='title'>Trace Analysis</div>
170+
<a class='box fill clear' href='https://github.com/invariantlabs-ai/invariant?tab=readme-ov-file#analyzer'>
171+
<p>Guardrails</p>
172+
<i>Steer and protect your agents</i>
173+
<i class='more'>↗ </i>
174+
</a>
139175
<a class='box fill clear' href='./explorer'>
140176
<p>Explorer</p>
141-
<i>Trace viewing</i>
142-
<i class='more'></i>
177+
<i>Trace analysis and debugging</i>
178+
<i class='more'></i>
143179
</a>
144-
<a class='box fill clear' href='./testing'>
180+
<!-- <a class='box fill clear' href='./testing'>
145181
<p>Testing</p>
146182
<i>Agent Unit Testing</i>
147-
<i class='more'>→</i>
148-
</a>
149-
<a class='box fill clear' href='https://github.com/invariantlabs-ai/invariant?tab=readme-ov-file#analyzer'>
150-
<p>Analyzer</p>
151-
<i>Agent Security Scanner</i>
152-
<i class='more'>→</i>
153-
</a>
183+
<i class='more'>↗ </i>
184+
</a> -->
154185
</div>
155186
<div class='clear box thirdparty hidden'>
156187
LLM Provider

0 commit comments

Comments
 (0)