Skip to content

feat(examples): add 05-scale-showcase (live agent-mesh galaxy)#125

Open
davidfarah2003 wants to merge 2 commits into
mainfrom
feat/scale-showcase
Open

feat(examples): add 05-scale-showcase (live agent-mesh galaxy)#125
davidfarah2003 wants to merge 2 commits into
mainfrom
feat/scale-showcase

Conversation

@davidfarah2003

Copy link
Copy Markdown
Contributor

What

A standalone, private example (examples/05-scale-showcase/) that spins up thousands of real Cotal endpoints over a bare NATS broker (live-only, no persistence) and renders them as a live GPU "galaxy".

pnpm -F @cotal-ai/example-05-scale-showcase demo -- --n 5000   # then open http://127.0.0.1:7900/

Pieces

  • src/swarm.ts — N real CotalEndpoints sharded across cluster workers. Each agent DMs a stable peer set and posts to its team channel, with sparse cross-team bridges + a few random long-range arcs (a small-world mesh). Gentle connect ramp + retry to survive large connect bursts.
  • src/observe.ts — a scale-safe read-only observer that taps the space and folds traffic into a graph model, emitting a bounded ~15 Hz aggregated SSE feed (bytes scale with graph size, not message rate). Surfaces per-mode rates (DM/channel/anycast), avg delivery latency, and broker cpu/mem/conns via NATS /varz.
  • web/ — a cosmos.gl GPU galaxy (CDN-loaded, no bundler): role-coloured nodes, channel hubs, warm cross-team bridges, traffic heat-pulses, hover + click-to-isolate, live HUD. h hides chrome for a clean capture.
  • src/showcase.ts — one-command orchestrator (broker + observer + swarm).

Self-contained

  • Depends only on @cotal-ai/core — no protocol/core changes, no new message kinds/subjects/endpoint methods.
  • Only non-example change is a 10-line pnpm-lock.yaml workspace entry.
  • Renderer is CDN-loaded; no build tooling added.
  • Runtime dep: nats-server on PATH (the showcase spawns it).

Notes

  • Measured smooth sweet spot ≈ 5,000 endpoints at 120 fps (browser ≈ 0.6 GB, broker ≈ 1.2 GB).
  • Larger runs (e.g. --n 20000) work, but cramming all clients + broker on one machine over loopback hits OS limits — chiefly local ephemeral-port exhaustion (EADDRNOTAVAIL); widen with sudo sysctl -w net.inet.ip.portrange.first=16384. These are single-box artifacts, not protocol limits (a real deployment spreads agents across hosts).

A standalone, private example that spins up thousands of real Cotal
endpoints over a bare NATS broker (live-only, no persistence) and renders
them as a GPU galaxy.

- swarm.ts: N real CotalEndpoints sharded across cluster workers; each
  agent DMs a stable peer set and posts to its team channel, with sparse
  cross-team bridges plus a few random long-range arcs (a small-world
  mesh). Gentle connect ramp + retry to survive large connect bursts.
- observe.ts: a scale-safe read-only observer that taps the space and
  folds traffic into a graph model, emitting a bounded ~15Hz aggregated
  SSE feed (bytes scale with graph size, not message rate). Reports
  per-mode rates, avg delivery latency, and broker cpu/mem/conns via /varz.
- web/: a cosmos.gl GPU galaxy (CDN-loaded) — role-coloured nodes,
  channel hubs, warm cross-team bridges, traffic heat pulses, hover and
  click-to-isolate, and a live HUD.
- showcase.ts: one-command orchestrator (broker + observer + swarm).

Depends only on @cotal-ai/core; no protocol or core changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant