Skip to Content
AgentShield
Architecture

System Architecture

The complete AgentShield system. Processes, libraries, data stores, how they communicate, and why the boundaries are drawn where they are.

AgentShield is one repository that builds five long-running processes and three libraries. The split follows a single rule from ADR 0001: the enforcement path and the management path change for different reasons and must fail independently.

AgentShield system architectureAgents call the gateway through an SDK. The gateway verifies the signature, evaluates policy, and runs registered adapters against external tools. Operators use the dashboard, which calls the control plane. Committed events reach NATS JetStream and MinIO through the event relay.Untrusted: agent runtimeAgentShield trust boundaryExternalAgent processLLM + frameworkIntegrationLangGraph · LangChainSDK clientPython · TypeScriptEd25519 seed stays hereOperatorbrowserRuntime gateway (Go)identity · verifynonce · budgetspolicy · evaluateadapters · executesigns every requestIntelligence engineadvisory content analysisRedisnonces · limitsPostgreSQLsource of truthControl plane (NestJS)agents · policies · approvalsDashboard (Next.js)operations consoleEvent relay (Go)outbox → streamoutboxNATSJetStreamMinIOevidenceverified evidence readsHTTP APIsallow-listed hostsSubscribersyour consumershttp.request adaptersynchronous request pathasynchronous, after commit
Every component shown runs in the repository today. The agent runtime is outside the trust boundary.

Components

ComponentPathKindDefault address
Runtime gatewayruntime/gateway/cmd/gatewayGo process127.0.0.1:8081
Event relayruntime/gateway/cmd/event-relayGo process127.0.0.1:8083
Control planeapps/control-planeNestJS process127.0.0.1:8080
Dashboardapps/dashboardNext.js process127.0.0.1:3000
Intelligence engineapps/intelligence-enginePython process127.0.0.1:8082
Policy engineruntime/policy-engineGo library, linked into the gateway—
Identityruntime/identityGo library, linked into the gateway—
SDKs and integrationssdk/, integrations/Libraries in the agent process—
Data storeRole
PostgreSQL 16Transactional source of truth: identities, policies, decisions, executions, events, audit chain
Redis 7Nonce reservations, budget counters, circuit state
NATS JetStreamStream of committed security events
MinIO (S3 API)Evidence bundles in a private bucket

Communication

FromToProtocolAuthentication
SDKGatewayHTTP JSONEd25519 request signature
GatewayPostgreSQL, RedisNativeConnection credentials
GatewayIntelligence engineHTTP JSONShared bearer token (required in production)
GatewayExternal APIsHTTPS via http.requestCredentials injected from gateway environment
BrowserDashboardHTTPHttpOnly, SameSite=Strict session cookie
DashboardControl planeHTTP JSONBearer session, added server-side
Control planePostgreSQL, MinIO, SMTPNative, S3, SMTPConnection credentials
Event relayPostgreSQL, NATS, MinIONative, NATS, S3Connection credentials
PrometheusEvery serviceHTTP /metrics on a separate portNone; network-restricted

The dashboard never talks to the gateway, and the gateway never talks to the control plane. They share only the database, with disjoint write responsibilities.

Request paths

Agent process

The SDK serializes and signs the request

The client builds the authorize body, serializes it once, and signs those exact bytes. The private seed never leaves the agent process.

sdk/python/agentshield_sdk/client.py

  • Signing input: <unix-seconds>.<nonce>.<hex sha256(body)>
  • Nonce: 16–128 characters of [A-Za-z0-9_-]
  • Headers: X-AgentShield-Agent-Id, -Timestamp, -Nonce, -Signature
1 / 10

Why these boundaries

Architectural invariants

These hold across every component and are enforced in code and tests:

  1. Missing policy is deny. An error is never an allow.
  2. A recorded decision exists before any adapter runs.
  3. Each execution reaches its adapter at most once.
  4. Security events and their audit links commit in the same transaction as the change they describe.
  5. Model scores and content findings never change an authorization outcome.
  6. Raw tool arguments are never persisted; only redacted copies and hashes.
  7. Agent credentials are refused on management routes; human sessions are refused on enforcement routes.

Architectural direction

The decision contract is the extension point for the enforcement path. Adapters are registered by tool name behind a small interface, so new tool types plug in without changing authorization. The /v1/analyze contract allows additional analyzers, including model-based classifiers, to sit behind the same advisory interface. The event stream is the integration point for downstream consumers such as SIEM forwarding or analytical storage, which subscribe without touching the hot path.

Explore each component

Was this page helpful?

On this page