Skip to content

Commit 05d4240

Browse files
acailicclaude
andcommitted
docs: split architecture into abstract overview + detailed layer diagram
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2e20d94 commit 05d4240

1 file changed

Lines changed: 74 additions & 57 deletions

File tree

README.md

Lines changed: 74 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -224,82 +224,99 @@ cd frontend && npm install && npm run build
224224

225225
## Architecture
226226

227+
### System Overview
228+
227229
```mermaid
228230
flowchart TB
229-
%% ── Styles ──────────────────────────────────────────────────────────
231+
classDef layer fill:#0f172a,stroke:#334155,color:#e2e8f0,stroke-width:2px
232+
classDef ext fill:none,stroke:#94a3b8,stroke-dasharray:6 3,color:#94a3b8
233+
234+
AGENT("🤖 Your Agent Code"):::ext
235+
236+
subgraph RUNTIME[" "]
237+
direction TB
238+
SDK["<b>🔌 SDK Layer</b><br/><small>Instrument & capture</small><br/><sub>@trace · TraceContext · Auto-Patch · Adapters</sub>"]:::layer
239+
INTEL["<b>🧠 Intelligence</b><br/><small>Detect, remember, alert</small><br/><sub>Event Buffer · Pattern Detector · Failure Memory · Replay Engine</sub>"]:::layer
240+
end
241+
242+
subgraph SERVER[" "]
243+
direction TB
244+
API["<b>🌐 API Server</b><br/><small>FastAPI + SSE</small><br/><sub>11 routers: sessions · traces · replay · search · analytics · compare</sub>"]:::layer
245+
STORE["<b>💾 Storage</b><br/><small>SQLite WAL · async</small><br/><sub>Events · Checkpoints · Analytics · Embeddings</sub>"]:::layer
246+
end
247+
248+
UI["<b>🖥️ Frontend</b><br/><small>React · TypeScript · Vite</small><br/><sub>8 panels: decision tree · timeline · tools · replay · search · analytics · compare · live</sub>"]:::layer
249+
250+
AGENT ==>|"decorate"| SDK
251+
SDK ==>|"emit"| INTEL
252+
INTEL -->|"persist"| STORE
253+
SDK -.->|"ingest"| API
254+
API <-->|"query"| STORE
255+
API ==>|"SSE stream"| UI
256+
INTEL -.->|"replay"| API
257+
```
258+
259+
### Layer Detail
260+
261+
```mermaid
262+
flowchart LR
230263
classDef sdk fill:#4f46e5,stroke:#3730a3,color:#fff,stroke-width:2px
264+
classDef intel fill:#dc2626,stroke:#b91c1c,color:#fff,stroke-width:2px
231265
classDef api fill:#059669,stroke:#047857,color:#fff,stroke-width:2px
232266
classDef store fill:#b45309,stroke:#92400e,color:#fff,stroke-width:2px
233267
classDef ui fill:#7c3aed,stroke:#6d28d9,color:#fff,stroke-width:2px
234-
classDef intel fill:#dc2626,stroke:#b91c1c,color:#fff,stroke-width:2px
235-
classDef ext fill:none,stroke:#64748b,stroke-dasharray:5 5,color:#64748b
236268
237-
AGENT["🤖 Your Agent"]:::ext
238-
239-
%% ── Instrumentation Layer ────────────────────────────────────────────
240-
subgraph SDK[" 🔌 SDK — Instrumentation Layer "]
241-
direction LR
242-
DEC["@trace<br/>decorator"]:::sdk
243-
CTX["TraceContext<br/>session mgmt"]:::sdk
244-
AP["Auto-Patch<br/>zero-config"]:::sdk
245-
AD["Adapters<br/>LangChain · Pydantic-AI<br/>CrewAI · AutoGen · LlamaIndex"]:::sdk
269+
subgraph SDK[" 🔌 SDK "]
270+
direction TB
271+
DEC["@trace decorator"]:::sdk
272+
CTX["TraceContext"]:::sdk
273+
AP["Auto-Patch"]:::sdk
274+
AD["Framework Adapters"]:::sdk
246275
end
247276
248-
%% ── Collector & Intelligence ─────────────────────────────────────────
249-
subgraph INTEL[" 🧠 Collector & Intelligence "]
250-
direction LR
251-
BUF["Event Buffer<br/>Redis / In-Mem"]:::intel
252-
PAT["Pattern Detector<br/>loop · drift · anomaly"]:::intel
253-
FMEM["Failure Memory<br/>embedding search"]:::intel
254-
ALERT["Alert Engine<br/>guardrail · policy"]:::intel
255-
RPLAY["Replay Engine<br/>checkpoints · deltas"]:::intel
277+
subgraph INT[" 🧠 Intelligence "]
278+
direction TB
279+
BUF["Event Buffer"]:::intel
280+
PAT["Pattern Detector"]:::intel
281+
FMEM["Failure Memory"]:::intel
282+
ALERT["Alert Engine"]:::intel
283+
RPLAY["Replay Engine"]:::intel
256284
end
257285
258-
%% ── API Layer ────────────────────────────────────────────────────────
259-
subgraph API[" 🌐 API — FastAPI + SSE "]
260-
direction LR
261-
R1["Session<br/>CRUD"]:::api
262-
R2["Trace<br/>query · filter"]:::api
263-
R3["Replay<br/>step · seek"]:::api
264-
R4["Search<br/>keyword · NL"]:::api
265-
R5["Analytics<br/>cost · patterns"]:::api
266-
R6["Compare<br/>side-by-side"]:::api
267-
SSE["SSE Stream<br/>live events"]:::api
286+
subgraph APIL[" 🌐 API "]
287+
direction TB
288+
R1["Sessions · Traces"]:::api
289+
R2["Replay · Search"]:::api
290+
R3["Analytics · Compare"]:::api
291+
SSE["SSE Stream"]:::api
268292
end
269293
270-
%% ── Storage Layer ────────────────────────────────────────────────────
271-
subgraph STORE[" 💾 Storage — SQLite + Async "]
272-
direction LR
273-
DB[("🗄️ SQLite<br/>WAL mode")]:::store
274-
S1["Sessions<br/>events · checkpoints"]:::store
275-
S2["Analytics DB<br/>aggregations"]:::store
276-
S3["Embeddings<br/>vector search"]:::store
294+
subgraph STO[" 💾 Storage "]
295+
direction TB
296+
DB[("SQLite WAL")]:::store
297+
S1["Events · Checkpoints"]:::store
298+
S2["Analytics Aggregations"]:::store
277299
end
278300
279-
%% ── Frontend Layer ──────────────────────────────────────────────────
280-
subgraph UI[" 🖥️ Frontend — React + TypeScript + Vite "]
281-
direction LR
282-
U1["Decision<br/>Tree"]:::ui
283-
U2["Trace<br/>Timeline"]:::ui
284-
U3["Tool<br/>Inspector"]:::ui
285-
U4["Session<br/>Replay"]:::ui
286-
U5["Search<br/>cross-session"]:::ui
287-
U6["Analytics<br/>Dashboard"]:::ui
288-
U7["Session<br/>Comparison"]:::ui
301+
subgraph UIF[" 🖥️ Frontend "]
302+
direction TB
303+
DT["Decision Tree"]:::ui
304+
TL["Trace Timeline"]:::ui
305+
TI["Tool Inspector"]:::ui
306+
RP["Session Replay"]:::ui
307+
SE["Cross-session Search"]:::ui
308+
AN["Analytics Dashboard"]:::ui
289309
end
290310
291-
%% ── Data Flow ───────────────────────────────────────────────────────
292-
AGENT ==>|"instrument"| SDK
293-
SDK -->|"emit events"| BUF
311+
DEC & CTX --> BUF
312+
AP & AD --> BUF
294313
BUF --> PAT & FMEM & ALERT
295-
BUF -->|"persist"| S1
314+
BUF --> S1
296315
S1 --> DB
297-
DB --> S2 & S3
298-
299-
SDK -.->|"ingest"| R1
300-
R1 & R2 & R3 & R4 & R5 & R6 <-->|"async queries"| S1
301-
SSE -->|"stream"| UI
302-
RPLAY -->|"checkpoint restore"| R3
316+
DB --> S2
317+
R1 & R2 & R3 <--> S1
318+
RPLAY --> R2
319+
SSE --> DT & TL & RP
303320
```
304321

305322
See [ARCHITECTURE.md](./ARCHITECTURE.md) for full module breakdown.

0 commit comments

Comments
 (0)