Skip to content

Unified observability EventBus + zero-dependency live dashboard #896

Closed

Description

@AmitoVrito

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.py Prometheus, 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 .html shipped in the wheel (inline CSS/JS, emoji/inline-SVG, ~15KB) — no framework, no CDN, works offline.
  • Instrumentation is a no-op when disabled: SYNAPSEKIT_LIVE unset ⇒ 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 --live works 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.1 only; token-gate the SSE endpoint (prompts/data are exposed); opt-in by default.

Related

Activity

  1. added this to the v2.0.1 milestone on Aug 1, 2026
  2. self-assigned this
    on Aug 1, 2026
  3. added
    enhancement
    epic
    on Aug 1, 2026
  4. AmitoVrito commented on Aug 1, 2026

    @AmitoVrito
    CollaboratorAuthor

    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; otherwise synapsekit.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 EventBus that everything subscribes to, so the local dashboard shows the same data that feeds Prometheus/Grafana — no Grafana required to see it locally:

    Signal Source (already in repo) In dashboard
    Cost / tokens / latency observability/cost_tracker.py, metrics.py ✅ P1/P2 (live meters)
    Spans (LLM/retrieval/tool/graph) observe/ ✅ P1/P2 (feed + flow)
    Prometheus gauges (synapsekit_cost_usd_total, swarm, agent-evolution) observability/metrics.py ⏳ becomes a bus subscriber (P3)
    OTEL traces observability/otel.py ⏳ bus subscriber (P3)
    Budget gauge observability/budget_guard.py ⏳ meter (P3)
    Signed audit trail observability/audit_log.py (#738/#822) ⏳ audit panel (P3)

    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.

  5. AmitoVrito commented on Aug 2, 2026

    @AmitoVrito
    CollaboratorAuthor

    Delivered — SynapseKit Live shipped across ~15 PRs (#897, #899–#910). Summary:

    Core (P1/P2): zero-dependency EventBus + stdlib http.server+SSE + single self-contained dashboard.html. Enable via SYNAPSEKIT_LIVE=1, synapsekit ui --live, or synapsekit.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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementepic

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions