Repository navigation
AgentGuard_V0.6.0
AgentGuard v0.6.0 — Persistent Multi-Tenant State
v0.6 makes AgentGuard stateful and multi-tenant. The approval queue, rate-limit buckets, and cost accumulators now survive restarts, and a single instance can serve many tenants — each evaluated against its own policy with fully isolated state. It all stays off the hot path: measured /v1/check p99 is 0.53 ms with persistence enabled.
Highlights
🗄️ Durable, Zero-Config Persistence
agentguard serve now writes runtime state behind to a local SQLite database (agentguard.db, created automatically) and rehydrates it on boot. It's a write-behind, cold-path design — the store is never read or written on the /v1/check request path, so the <3 ms latency budget is untouched. A background syncer flushes snapshots on a ≥1 s ticker and on graceful shutdown. Use --persist=false for the previous pure-in-memory behavior.
🏢 Multi-Tenant Policies
Register per-tenant policies and serve them over the /v1/t/<tenant>/... routes. Each tenant is evaluated against its own policy, with isolated approvals, rate limits, cost accumulators, and audit. A tenant with no policy is denied (deny:tenant:not_found).
agentguard tenant put acme --policy acme-policy.yaml
agentguard tenant list
curl -X POST localhost:8080/v1/t/acme/check \
-d '{"scope":"shell","command":"deploy app"}' # evaluated against acme's policy
🔒 Tenant Isolation + An Audit Fix
Every per-request store is partitioned by tenant (rate-limit, cost, approvals, SSE). The audit schema gained a tenant_id field and /v1/t/<tenant>/audit is now scoped to its tenant — closing a cross-tenant audit-read leak. Single-tenant output is byte-identical (no schema_version bump).
🗃️ Optional SQLite Audit Backend
--audit-backend=store routes the audit trail into the store's indexed audit_entries table for a one-file deployment with indexed /v1/audit queries (always async-buffered to keep DB writes off the hot path). The default stays JSONL.
Technical Details
🛠️ New CLI Surface
- Serve flags:
--persist(defaulttrue),--store-dsn,--data-dir,--audit-backend=file|store - New commands:
agentguard tenant put,agentguard tenant list,agentguard tenant rm
🚀 Upgrade Notes
- Stateful by default: A first run creates
agentguard.db(+-wal/-shmsidecars) in the working directory. This is additive; the wire contract (schema_version: v1, the/v1/t/{tenant}/...routes) is unchanged. Run with--persist=falseto keep the old behavior. - Single-node persistence: State is not yet shared across instances. Keep replicas to
1; a PostgreSQL backend for multi-node is next.
🐛 Also Fixed
- File-watcher transient-read race: Fixed an atomic-replace edit issue (Windows
ERROR_SHARING_VIOLATION) — reloads now self-heal instead of silently dropping a policy change. - New dependency: Added
modernc.org/sqlite(pure-Go, no CGO).
Note: Full details are available in
CHANGELOG.md.