Architecture

Swiftward is a modular policy enforcement engine for on-premises deployment. Single binary — runs as one process or scales horizontally as separate components.

Components

Ingestion

  • HTTP and gRPC APIs (sync and async modes)
  • Event validation and partitioned queuing
  • Entity-level ordering guarantees

Workers

  • Policy evaluation against active version
  • Transactional state mutations
  • Decision trace generation
  • Action execution (webhooks, HITL, notifications)

Control API + UI

  • Policy management (upload, validate, activate, rollback)
  • Investigation console with filtering and time-series
  • Entity state browser with mass edit
  • HITL review queues with SLA tracking
  • Event replay console
  • A/B testing and shadow mode management

LLM Gateway

  • OpenAI-compatible proxy
  • Real-time PII detection and redaction
  • Prompt injection detection (ML-based guardrails)
  • Policy evaluation on every request/response

MCP Gateway

  • Tool call authorization for AI agents
  • Policy-based access control for MCP tool execution

Deployment Modes

Mode Description Use Case
Single Process All components in one binary Development, low-volume production
Role-Based Separate processes per component Horizontal scaling, isolation

Storage

PostgreSQL (required)

  • Single dependency for event queuing, state, policy storage, and audit trail
  • ACID transactions for state consistency
  • Familiar ops model (backups, replication, monitoring)
  • No distributed coordination complexity

Optional Adapters

Adapter Purpose When to Use
Kafka Ingestion buffering, cross-DC replication >10k events/sec, multi-region
Redis Signal caching, rate limiting High cache hit rates, rate limiting
ClickHouse Long-term analytics and dashboards Retention beyond Postgres, heavy aggregations

Data Flow

  1. Event arrives (HTTP/gRPC)
  2. Validated and queued (partitioned by entity)
  3. Worker evaluates against active policy
  4. State changes committed atomically
  5. Decision trace written (immutable audit record)
  6. Actions executed + response returned

Key Properties

  • Deterministic — same event + same state + same policy = same verdict
  • Replayable — re-evaluate historical events against any policy version
  • Idempotent — each event processed exactly once
  • ACID — state mutations in a single transaction
  • Two-phase execution — pure evaluation first, then commit + side effects
  • Enterprise logging — syslog integration for existing infrastructure

What Swiftward is NOT

Swiftward is purpose-built for policy enforcement. It is not:

  • A general BPM/workflow orchestrator — no long-running workflows, human tasks, or complex state machines
  • A real-time streaming processor — not a replacement for Flink/Spark; processes events individually
  • A data pipeline — does not transform or route data between systems
  • An ML platform — can call external ML/LLM services but does not train or host models

If you need general workflow orchestration, consider Temporal, Airflow, or similar. Swiftward focuses on fast, deterministic, auditable policy decisions.

Further reading: