Repository navigation
Description
Goal
Merge all of SynapseKit's metrics/observability into one event stream and put a crazy, end-to-end live dashboard on top of it — while keeping the project lightweight (zero new mandatory dependencies, zero overhead when disabled). Non-technical users should be able to watch what SynapseKit is doing in real time.
Problem: observability is fragmented (and this makes the merge a net simplification)
There are two parallel tracers plus several independent recorders:
observe/(spans.py,runtime.py,exporters/)observability/(tracer.py,metrics.pyPrometheus,otel.py,cost_tracker.py,budget_guard.py,audit_log.py,distributed.py,ui.py)
~10 files each with their own record_* / start_span / end_span. Consolidating them removes code, not adds it.
Architecture — one bus, publishers + subscribers
LLM · retrieval · tools · graph · agents · swarm
│ (each record_*/start_span → )
▼
┌───────────────┐ publish(event) ← zero-dep, bounded ring buffer,
│ EventBus │ no-op when nothing subscribes
└───────────────┘
│ subscribe
▼ ▼ ▼ ▼ ▼
Dashboard Prometheus OTEL Cost/Budget Audit log
(stdlib (opt (opt (in-proc) (signed #738)
SSE) extra) extra)
Lightweight contract (non-negotiable)
- 0 new mandatory runtime deps for the default dashboard — transport is Python stdlib
http.server+ Server-Sent Events (SSE), not FastAPI/uvicorn/websockets. - Frontend is one self-contained static
.htmlshipped in the wheel (inline CSS/JS, emoji/inline-SVG, ~15KB) — no framework, no CDN, works offline. - Instrumentation is a no-op when disabled:
SYNAPSEKIT_LIVEunset ⇒ empty subscriber list ⇒publish()early-returns. Zero prod overhead. - Bounded ring buffer + off-thread flush + drop-on-backpressure — no memory growth, never blocks an agent.
- The existing FastAPI dashboard becomes an optional
synapsekit[dashboard]"pro" tier (multi-user/auth), fed by the same bus — never in core. Prometheus ([observe]) / OTEL ([otel]) stay optional subscribers.
The dashboard (all client-side from the single stream)
Live span timeline → animated run flow-graph → cost ticker + token meter (cost_tracker) → budget gauge (budget_guard) → retrieval quality (rag_evaluator) → swarm view (#734 metrics) → signed audit trail (audit_log). Two modes: Story (plain-English, for non-technical users) and Trace (spans/prompts/tokens, for devs).
Bonus: same bus can drive a zero-dep terminal (ANSI) view for headless/SSH.
Phases
- P1 —
EventBus: unified event schema + in-process pub/sub; both existing tracers publish to it (additive, non-breaking); Prometheus/OTEL/cost/audit become subscribers. - P2 — Zero-dep live dashboard: stdlib SSE server + single static HTML;
SYNAPSEKIT_LIVE=1/synapsekit ui --live; auto-open browser (opt-in / TTY-detected). - P3 — Story mode + run history/replay (scrubber; export a run as a self-contained HTML file).
- P4 — Demote FastAPI dashboard to
synapsekit[dashboard]extra; terminal (ANSI) view for headless.
Acceptance criteria
- Default
synapsekit ui --liveworks with no extra installed (stdlib only); core-import guard stays green. - Disabled path adds no measurable overhead (benchmark: publish() with 0 subscribers).
- One dashboard shows LLM + retrieval + tools + graph + cost + budget + audit for a single run, end to end, live.
- Prometheus/OTEL exporters still work, now as bus subscribers (no duplicate instrumentation).
- Docs: "watch your agents run" guide + the lightweight/dependency budget documented.
Security
- Bind
127.0.0.1only; token-gate the SSE endpoint (prompts/data are exposed); opt-in by default.
Related
- Consolidates
observe/+observability/; builds on tracer/spans,metrics.py,cost_tracker.py,budget_guard.py,audit_log.py - Pairs with guardrails middleware (Guardrails & policy middleware — validated, safe, compliant I/O by default #892), swarm (v2.0: Agent Swarms with Emergent Specialization — market-based role negotiation #734), signed audit (v2.0: Verifiable Agents — cryptographically signed audit trails of every LLM call and tool invocation #738/v2.0.1: GroundedSignal — provenance-tagged reward/quality signal shared across AgentSwarm, CostQualityRouter, SelfImprovingAgent #822), Ambient daemon (v2.1: Ambient Agent — system daemon that proactively offers help based on observed activity #743)
Activity
feat(live): zero-dependency real-time run dashboard (EventBus + SSE) (#…
AmitoVrito commentedon Aug 1, 2026
Two follow-ups (policy + scope)
1. Keep-updated policy. Every new feature/modification must keep this dashboard current — new instrumentation publishes to the
EventBus(observe spans already stream; otherwisesynapsekit.live.publish(...)), and new event kinds get an icon + Story summary + any metric surfaced in the meters. Otherwise the glass box goes blind on new capabilities.2. Grafana / other observability — yes, via the same bus. The plan is one
EventBusthat everything subscribes to, so the local dashboard shows the same data that feeds Prometheus/Grafana — no Grafana required to see it locally:observability/cost_tracker.py,metrics.pyobserve/synapsekit_cost_usd_total, swarm, agent-evolution)observability/metrics.pyobservability/otel.pyobservability/budget_guard.pyobservability/audit_log.py(#738/#822)Grafana itself stays the hosted/team view (dashboards over Prometheus) — SynapseKit Live is the local, zero-dep equivalent so you don't need a Grafana stack just to watch a run. Optional later: a panel that deep-links to a running Grafana. The existing Grafana dashboard JSON (
assets/grafana/…) keeps working via the Prometheus exporter, which becomes a bus subscriber rather than separate instrumentation.feat(live): instrument loaders + embeddings; full-framework demo (#900)
AmitoVrito commentedon Aug 2, 2026
Delivered — SynapseKit Live shipped across ~15 PRs (#897, #899–#910). Summary:
Core (P1/P2): zero-dependency
EventBus+ stdlibhttp.server+SSE + single self-containeddashboard.html. Enable viaSYNAPSEKIT_LIVE=1,synapsekit ui --live, orsynapsekit.live.enable(). Bound to 127.0.0.1, token-gated, no-op when disabled, 0 new dependencies.Auto-instrumentation: LLM (all providers), retrieval/RAG, agents, graph, embeddings, tools + MCP, memory/DB, knowledge graphs, mesh, loaders (#898) — the whole framework streams automatically; async-concurrency-safe.
Dashboard: subsystem activity strip · Activity/Logs/Errors tabs · click-to-expand (prompt/response/traceback) · cost/token meters · latency sparkline · budget gauge · signed audit · swarm · flame graph (nested spans) · knowledge-graph canvas (real entities) · human-in-the-loop approvals · run history · export run · fit-to-screen layout.
Examples + demo:
examples/live_showcase.py,live_all_features.py,live_rag_claude.py,live_hitl.py; screencast in the README (hosted on GitHub Pages).Optional follow-ups (minor, not blockers): demote the legacy FastAPI dashboard to a
synapsekit[dashboard]extra, and fold Prometheus/OTEL fully in as bus subscribers (they already export separately). Closing as done.feat(live): stream self-evolving agent cycles to the Live dashboard (#…