Getting Started with PRECINCT
Get from zero to a running PRECINCT stack in minutes. This guide walks you through prerequisites, deployment options, your first secured request, and verification of every security layer.
Prerequisites
The following tools are needed to build and run the PRECINCT stack. Only the first three are required for the Docker Compose quickstart; the rest are needed only for Kubernetes deployment, policy testing, or manifest validation.
| Tool | Required Version | Purpose |
|---|---|---|
| Docker + Docker Compose | v24+ / v2.20+ |
Container runtime |
| Go | 1.22+ |
Gateway build |
| Make | any | Build automation |
| kubectl | 1.28+ |
K8s deployment (optional) |
| kustomize | 5.0+ |
K8s overlay management (optional) |
| opa | 0.60+ |
Policy testing (optional) |
| kubeconform | latest | Manifest validation (optional) |
Option 1: Docker Compose (Recommended for First Run)
Docker Compose is the fastest way to get PRECINCT running. The entire stack
(gateway, SPIRE, OPA, mock MCP servers, and observability) comes up with a
few make commands.
Step 1: Clone the repository
git clone https://github.com/RamXX/agentic_reference_architecture.git
cd agentic_reference_architecture/POC
Step 2: Start the observability stack
make phoenix-up
# Phoenix UI available at http://localhost:6006
Optional indexed audit backend:
make opensearch-up && make opensearch-seed
(Dashboards at http://localhost:5601).
Step 3: Start the full PRECINCT stack
make up
# Gateway available at http://localhost:9090
Step 4: Run the E2E demo (28 test scenarios)
make demo-compose
Step 5: Explore
curl -s http://localhost:9090/health | jq .
make up starts SPIRE (server + agent), the PRECINCT gateway, OPA with
policy bundles, KeyDB for rate limiting, mock MCP servers (Tavily, Brave, Fetch),
and a DSPy researcher agent. All workloads receive SPIFFE identities automatically.
Option 2: Kubernetes (Docker Desktop)
For a production-representative deployment, run PRECINCT on Kubernetes. Docker Desktop's built-in Kubernetes works out of the box.
Step 1: Enable Kubernetes in Docker Desktop
Open Docker Desktop, navigate to Settings → Kubernetes → Enable Kubernetes, and wait for the cluster to become ready.
Step 2: Deploy
cd POC
make k8s-up
# Gateway available at http://localhost:30090
Optional: deploy the Kubernetes OpenSearch extension with
make k8s-opensearch-up once required TLS and credential
secrets are provisioned in observability.
Step 3: Run E2E demo
make demo-k8s
Step 4: Tear down
make k8s-down
Your First Request
Once the stack is running, interact with the PRECINCT gateway directly. These examples
use the Docker Compose endpoint (localhost:9090); substitute
localhost:30090 if running on Kubernetes.
List available tools (authenticated)
curl -s http://localhost:9090/ \
-H "Content-Type: application/json" \
-H "X-SPIFFE-ID: spiffe://poc.local/agents/mcp-client/dspy-researcher/dev" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}' | jq .
Call a tool
curl -s http://localhost:9090/ \
-H "Content-Type: application/json" \
-H "X-SPIFFE-ID: spiffe://poc.local/agents/mcp-client/dspy-researcher/dev" \
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"tavily_search","arguments":{"query":"AI security"}},"id":2}' | jq .
Try without identity (should fail)
curl -s http://localhost:9090/ \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}' | jq .code
The third request (without an X-SPIFFE-ID header) will
return spiffe_auth_required. This is by design. Every request to the
PRECINCT gateway must carry a verifiable workload identity.
Verify Security Controls
Walk through each layer of the PRECINCT security model to confirm that all controls are active and enforcing correctly.
-
Identity: Send a request without a SPIFFE ID. The gateway
returns
spiffe_auth_required, confirming that unauthenticated requests are rejected at layer 3. -
Authorization: Send a request with a valid but unauthorized
SPIFFE ID. The gateway returns
authz_policy_denied, confirming that OPA policy evaluation at layer 6 blocks the request. -
DLP: Send a request body containing an AWS access key
(e.g.,
AKIAIOSFODNN7EXAMPLE). The gateway returnsdlp_credentials_detected, confirming that the DLP scanner at layer 7 blocks credential exfiltration. -
Tool Registry: Request an unknown tool name. The gateway
returns
tool_not_in_registry, confirming that only registered and hash-verified tools may be invoked. -
Rate Limiting: Send a burst of rapid requests. The gateway
returns HTTP
429 Too Many Requests, confirming that per-identity token-bucket enforcement at layer 11 is active. - Audit: Check gateway logs for hash-chained JSONL audit events. Each event contains a unique decision ID and a cryptographic hash linking it to the previous event, providing tamper-evident audit trails.
If all six verifications return the expected deny codes and audit events, every
layer of the PRECINCT security model is operational. The E2E demo
(make demo-compose) automates all 28 test scenarios covering these
and additional edge cases.
Generate Compliance Evidence
PRECINCT includes built-in tooling for generating compliance artifacts, running security scans, and validating production readiness.
Full compliance report
make compliance-report
Security scans
make security-scan
Production readiness validation
make production-readiness-validate
The compliance report maps PRECINCT controls to SOC 2, NIST 800-53, and ISO 27001 frameworks. See the For Auditors page for the complete compliance framework mapping.
Run Benchmarks
Measure the performance impact of the 13-layer middleware chain with the built-in benchmark suite.
make benchmark
# Shows: Go benchmarks, latency percentiles, per-middleware breakdown, load test
The benchmark output includes Go micro-benchmarks for each middleware layer, end-to-end latency percentiles (p50, p95, p99), per-middleware breakdown showing exactly where time is spent, and a load test that exercises the full stack under sustained throughput.
Explore the Codebase
The PRECINCT proof-of-concept lives in the POC/ directory. Here is a
guide to the key paths.
| Path | Contents |
|---|---|
cmd/gateway/ |
Gateway binary entry point |
cmd/agw/ |
CLI tool for operations and compliance |
internal/gateway/ |
Gateway core (middleware chain, handlers) |
internal/gateway/middleware/ |
All 13 middleware implementations |
config/opa/ |
Rego policy files + tests |
config/spire/ |
SPIRE server and agent configuration |
config/capability-registry-v2.yaml |
Tool and model registration |
infra/eks/ |
Kubernetes manifests and Kustomize overlays |
tests/ |
Unit, integration, E2E, conformance tests |
tools/compliance/ |
Compliance report generator |
demo/ |
E2E demo scripts and mock servers |
docs/ |
Architecture, API reference, deployment guides |
Next Steps
PRECINCT is running. Now what?
Follow the Integration Guide to connect your existing agent to PRECINCT in 4 steps: register identity, register tools, write a policy, and route traffic.
Now that you have a running stack, dive deeper into the architecture, compliance mappings, and production deployment guides.
Architecture
Understand the full security model: five governed planes, 13-layer middleware chain, threat model, and key design decisions.
For Auditors
Compliance framework mappings for SOC 2, NIST 800-53, and ISO 27001. Evidence collection and control documentation.
Case Study
See how a real agentic AI application was secured by PRECINCT without any code changes.
Docker Compose Deployment
Detailed guide to the Docker Compose stack: service configuration, networking, volume mounts, health checks, and troubleshooting.
Kubernetes Deployment
Production Kubernetes deployment: Kustomize overlays, namespace isolation, SPIRE DaemonSet, and EKS-specific configuration.
Get Help
- GitHub Issues: github.com/RamXX/agentic_reference_architecture/issues
-
Full documentation: available in the repository
docs/directory. -
Architecture specification:
precinct-reference-architecture.mdin the repository root.