openclaw/src/agents/pi-embedded-runner/run
Andrii 7e498ab94a anthropic-payload-log mvp
Added a dedicated Anthropic payload logger that writes exact request
JSON (as sent) plus per‑run usage stats (input/output/cache read/write)
to a
  standalone JSONL file, gated by an env flag.

  Changes

  - New logger: src/agents/anthropic-payload-log.ts (writes
logs/anthropic-payload.jsonl under the state dir, optional override via
env).
  - Hooked into embedded runs to wrap the stream function and record
usage: src/agents/pi-embedded-runner/run/attempt.ts.

  How to enable

  - CLAWDBOT_ANTHROPIC_PAYLOAD_LOG=1
  - Optional:
CLAWDBOT_ANTHROPIC_PAYLOAD_LOG_FILE=/path/to/anthropic-payload.jsonl

  What you’ll get (JSONL)

  - stage: "request" with payload (exact Anthropic params) +
payloadDigest
  - stage: "usage" with usage
(input/output/cacheRead/cacheWrite/totalTokens/etc.)

  Notes

  - Usage is taken from the last assistant message in the run; if the
run fails before usage is present, you’ll only see an error field.

  Files touched

  - src/agents/anthropic-payload-log.ts
  - src/agents/pi-embedded-runner/run/attempt.ts

  Tests not run.
2026-01-24 06:43:51 +00:00
..
attempt.test.ts fix: drop obsolete pi-mono workarounds 2026-01-21 19:58:19 +00:00
attempt.ts anthropic-payload-log mvp 2026-01-24 06:43:51 +00:00
images.test.ts fix: stabilize tests and logging 2026-01-18 18:43:31 +00:00
images.ts fix: sanitize oversized image payloads 2026-01-18 15:21:38 +00:00
params.ts fix: enforce group tool policy inheritance for subagents (#1557) (thanks @adam91holt) 2026-01-24 05:49:39 +00:00
payloads.test.ts fix: improve tool summaries 2026-01-23 01:00:24 +00:00
payloads.ts fix: surface concrete ai error details 2026-01-22 22:24:25 +00:00
types.ts fix: enforce group tool policy inheritance for subagents (#1557) (thanks @adam91holt) 2026-01-24 05:49:39 +00:00