The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
docs(agent-observability): document the inference capture proxy
Steven Enamakelf99651acce7d
diff --git a/.github/workflows/ci-lite.yml b/.github/workflows/ci-lite.ymlindex 6c6c4379f4..9ca6e1d323 100644--- a/.github/workflows/ci-lite.yml+++ b/.github/workflows/ci-lite.yml@@ -248,6 +248,9 @@ jobs:- 'scripts/mock-api/**'- 'scripts/*.mjs'- 'scripts/__tests__/**'+ # The inference capture proxy has node --test coverage in+ # scripts/__tests__/ but lives under scripts/debug/.+ - 'scripts/debug/*.mjs'# The release-notes generator has node --test coverage in# scripts/__tests__/ but lives one directory down, so the# 'scripts/*.mjs' glob above never armed this lane for it — itsdiff --git a/AGENTS.md b/AGENTS.mdindex d6e5cc5920..7d92468763 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -131,6 +131,30 @@ Shared mock backend:- E2E adapter: `app/test/e2e/mock-server.ts`- Manual start: `pnpm mock:api`+Debugging what the core actually sends to inference (prompt size, tool+schemas, cache keys, which endpoint answered, time to first byte, cached+tokens): put the capture proxy between the core and its backend instead of+guessing from logs.++- `CAPTURE_ALL=1 pnpm debug capture` (`scripts/debug/capture-first-inference.mjs`)+ listens on `127.0.0.1:18765`, forwards everything to `CAPTURE_UPSTREAM`+ (default `https://api.tinyhumans.ai`; `https://openrouter.ai` for a direct+ BYOK route), dumps every inference request body under+ `target/debug-logs/inference-sequence/`, and prints one line per response:+ `served_by`, `ttfb`, `prompt`, `cached`, `cache_key`, status, error.+- Point a core at it with `api_url = "http://127.0.0.1:18765"` in the user+ `config.toml` or `BACKEND_URL=http://127.0.0.1:18765` on a headless+ `openhuman-core run`; drive turns over JSON-RPC (`channel_web_chat`).+- Read the lines as claims to check: `cache_key` must be identical across the+ turns of one thread, `served_by` should not change mid-thread, and `cached`+ should approach `prompt` from the second call on. Any of those drifting is+ the finding.+- Self-test: `scripts/__tests__/capture-first-inference.test.mjs` (runs in the+ CI scripts lane). The static prompt on its own comes from+ `openhuman-core agent dump-prompt --agent <id> --json --with-tools`+ (`scripts/debug-agent-prompts.sh`); the proxy shows the request the harness+ assembles from it per turn.+## Configuration and security- Copy environment settings from `.env.example` and `app/.env.example`.diff --git a/gitbooks/developing/agent-observability.md b/gitbooks/developing/agent-observability.mdindex 0241460b86..edf33bf8cb 100644--- a/gitbooks/developing/agent-observability.md+++ b/gitbooks/developing/agent-observability.md@@ -72,6 +72,43 @@ saveMockRequestLog("after-connect-click", getRequestLog());`captureFailureArtifacts` is wired into `wdio.conf.ts` and firesautomatically on any failing test, specs should not call it directly.+## Inference on the wire: the capture proxy++Logs tell you a turn was slow; they do not tell you what the harness sent or+which endpoint answered. `scripts/debug/capture-first-inference.mjs`+(`pnpm debug capture`) is a loopback proxy between the core and its inference+backend that records both sides:++```bash+CAPTURE_ALL=1 pnpm debug capture # listens on 127.0.0.1:18765+# then, in another shell, point a core at it:+BACKEND_URL=http://127.0.0.1:18765 ./target/debug/openhuman-core run --port 7799+# or set api_url = "http://127.0.0.1:18765" in the user's config.toml+```++Every inference request body is written, numbered, under+`target/debug-logs/inference-sequence/` (the exact system prompt, tool+schemas and `prompt_cache_key` the harness assembled), and every response+yields one summary line and one JSONL record in+`target/debug-logs/inference-capture.jsonl`:++```+[capture] #000 200 model=z-ai/glm-5.3-flash msgs=2 tools=19 served_by=StreamLake ttfb=7.38s total=8.43s prompt=12344 cached=12288 cache_key=tap-25675927a3f2160d+```++`CAPTURE_UPSTREAM=https://openrouter.ai` captures a direct BYOK OpenRouter+route instead of the hosted backend. Non-2xx response bodies are saved next to+the request dumps so an HTML 503 from an ingress is not lost behind a generic+"model error".++What to look for across the turns of one thread: `cache_key` must stay+identical (it is the harness's stable-prefix fingerprint and OpenRouter's+sticky-routing key), `served_by` should not change, and `cached` should+approach `prompt` from the second call on. Each of those drifting has been a+real bug (openhuman#6434). The proxy binds loopback only and refuses a+plaintext non-loopback upstream unless overridden, because it forwards the+bearer verbatim; `--help` lists every `CAPTURE_*` knob.+## What is intentionally out of scope- Visual baselines / image diffs across every component state.