Documentation Index
Fetch the complete documentation index at: https://docs.tracectrl.ai/llms.txt
Use this file to discover all available pages before exploring further.
System Overview
TraceCtrl has five layers:- Python SDK (in your agent) — emits OpenTelemetry spans enriched with
tracectrl.*security attributes, plus optional in-process guardrails. - Protector Plus (optional external HTTP firewall) — called from
tracectrl.protector, emits guardrail evaluation spans. - OTel Collector — receives OTLP spans and writes them to ClickHouse.
- Intelligence Engine — FastAPI service that runs the pipeline and serves the REST API.
- Dashboard — React SPA that visualizes agents, traces, alerts, guardrails, and attack paths.
Component Details
Python SDK
The SDK wraps OpenInference framework instrumentors with aTraceCtrlSpanProcessor that enriches every span with security attributes. It uses OpenTelemetry as the transport — no custom protocols, no vendor lock-in.
Key modules:
tracectrl.config—configure()sets up the TracerProvider with OTLP gRPC exporter.tracectrl.processor—TraceCtrlSpanProcessoradds agent identity, tool categories, session IDs, ingress markers.tracectrl.inference— Classifies tools into risk categories.tracectrl.session— Session ID management via Pythoncontextvars.tracectrl.context— W3C traceparent propagation for cross-service agents.tracectrl.guardrails— In-process LLM-judge guardrails. Emitstracectrl.guardrail.registered(on registration) andtracectrl.guardrail.evaluation(per evaluation) spans.tracectrl.protector— TraceCtrl Guards integration with external Protector Plus HTTP firewall. Emits the same guardrail span types, tagged withtracectrl.guardrail.provider = "protector_plus".
Protector Plus (optional)
An external HTTP firewall called fromtracectrl.protector. Exposes seven sub-guardrails (llm, keyword, regex, pii, vector, content_moderation, system_prompt_protection) via /apikey/api/protectorplus/v1/input-check and .../output-check. The SDK calls it fire-and-forget; flagged sub-guardrails are emitted as tracectrl.guardrail.evaluation spans (decision=fail) for the engine to ingest. Config (endpoint URL, API key, enabled guardrails) is persisted in protector_plus_config and configured from the Settings page.
OTel Collector
A standard OpenTelemetry Collector configured to receive OTLP spans on gRPC (:4317) and HTTP (:4318), then export them to ClickHouse via the clickhouseexporter. Configuration lives in config/otel-collector.yaml.
Intelligence Engine
A FastAPI application that:- Runs the pipeline every
PIPELINE_INTERVAL_SECONDS(default 60). Each tick re-reads all spans, refreshes the agent inventory, topology, guardrail registry, guardrail violations, and the attack-graph analysis. Idempotency comes from ClickHouseReplacingMergeTreerather than a watermark. - Serves a REST API under
/api/v1— system, topology, sessions, agents, risk, scan, violations, guardrails. - Owns the ClickHouse schema —
ensure_schema()runs the CREATE/ALTER statements at startup.
Dashboard
A React + Vite + TypeScript SPA. The sidebar groups pages into three sections (Monitor, Security, Configure) and the route table lives inui/src/App.tsx:145-158. See the Dashboard page for the per-page reference.
Data Pipeline (one tick)
Violations
Ingest
tracectrl.guardrail.evaluation spans with decision in ('fail','error') into guardrail_violations.Guardrail registry
Ingest
tracectrl.guardrail.registered spans into guardrail_registry; flip health to error when the last hour shows error-decision violations.ClickHouse Tables
| Table | Engine | Purpose |
|---|---|---|
otel_traces | Auto-created by Collector | Raw OpenTelemetry spans |
agent_inventory | ReplacingMergeTree | Deduplicated agent records |
topology_agent_edges | ReplacingMergeTree | Agent-to-agent connections |
topology_tool_edges | ReplacingMergeTree | Agent-to-tool connections |
pipeline_state | ReplacingMergeTree | Pipeline state (legacy watermark key) |
attack_paths | ReplacingMergeTree | TAGAAI-detected attack paths |
agent_risk_scores | ReplacingMergeTree | Per-agent risk |
system_risk | ReplacingMergeTree | System-wide risk summary |
scan_results / scan_topology / scan_runs | MergeTree / ReplacingMergeTree | Static OpenClaw scan output |
guardrail_violations | ReplacingMergeTree | Guardrail evaluation failures (judge-LLM + Protector Plus) |
guardrail_registry | ReplacingMergeTree | Registered guardrails (per agent) |
protector_plus_config | ReplacingMergeTree | Single-row Protector Plus config |
ReplacingMergeTree deduplicates rows during background merges. Always query with
FINAL for correct results: SELECT * FROM agent_inventory FINAL.
