Skip to content

Commit 17270e9

Browse files
Zie619claude
andcommitted
feat: add StandaloneInterceptor to all 3 SDKs — works without API key
Adds offline/standalone mode to Python, TypeScript, and Go SDKs: - Embedded Cedar policy evaluator (forbid/permit rules) - Local JSONL event logging (thread-safe) - Three enforcement modes: block, warn, log - URL exclusion patterns - Zero external dependencies for policy evaluation - 34 Python tests, 74 TypeScript tests, 50 Go tests — all passing - STANDALONE.md docs + examples for each SDK - README updated with standalone vs platform comparison table Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2aaeece commit 17270e9

File tree

24 files changed

+6578
-0
lines changed

24 files changed

+6578
-0
lines changed

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<p>
2424
<a href="#quick-start">Quick Start</a> &nbsp;|&nbsp;
2525
<a href="#agent-sdks">Agent SDKs</a> &nbsp;|&nbsp;
26+
<a href="#standalone-vs-platform">Standalone vs Platform</a> &nbsp;|&nbsp;
2627
<a href="#n8n-community-node">n8n Node</a> &nbsp;|&nbsp;
2728
<a href="#what-it-finds">What It Finds</a> &nbsp;|&nbsp;
2829
<a href="#comparison">Comparison</a> &nbsp;|&nbsp;
@@ -140,6 +141,65 @@ interceptor.install(client, { enforcement: "warn" });
140141
// All fetch() calls are now monitored
141142
```
142143

144+
### Standalone Mode (No API Key Required)
145+
146+
All SDKs work **without** a Trusera account — local Cedar policy enforcement + JSONL event logging:
147+
148+
```python
149+
# Python — standalone, zero platform dependency
150+
from trusera_sdk import StandaloneInterceptor
151+
152+
with StandaloneInterceptor(
153+
policy_file=".cedar/ai-policy.cedar",
154+
enforcement="block",
155+
log_file="agent-events.jsonl",
156+
):
157+
# All HTTP calls are now policy-checked and logged locally
158+
agent.run()
159+
```
160+
161+
```typescript
162+
// TypeScript — standalone mode
163+
import { StandaloneInterceptor } from "trusera-sdk";
164+
165+
const interceptor = new StandaloneInterceptor({
166+
policyFile: ".cedar/ai-policy.cedar",
167+
enforcement: "block",
168+
logFile: "agent-events.jsonl",
169+
});
170+
interceptor.install();
171+
// All fetch() calls are now policy-checked and logged locally
172+
```
173+
174+
```go
175+
// Go — standalone mode
176+
interceptor, _ := trusera.NewStandaloneInterceptor(
177+
trusera.WithPolicyFile("policy.cedar"),
178+
trusera.WithEnforcement(trusera.EnforcementBlock),
179+
trusera.WithLogFile("events.jsonl"),
180+
)
181+
defer interceptor.Close()
182+
httpClient := interceptor.WrapClient(http.DefaultClient)
183+
```
184+
185+
### Standalone vs Platform
186+
187+
| Feature | Standalone (free, open source) | Platform (paid) |
188+
|---------|-------------------------------|-----------------|
189+
| Scan codebases for AI components | Yes | Yes |
190+
| Cedar policy gates in CI/CD | Yes | Yes |
191+
| VS Code extension | Yes | Yes |
192+
| n8n workflow scanning | Yes | Yes |
193+
| Runtime HTTP interception | Yes | Yes |
194+
| Local policy enforcement | Yes | Yes |
195+
| Local JSONL event logging | Yes | Yes |
196+
| Centralized dashboard || Yes |
197+
| Team collaboration & RBAC || Yes |
198+
| Alerts (Slack, Jira, SIEM) || Yes |
199+
| Historical trends & analytics || Yes |
200+
| Compliance reports (EU AI Act) || Yes |
201+
| SSO & API key management || Yes |
202+
143203
**Framework integrations:** LangChain, CrewAI, AutoGen (Python) | LangChain.js (TypeScript)
144204

145205
See [docs/interceptor-sdks.md](docs/interceptor-sdks.md) for the full guide.

0 commit comments

Comments
 (0)