Skip to content

Commit e3279b6

Browse files
authored
Merge pull request #368 from sohanmaheshwar/main
Added a guide - AI Agent AuthZ
2 parents 5806402 + d0b913b commit e3279b6

File tree

2 files changed

+61
-0
lines changed

2 files changed

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

0 commit comments

Comments
 (0)