You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add POST /agentos/api/ingest/events so the Python SDK posts telemetry
instead of writing Mongo directly; the server now owns the projection.
- routes/ingest.ts + ingest-auth.ts: batch ingest with a bearer guard
(open if AGENTOS_INGEST_TOKEN unset; boot warning in that case). Mounted
before the global 1mb parser + requireAuth with a 5mb body limit.
- stores/telemetry-projection.ts: project each event into agent_registry,
agent_logs, sessions, chat_sessions, agent_messages. Writes the canonical
chat_sessions row (fixes library sessions missing from the dashboard list)
and drops the dead slack_threads write. session_started is the sole creator
of the sessions doc (no stub corruption on dropped/reordered events).
Idempotent on event_id. + agent-source.ts (model-strip + library/inline
source builders, ported from the Python sink).
- Extend agent-log-store.ts (optional rollup fields + idempotent _id), widen
SessionDoc/MessageDoc, mount + boot warning in index.ts.
- vitest projection tests incl. out-of-order regression; CLAUDE.md updated to
the HTTP-ingest model.
Also snapshots in-progress AgentOS SPA, observability, and engine work.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+19-13Lines changed: 19 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,20 +89,21 @@ Optional GitHub repo **variables** (build-time baked into the SPA bundle):
89
89
90
90
### 2.3 MongoDB Atlas — AgentOS runtime backend
91
91
92
-
The Mongo cluster is the source of truth for AgentOS. The Python SDK's `AgentRegistrySink` + `MongoMessageSink` and the AgentOS server both connect here.
92
+
The Mongo cluster is the source of truth for AgentOS. **Only the `agentos-server` connects to Mongo.** As of the post-0.2.1 dev build, the Python SDK no longer writes Mongo directly — it POSTs telemetry to the server's ingest endpoint (`AgentOSHttpSink` → `POST /agentos/api/ingest/events`), and the server owns all writes. (The old `AgentRegistrySink` + `MongoMessageSink` and the `motor` dep were removed — see the Python SDK history below.)
93
93
94
-
**Collections (database = `AGENTOS_MONGO_DB`):**
95
-
-`agent_registry` — one doc per registered agent (the SDK writes `source.type="library"` for harness-mode agents → AgentOS UI hides the chat-sandbox button for those, see commit `8d829b8`)
94
+
**Collections (database = the server's `MONGO_DATABASE`):**
95
+
-`agent_registry` — one doc per registered agent (the server writes `source.type="library"` for harness-mode agents → AgentOS UI hides the chat-sandbox button for those, see commit `8d829b8`)
96
96
-`agent_logs` — one doc per conversation (one `ComputerAgent` instance = one log row, multi-turn collapses correctly since the 0.2.0 session-id refactor)
97
-
-`sessions` — ordered chat transcript (one doc per session_id, entries appended in order)
97
+
-`sessions` — ordered chat transcript (one doc per session_id, entries appended in order; **`session_started` is the sole creator** of the doc, so a dropped/reordered start can't stub it)
98
+
-`chat_sessions` — the session-index row (`{_id, agent, createdAt, lastMessageAt}`) the dashboard's session list + per-agent `sessionCount`/`lastActivity` read. The server projection writes this so library-mode sessions show up (the old Python sink omitted it).
-`AGENTOS_MONGO_DB` — usually `computeragent` / `computeragent-prod` / `computeragent-test` per env
102
+
**Credentials required:**
103
+
-On the **SDK** side: `AGENTOS_INGEST_URL` (e.g. `https://<host>/agentos/api/ingest/events`) + optional `AGENTOS_INGEST_TOKEN` (sent as `Authorization: Bearer …`). No Mongo creds.
104
+
-On the **server** side: `MONGO_URL` + `MONGO_DATABASE` (this is the DB the collections above live in).
104
105
105
-
**Behaviour:** when `AGENTOS_MONGO_URL` is set, the default telemetry pipeline auto-attaches **both** the registry sink and the message sink. Pre-0.2.0 only the registry sink auto-attached and `agent_messages` was empty — that bug is fixed.
106
+
**Behaviour:** when `AGENTOS_INGEST_URL` is set, the SDK's default telemetry pipeline auto-attaches `AgentOSHttpSink` (gated on the `[agentos]` extra, which is now `httpx`-based). Each event carries a stable `event_id` so the server's writes are idempotent on retry. ⚠️ When the server's `AGENTOS_INGEST_TOKEN` is unset the ingest route is **open** (anonymous writes) — set it on any network-exposed deployment.
106
107
107
108
---
108
109
@@ -253,7 +254,7 @@ Top-level directories (`pnpm` workspace, `turbo` for the build graph):
253
254
└──────────────────┘
254
255
```
255
256
256
-
The Python SDK (`computer-agent-py`) re-implements the harness layer in Python with the same four orthogonal axes. It writes to the same MongoDB collections via `AgentRegistrySink` + `MongoMessageSink`so library-mode Python agents show up in the AgentOS UI alongside TS harness-server-hosted ones.
257
+
The Python SDK (`computer-agent-py`) re-implements the harness layer in Python with the same four orthogonal axes. It POSTs telemetry to the AgentOS server (`AgentOSHttpSink` → `POST /agentos/api/ingest/events`), which projects it into the same MongoDB collections so library-mode Python agents show up in the AgentOS UI alongside TS harness-server-hosted ones. (Through 0.2.x the SDK wrote Mongo directly via `AgentRegistrySink` + `MongoMessageSink`; that was removed in favour of HTTP ingest so the SDK needs no Mongo creds and the schema lives server-side.)
257
258
258
259
---
259
260
@@ -271,9 +272,13 @@ ANTHROPIC_API_KEY=sk-ant-...
271
272
GITCLAW_MODEL_BASE_URL=https://api.lyzr.ai/v1
272
273
OPENAI_API_KEY=sk-...
273
274
274
-
# AgentOS Mongo (auto-attaches both sinks when set)
|`COOKIE_SECURE`| derived from `NODE_ENV`| Force `true` / `false` explicitly |
357
362
|`AGENTOS_SESSION_SECRET`| random per boot | Cookie-session secret. **Set to a stable value in prod** or sessions are invalidated on restart |
358
363
|`API_AUTH_USER` + `API_AUTH_PASS`| unset | Basic-auth gate on the API. When unset the API is open (relies on network policy) |
364
+
|`AGENTOS_INGEST_TOKEN`| unset | Bearer token guarding `POST /agentos/api/ingest/events` (the Python SDK's telemetry ingest). When unset the route is **open** (anonymous writes to registry/logs/sessions) — set it on any network-exposed pod. The SDK must send the same value as `AGENTOS_INGEST_TOKEN`. |
359
365
|`AGENTOS_RUNTIME`| unset | Default substrate name used by the "Register agent" form (`local` / `bwrap` / `e2b` / `vzvm`) |
360
366
|`AGENTOS_SEED_DEFAULT`| unset | Set to `1` to auto-seed a default agent into the registry on first boot |
361
367
|`AGENTOS_DEFAULT_SOURCE`|`github.com/shreyas-lyzr/general-agent`| Used by the seed agent |
0 commit comments