LangWatch governance architecture
What problem this is solving
Enterprises run AI through many surfaces simultaneously: developer CLIs (Claude Code, Codex, Cursor, Gemini CLI), packaged SaaS that embed AI (Cowork, Copilot Studio, Workato Genies, ChatGPT Enterprise), and bespoke agents written in-house. Each comes with its own auth plane, its own admin console, its own audit trail. There’s no single view of what every AI in the org is doing right now, no consistent budget enforcement across them, and no single point of control for the security team when an agent misbehaves. LangWatch is the control plane that sits above all of this. It provides governance, monitoring, evals, and (for the surfaces we proxy) policy enforcement across every AI tool and platform the enterprise uses, regardless of who built each one.The five integration tiers
Different platforms allow different levels of governance. We model this as a ladder, deepest control on top:The control plane, end to end
Data flow per tier
Tier A: Gateway proxy
Tier C: Audit log ingestion
Data model
Postgres (Prisma)
ClickHouse
Every table keeps the
TenantId = projectId invariant.
OrganizationId is a query dimension for cross-project rollup,
not a tenancy boundary swap.
OCSF + AOS event schema
We adopt Open Cybersecurity Schema Framework (OCSF) as the internal event shape, extended with OWASP Agent Observability Standard (AOS) fields for AI-specific context. Why:- Datadog Cloud SIEM, Splunk, Microsoft Sentinel, Elastic Security, Google Chronicle, Sumo Logic all natively understand OCSF, so alert routing inherits these integrations.
- AOS extends OCSF’s API Activity class (6003) with prompt / tool / cost / agent-session fields specifically for AI activity.
- Adopting an open standard keeps us interoperable with whatever tooling the customer already has (we’re never the system of record).
IngestionSource adapter normalises platform-specific shapes
into OCSF + AOS fields before they hit trace_summaries. The
adapters are the only platform-specific code; everything downstream
(dashboard, alerts, anomaly detection, admin-API revokes) speaks
OCSF.
Stop/observe matrix per platform
The Activity Monitor lists these actions per anomaly in its “actions
available” UI, and this matrix sets the order in which we ship the
adapters.
Feature-flag gating
One app feature flag,release_ui_ai_governance_enabled, gates every
governance UI surface, so in-progress features stay hidden from
current customers. The CLI surface is always available once
installed; per-account governance entitlement is enforced
server-side.
The AI Gateway product itself ships as-is to customers on the
existing release_ui_ai_gateway_menu_enabled flag. The governance
flag stays separate because the two are different product lines with
different rollout cadences.
Backend endpoints stay reachable regardless of flag state. Hiding the
user-visible surface is enough: the data model, tRPC routes, REST
endpoints, and ingestion receivers all exist on every deployment, and
no visible UI links to them when the flag is off.
See specs/ai-gateway/governance/feature-flag-gating.feature for the
gating contract.
Roadmap to full vision
What’s on this branch today:- ✅ Personal Workspace (Team+Project,
isPersonalflag) - ✅ RoutingPolicy admin UI + provider-cred org validation
- ✅ Personal VirtualKeys + admin catalog
- ✅ Unified
langwatchCLI (10 governance subcommands, device-flow auth) - ✅
/me+/me/settings+/gateway/routing-policies - ✅ AI Gateway with personal-key support
- ✅
user.personalBudgettRPC +BudgetExceededBanner - ✅ Helm NOTES + post-install docs
- ✅ Single feature flag (
release_ui_ai_governance_enabled) gating the UI surface; CLI surface is unconditionally installed and per-account entitlement is enforced server-side (no CLI-side env var gate) - ✅ This architecture doc + activity-monitor + ingestion-sources specs
- 🚧
IngestionSourcetable +trace_summaries.SourceType/SourceIdcolumns - 🚧 Generic OTel passthrough receiver (
/api/ingest/otel/<sourceId>) - 🚧 Generic webhook receiver (
/api/ingest/webhook/<sourceId>) - 🚧 OCSF normalisation contract + skeleton adapter
- Cowork OTel adapter (depends on Anthropic Admin Console UX)
- Workato webhook adapter
- Copilot Studio / OpenAI / Claude Compliance pullers
- S3 audit with custom parser DSL
- Anomaly detection (rule-based v0)
- Alert routing destinations (Slack / SIEM / PagerDuty / generic webhook)
- Admin oversight dashboard (cross-source spend rollup UI)
- Provider/tool catalog admin
- Tier E sandboxed runtime (OMA in LangWatch)
- Activity Monitor admin-API revoke actions per platform
specs/ai-gateway/governance/. The foundation in this iter unblocks
all of them.
Where each piece lives in the repo
Where to read more
- langwatch/langwatch: the repository that holds the gateway product strategy doc driving this architecture.
feature-flag-gating.feature: the single-flag / single-env-var contract.activity-monitor.feature: admin-side oversight UI contract.ingestion-sources.feature: admin-side IngestionSource setup forms and lifecycle.personal-keys-deployment.feature: self-host deployment contract for the personal-keys flow.- Admin setup: admin’s day-1 walkthrough.
- Personal keys: end-user dev story.
- Routing policies: RoutingPolicy concepts.