Skip to main content

Why this logging format works for agents

Most agent debugging fails because the model gets a huge raw log dump and loses the thread. Raysurfer logging is designed for the opposite pattern:
  1. Start with a compact summary for one exact line hash
  2. Expand only when needed by curling related hashes
  3. Keep context small while preserving deterministic drill-down paths

1) Instrument the exact line

Use a stable hash for each instrumentation point so the agent can request that exact log stream later.

Hash generation policy (and collisions)

LLMs should not invent random hashes on each run. Use a deterministic hash derived from source location, for example:
This gives stable addressing for the same line across runs. SHA-1 outputs 40 hex characters (160 bits), and SHA-256 outputs 64 hex characters (256 bits), so truncating to 16+ hex characters keeps IDs compact while materially lowering collision risk. Collision behavior should be strict:
  • Same hash + same source location: append to the same log stream
  • Same hash + different source location: hard error
The hard error should include:
  • the conflicting hash
  • the original file:line
  • the new file:line
  • a fix hint (regenerate hash from source location)
This prevents two unrelated log points from being merged into one log area.

2) Fetch the summary with API key auth

By default, .md returns a summary page, not a full raw run dump.

3) Expand only when needed

When the summary indicates an issue, the agent can curl deeper links:
  • Raw logs for the same hash
  • Related hashes for nearby lines/functions
  • Additional diagnostics for trend or slowness analysis
This avoids broad timestamp-to-timestamp log searches unless absolutely required.

Example summary shape

What user_satisfaction means

user_satisfaction is an outcome signal, not a model guess. It is derived from:
  • thumbs_up / thumbs_down feedback
  • whether the issue was resolved after the run
  • whether similar issues repeated shortly after

Practical agent loop

This gives agents deterministic debugging paths with low context overhead.