Skip to content

About

📡 Agentic Programming Lab 4: spec for a live dashboard of Claude Code ↔ API traffic

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

📡 Agent Traffic Monitor: Spec

Agentic Programming · Lab 4: Spec-Build an Agent Traffic Monitor

proxy.py sits between Claude Code and the Anthropic API and dumps every request and response to the terminal. That output is complete but very hard to read. This lab was about writing a spec with a coding agent, before writing any code, for a live browser dashboard that makes the traffic readable.

📄 Read the spec: SPEC.md

What the dashboard should do

  • Show your prompt, the model's reply, a tool call and its result as visually distinct kinds of message
  • Follow the conversation live, newest first, with replies streaming in token by token
  • Lead each request with what's new since the previous one, and collapse the history that repeats every time
  • Tag side calls (titles, summaries, count_tokens), show them muted, and let a toggle hide them
  • Show estimated API cost per model, labeled as an estimate
  • Save to and replay from a JSONL log (--log, --replay)

Key decisions (from the spec)

Decision
Hosting The same proxy.py process serves the dashboard on its own port (8042). Agent traffic stays on 8041.
Frontend One static dashboard.html file, with no build step, no CDN, and works offline
Constraints Standard library only. Pass-through stays byte-for-byte unchanged. Binds to 127.0.0.1 only. Auth headers are redacted before they reach the page or the log.
Concurrency Thread-safe event store, and every event carries a request id (subagents issue requests in parallel)

The spec continues with the event model, the page layout, the visual language, filters, error visibility, performance limits, v1 priorities, scope and acceptance criteria.

Files

File What it is
SPEC.md the spec (the work for this lab)
proxy.py the course's starter: a naive logging reverse proxy (standard library only)

Try the starter proxy

python3 proxy.py                                   # listens on http://localhost:8041
ANTHROPIC_BASE_URL=http://localhost:8041 claude    # in a second terminal

Part of my Agentic Programming labs (HUJI, AICODE 67723): Lab 1 · CTF Arena · Lab 2 · LLM failure modes · Lab 3 · Coin Dash with several agents · Lab 4 · Traffic monitor spec · Lab 5 · Chess: testing new features · Lab 6 · Binary search explainer video

About

📡 Agentic Programming Lab 4: spec for a live dashboard of Claude Code ↔ API traffic

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages