Skip to main content

Module llm_trace

Module llm_trace 

Source
Expand description

LLM / embedding HTTP call tracing.

Every chat (distill) and embedding request flows through llm::post_json_retry, which calls record once per call with the final outcome. Traces are appended as JSONL to ~/.innate/logs/llm_trace.log (size-capped with single-file rotation) so any process — MCP, CLI, evolve — contributes automatically, failures included.

Design notes:

  • Never logs the API key. Only the request body is captured; the Authorization header is not passed in and is never recorded.
  • Request/response bodies are truncated to keep the log bounded.
  • Disable entirely with INNATE_LLM_TRACE=0.

Functions§

read_recent
Read the most recent trace entries (newest first) for the web viewer. Optional exact-match filters on kind (“chat”/“embedding”) and status. Read-only.
record
Record one LLM/embedding call outcome. Best-effort: tracing failures never affect the caller (the LLM call result is returned regardless).