agentglow 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # agentglow
2
2
 
3
3
  **Live 3D views of agent systems, as a React component.** Every agent your system spawns appears as a
4
- living shape (a neuron, a bee, a star, a tree, a flight…): it's born when its span starts, thinks while it
5
- calls the LLM, waits on MCP servers, passes messages to other agents, and fades out when its span ends.
6
- It is driven only by OpenTelemetry, via the [`agentglow`](https://github.com/Nideesh1/agentglow#quickstart)
7
- Python server, so it works with LangGraph, deepagents, LangChain and anything else that emits OTel spans.
4
+ living shape (a neuron, a star, an electron, a particle track, a firework shell): it's born when its span starts,
5
+ thinks while it calls the LLM, waits on MCP servers, passes messages to other agents, and fades out when its span
6
+ ends. Backend services (FastAPI, FastStream, FastMCP, Node) show up as long-lived nodes with request halos. It is
7
+ driven only by OpenTelemetry, via the [`agentglow`](https://github.com/Nideesh1/agentglow#get-started) Python
8
+ server, so it works with LangGraph, deepagents, LangChain and anything else that emits OTel spans.
8
9
 
9
10
  ![neural theme](https://raw.githubusercontent.com/Nideesh1/agentglow/main/docs/media/hero.webp)
10
11
 
@@ -15,14 +16,16 @@ npx agentglow setup # once
15
16
  claude # then just use Claude Code as usual
16
17
  ```
17
18
  `setup` adds AgentGlow hooks + traces to `~/.claude/settings.json` (backup first) plus a hook that auto-starts the
18
- AgentGlow server with every `claude` session, then opens the 3D view. Only Node 18+ is needed (uv + Python are fetched
19
+ AgentGlow server with every `claude` session (on macOS / Linux also a login item), then opens the 3D view. Only Node 18+ is needed (uv + Python are fetched
19
20
  on first run). Your agents and subagents appear live at http://localhost:8100/neural as Claude works.
20
21
 
21
22
  | Command | What it does |
22
23
  |---|---|
23
- | `npx agentglow setup [--port 8100]` | install once (backup first), start the server, open `/neural` |
24
+ | `npx agentglow setup [--port 8100]` | install once (backup first), start the server, open `/neural`; on macOS / Linux the server also starts at login |
25
+ | `npx agentglow setup --capture-prompts` | also show your own prompts next to Claude's replies (local server only, off by default) |
26
+ | `npx agentglow setup --no-autostart` | no login item: the server starts with each `claude` session instead |
24
27
  | `npx agentglow status` / `open` / `stop` | check install + server / open the view / stop the background server |
25
- | `npx agentglow remove` | uninstall everything `setup` added and stop the server |
28
+ | `npx agentglow remove` | uninstall everything `setup` added (hooks, env, login item) and stop the server |
26
29
  | `npx agentglow start [--background]` | run the server yourself (`serve` is an alias) |
27
30
  | `npx agentglow claude [-- <claude args>]` | try it without installing: one session with temporary settings |
28
31
 
@@ -51,7 +54,7 @@ import agentglow
51
54
  agentglow.watch() # before your agents run
52
55
  ```
53
56
 
54
- See the [Python quickstart](https://github.com/Nideesh1/agentglow#quickstart) for details.
57
+ See [Get started](https://github.com/Nideesh1/agentglow#get-started) for details.
55
58
 
56
59
  ## Use
57
60
 
@@ -90,6 +93,78 @@ export default function Live() {
90
93
  }
91
94
  ```
92
95
 
96
+ ## Node.js services
97
+
98
+ `agentglow/node` (server-only, no React / three.js) puts a Node service (Next.js backend-for-frontend, Express,
99
+ Fastify, plain `http`) into the scene, like Python's `agentglow.watch(app=...)`. The OpenTelemetry packages are
100
+ optional peer dependencies, installed only by the apps that use this entry:
101
+
102
+ ```bash
103
+ npm i agentglow @opentelemetry/api @opentelemetry/sdk-trace-node @opentelemetry/resources @opentelemetry/exporter-trace-otlp-http @opentelemetry/instrumentation @opentelemetry/instrumentation-http @opentelemetry/instrumentation-undici
104
+ ```
105
+
106
+ ```ts
107
+ import { watch } from "agentglow/node";
108
+
109
+ watch({ service: "web-bff", url: "http://localhost:8100" }); // before the server starts listening
110
+ ```
111
+
112
+ - Incoming HTTP requests = the service's requests (req/s halo, 5xx flashes), named `METHOD route`.
113
+ - Outgoing `fetch` / `http` calls = resource nodes, and carry a W3C `traceparent`: a Python API watched with
114
+ `agentglow.watch(app=...)` continues the same trace.
115
+ - Spans go to `<url>/v1/traces` (OTLP/HTTP JSON); `ingestKey` (or env `AGENTGLOW_API_KEY`) is sent as `x-api-key`.
116
+
117
+ | Option | Default | |
118
+ |---|---|---|
119
+ | `service` | env `OTEL_SERVICE_NAME`, else `node-app` | the service (agent) name |
120
+ | `url` | env `AGENTGLOW_URL`, else `http://localhost:8100` | AgentGlow server |
121
+ | `ingestKey` | env `AGENTGLOW_API_KEY` | server `--ingest-key` |
122
+ | `privacy` | `"strict"` | `"strict"`: attribute allowlist. `"standard"`: other attributes kept, the drops and backstop below still apply |
123
+ | `scrub` | | `(attrs, { name, kind }) => attrs`: your own rule, after the built-in ones |
124
+ | `incoming` | `true` (`false` under Next.js) | trace incoming HTTP requests |
125
+ | `ignorePaths` | `[]` | incoming paths not traced (`"/healthz"`, regexes) |
126
+
127
+ `watch()` returns `{ flush(), shutdown() }` (call `flush()` before a short script exits) and is idempotent.
128
+
129
+ **Privacy (strict).** Only method, route, status, peer host:port, messaging / db / rpc system names, `next.route` and
130
+ `agentglow.*` attributes leave the process. Never bodies, headers (cookies, authorization), query strings, URL
131
+ userinfo, client IPs, user agents, span events or error messages. Paths without a route template are id-normalized
132
+ (`/orders/123` -> `/orders/:id`; numbers, UUIDs, hex, long tokens, emails). A regex backstop replaces emails, phone
133
+ numbers, long ids and secrets in every remaining string.
134
+
135
+ **Next.js** (`instrumentation.ts` at the project root, or in `src/`):
136
+
137
+ ```ts
138
+ export async function register() {
139
+ if (process.env.NEXT_RUNTIME === "nodejs") {
140
+ (await import("agentglow/node")).watch({ service: "web-bff" });
141
+ }
142
+ }
143
+ ```
144
+
145
+ Next.js makes its own request spans (`GET /api/orders/[id]`), so `watch()` does not add a second one; `fetch` calls in
146
+ route handlers, server actions and server components carry the `traceparent` into your API. The edge runtime is not
147
+ traced. Already using OpenTelemetry (`@vercel/otel`, `NodeSDK`)? Add `spanProcessor()` from `agentglow/node` to its
148
+ `spanProcessors` instead of calling `watch()`.
149
+
150
+ **Express / Fastify:**
151
+
152
+ ```js
153
+ import { watch } from "agentglow/node";
154
+ import express from "express";
155
+
156
+ watch({ service: "web-bff", ignorePaths: ["/healthz"] });
157
+ const app = express();
158
+ app.use("/api", async (req, res) => {
159
+ const r = await fetch(`http://localhost:8191${req.url}`); // traceparent added for you
160
+ res.status(r.status).type("json").send(await r.text());
161
+ });
162
+ app.listen(8190);
163
+ ```
164
+
165
+ Example: [examples/node-proxy](../examples/node-proxy) (a Node proxy in front of the FastAPI orders example).
166
+ `agentglow/pulse` stays for hand-sent events without OpenTelemetry.
167
+
93
168
  ## Props
94
169
 
95
170
  | Prop | Type | Default | What it does |
@@ -97,7 +172,7 @@ export default function Live() {
97
172
  | `theme` | `Theme` | `"neural"` | Which view to render (see below). Each theme loads lazily as its own chunk. |
98
173
  | `source` | `string` | `""` | Base URL of the agentglow server. `""` means same origin. The scene reads `${source}/live/stream` (SSE), `/live/graph` and `/live/health`. |
99
174
  | `hud` | `boolean` | `true` | Show the glass HUD: counts, event ticker and the agent inspector panel. |
100
- | `sim` | `boolean` | `false` | Use the built-in simulator instead of a server. |
175
+ | `sim` | `boolean \| "hf"` | `false` | Use the built-in simulator instead of a server; `"hf"` = high-frequency simulator (30 market agents, ~100 decisions/s). |
101
176
  | `scope` | `string` | none | Only show agents in this scope (a user or tenant id). Sent as the `X-AgentGlow-Scope` header, also as `scope` in the `POST /live/run` body. With a token, the token decides. |
102
177
  | `run` | `string` | none | Only show this one run. Sent as the `X-AgentGlow-Run` header. |
103
178
  | `token` | `string` | none | Token minted by your backend. Sent as `Authorization: Bearer <token>` on every `/live/*` request, never in a URL. |
@@ -144,11 +219,14 @@ backoff on its own. Changing `scope`, `run` or `token` reconnects and clears the
144
219
  | `flow` | A murmuration. Agents condense as eddies out of the current. |
145
220
  | `constellation` | A night sky. Delegation draws constellation lines between agent stars. |
146
221
  | `atom` | An atom. Agents are electrons; subagents orbit their parent. |
222
+ | `bubblechamber` | A bubble chamber. Agents curl as particle tracks; a spawn decays into a V. |
223
+ | `fireworks` | A night show in an open starry sky. Agents streak in like shooting stars and burst as star shells, subagents as secondary bursts. |
147
224
 
148
225
  | | | |
149
226
  |:-:|:-:|:-:|
150
227
  | ![neural](https://raw.githubusercontent.com/Nideesh1/agentglow/main/docs/media/neural.jpg) **neural** | ![constellation](https://raw.githubusercontent.com/Nideesh1/agentglow/main/docs/media/constellation.jpg) **constellation** | ![orbit](https://raw.githubusercontent.com/Nideesh1/agentglow/main/docs/media/orbit.jpg) **orbit** |
151
- | ![atom](https://raw.githubusercontent.com/Nideesh1/agentglow/main/docs/media/atom.jpg) **atom** | ![flow](https://raw.githubusercontent.com/Nideesh1/agentglow/main/docs/media/flow.jpg) **flow** | |
228
+ | ![atom](https://raw.githubusercontent.com/Nideesh1/agentglow/main/docs/media/atom.jpg) **atom** | ![flow](https://raw.githubusercontent.com/Nideesh1/agentglow/main/docs/media/flow.jpg) **flow** | ![bubblechamber](https://raw.githubusercontent.com/Nideesh1/agentglow/main/docs/media/bubblechamber.jpg) **bubblechamber** |
229
+ | ![fireworks](https://raw.githubusercontent.com/Nideesh1/agentglow/main/docs/media/fireworks.jpg) **fireworks** | | |
152
230
 
153
231
  ## Layout
154
232
 
@@ -177,7 +255,7 @@ npm run build:lib # → dist/ (this package)
177
255
  npm run build:app # → ../backend/agentglow/static (served by `agentglow serve`)
178
256
  ```
179
257
 
180
- In the app, `/` is the theme gallery and `/<theme>` is a full-screen scene. It accepts `?sim=1`,
258
+ In the app, `/` is the theme gallery and `/<theme>` is a full-screen scene. It accepts `?sim=1`, `?sim=hf`,
181
259
  `?source=http://host:8100`, `?hud=0` and `?run=<id>` (a shareable "watch this run" link). Scope and token are
182
260
  props only: they are never read from the URL.
183
261
 
package/cli/agentglow.mjs CHANGED
@@ -24,20 +24,21 @@ const VERSION = (() => {
24
24
 
25
25
  const HELP = `agentglow ${VERSION}: watch Claude Code agents in 3D
26
26
 
27
- npx agentglow setup [--port 8100] (recommended) set up once: hooks in ~/.claude/settings.json,
28
- server auto-starts with every \`claude\` session
29
- npx agentglow status server health, port, pid, whether hooks are installed
27
+ npx agentglow setup [--port 8100] (recommended) set up once: hooks + traces env in ~/.claude/settings.json,
28
+ server starts at login (macOS/Linux) and with every \`claude\` session
29
+ npx agentglow status server health + version, port, pid, whether hooks are installed
30
30
  npx agentglow open open the 3D view (http://localhost:8100/neural)
31
31
  npx agentglow stop stop the background server
32
- npx agentglow remove undo setup: remove the hooks and stop the server
32
+ npx agentglow remove undo setup: remove the hooks, env and login item, stop the server
33
33
  npx agentglow claude [-- <args>] try it without installing: one claude session with AgentGlow
34
34
  npx agentglow setup --capture-prompts
35
35
  also show your prompts next to Claude's replies in the agent panel
36
36
  (off by default; local server only, secrets redacted)
37
37
 
38
-
38
+ Setup flags: --no-autostart (no login item: the server starts with each claude session), --no-open
39
39
  More: npx agentglow start [--background] [--port N] (serve = start in the foreground)
40
- Env: AGENTGLOW_URL (remote server), AGENTGLOW_API_KEY (ingest key), AGENTGLOW_CACHE_DIR
40
+ npx agentglow autostart [--remove] (re)register or drop only the login item
41
+ Env: AGENTGLOW_URL (remote server), AGENTGLOW_API_KEY (ingest key), AGENTGLOW_PORT, AGENTGLOW_CACHE_DIR
41
42
  `;
42
43
 
43
44
  const DEFAULT_PORT = 8100;