Skip to content

Commit f9beea8

Browse files
added a new guide for AI Agents
1 parent 6a7f1da commit f9beea8

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

pages/spicedb/ops/_meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"observability": "Observability Tooling",
33
"deploying-spicedb-operator": "Deploying the SpiceDB Operator",
4+
"ai-agent-authorization": "Authorization for AI Agents",
45
"secure-rag-pipelines": "Secure Your RAG Pipelines with Fine Grained Authorization"
56
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import JupyterNotebookViewer from "@/components/JupyterNotebookViewer";
2+
3+
# Secure AI Agents with Fine Grained Authorization
4+
5+
This guide shows how to build a secure Retrieval-Augmented Generation (RAG) pipeline where AI Agents can only access documents they are authorized for.
6+
Authorization decisions are enforced by SpiceDB. You can also get summary of only the documents the AI Agent is authorized to view.
7+
8+
This guide uses OpenAI, Pinecone, Langchain, Jupyter Notebook and SpiceDB
9+
10+
## Setup and Prerequisites
11+
12+
- Access to a [SpiceDB](https://authzed.com/spicedb) instance.
13+
You can find instructions for installing SpiceDB [here](https://authzed.com/docs/spicedb/getting-started/install/macos)
14+
- A [Pinecone account](https://www.pinecone.io/) and API key
15+
- An [OpenAI Platform account](https://platform.openai.com/docs/overview) and API key
16+
- [Jupyter Notebook](https://jupyter.org/) running locally
17+
18+
### Running SpiceDB
19+
20+
Once you've installed SpiceDB, run a local instance with this command in your terminal:
21+
22+
`spicedb serve --grpc-preshared-key "agents"`
23+
24+
and you should see something like this that indicates an instance of SpiceDB is running locally:
25+
26+
```
27+
user @ mac % spicedb serve --grpc-preshared-key "agents"
28+
1:33PM INF configured logging async=false format=auto log_level=info provider=zerolog
29+
1:33PM INF GOMEMLIMIT is updated GOMEMLIMIT=25769803776 package=github.com/KimMachineGun/automemlimit/memlimit previous=922
30+
3372036854775807
31+
1:33PM INF configured opentelemetry tracing endpoint= insecure=false provider=none sampleRatio=0.01 service=spicedb v=0
32+
1:33PM WRN this version of SpiceDB is out of date. See: https://github.com/authzed/spicedb/releases/tag/v1.44.4 latest-rele
33+
ased-version=v1.44.4 this-version=v1.42.1
34+
1:33PM INF using memory datastore engine
35+
1:33PM WRN in-memory datastore is not persistent and not feasible to run in a high availability fashion
36+
1:33PM INF configured namespace cache defaultTTL=0 maxCost="32 MiB" numCounters=1000
37+
1:33PM INF schema watch explicitly disabled
38+
1:33PM INF configured dispatch cache defaultTTL=20600 maxCost="13 MiB" numCounters=10000
39+
1:33PM INF configured dispatcher balancerconfig={"loadBalancingConfig":[{"consistent-hashring":{"replicationFactor":100,"sp
40+
read":1}}]} concurrency-limit-check-permission=50 concurrency-limit-lookup-resources=50 concurrency-limit-lookup-subjects=5
41+
0 concurrency-limit-reachable-resources=50
42+
1:33PM INF grpc server started serving addr=:50051 insecure=true network=tcp service=grpc workers=0
43+
1:33PM INF configuration ClusterDispatchCacheConfig.CacheKindForTesting=(empty) ClusterDispatchCacheConfig.Enabled=true ClusterDispatchCacheConfig.MaxCost=70% ClusterDispatchCacheConfig.Metrics=true ClusterDispatchCacheConfig.Name=cluster_dispatch ClusterDispatchCacheConfig.NumCounters=100000 Datastore=nil DatastoreConfig.AllowedMigrations="(slice of size 0)" DatastoreConfig.BootstrapFileContents="(map of size 0)" DatastoreConfig.BootstrapFiles=[] DatastoreConfig.BootstrapOverwrite=false DatastoreConfig.BootstrapTimeout=10000 DatastoreConfig.ConnectRate=100 DatastoreConfig.CredentialsProviderName=(empty) DatastoreConfig.DisableStats=false DatastoreConfig.EnableConnectionBalancing=true DatastoreConfig.EnableDatastoreMetrics=true
44+
1:33PM INF running server datastore=*schemacaching.definitionCachingProxy
45+
1:33PM INF http server started serving addr=:9090 insecure=true service=metrics
46+
1:33PM INF telemetry reporter scheduled endpoint=https://telemetry.authzed.com interval=1h0m0s next=38s
47+
```
48+
49+
#### Download the Jupyter Notebook
50+
51+
Clone the `workshops` [repository](https://github.com/authzed/workshops/) to your system and type `cd ai-agent-authorization` to enter the working directory.
52+
53+
Start the `ai-agent-authz-v2.ipynb` Notebook locally by typing `jupyter ai-agent-authz-v2.ipynb` (or `python3 -m notebook`) in your terminal.
54+
55+
## Add Fine Grained Authorization to AI Agents
56+
57+
Here's the Jupyter Notebook with step-by-step instructions
58+
59+
<JupyterNotebookViewer fileUrl="authzed/workshops/blob/main/ai-agent-authorization/ai-agent-authz-v2.ipynb" />

0 commit comments

Comments
 (0)