Skip to Content
AgentShield
Operations

Event Streaming

Consume AgentShield security events from NATS JetStream. Subjects, message format, durable consumers, and integration patterns.

Every committed security event is published to NATS JetStream by the event relay. Subscribe to feed a SIEM, trigger workflows, or build analytics, without touching the gateway's request path.

Stream and subjects

PropertyValue
StreamAGENTSHIELD_EVENTS
Subjectagentshield.events.<organization id>.<event type>
Retention7 days
DeduplicationNats-Msg-Id = event id, 10-minute window

Event types are already dotted, so subject filters compose naturally:

FilterReceives
agentshield.events.>Everything
agentshield.events.<org>.>One organization
agentshield.events.*.tool.*tool.executed and tool.failed, all organizations
agentshield.events.*.content.flaggedContent analysis findings
agentshield.events.<org>.authorization.decidedOne organization's decisions

Message format

{
  "id": "6d0c2b4e-…",
  "organization_id": "9a7e5d2c-…",
  "agent_id": "3f2b8c1e-…",
  "execution_id": "c4d6e8f0-…",
  "event_type": "authorization.decided",
  "occurred_at": "2026-11-30T12:00:00.123456Z",
  "payload": {
    "arguments": { "headers": { "Accept": "application/json" } },
    "operation": "http.get",
    "outcome": "allow",
    "reason": "allowed",
    "resource": "https://api.github.com/repos/octo/hello",
    "tool_name": "http.request"
  },
  "audit_hash": "4be1…"
}

payload is the redacted payload stored in PostgreSQL. agent_id and execution_id are null for events not tied to them, such as member changes.

Create a durable consumer

nats consumer add AGENTSHIELD_EVENTS siem-forwarder \
  --filter 'agentshield.events.>' \
  --ack explicit --deliver all --max-deliver 10 --pull

Process messages idempotently by id. Delivery is at least once; the relay's deduplication window removes publisher-side duplicates, but your consumer can still see redelivery after a missed ack.

Delivery guarantees

GuaranteeDetail
Only committed eventsThe outbox is filled by a trigger in the writer's transaction; rolled-back changes are never published
No loss while the relay is downEvents wait in event_outbox
OrderingPreserved per relay; run one relay replica
HistorySeven days in the stream; the full history remains in PostgreSQL

Patterns

  • SIEM forwarding. A consumer on agentshield.events.> that writes to your SIEM, keyed by id.
  • Alert routing. A consumer on *.content.flagged and *.tool.failed that opens tickets.
  • Analytics. Aggregate decisions per organization and tool into an analytical store. Treat it as a reporting copy; PostgreSQL remains the source of truth for authorization.

Evidence

The relay's own evidence consumer turns content.flagged and tool.failed events into bundles in object storage. Do not reuse that consumer name.

Was this page helpful?

On this page