Agent Wranglers

Logs, privacy and feedback Required

Log every model call

Write one structured log line per model call. It holds the feature, request ID, prompt ID and version, model version, tokens, cost, latency, ending and outcome.

How to do it

Write the line in the model gateway, so no call is missed. Use the same request ID as the rest of the request, as in tie every line to its request. Leave the prompt and answer text out of this line. They go to a separate store with its own limits, as the next rule shows. Return a call ID to the feature, so feedback can point at the exact call.

Example

{"time":"2026-10-20T09:15:04.120Z","level":"info","event":"ai.call","request_id":"7f3c2a9e","call_id":"c_81f2","feature":"return-assistant","prompt_id":"return-assistant","prompt_version":7,"model":"example-model-2026-05-14","input_tokens":1840,"cached_input_tokens":1536,"output_tokens":212,"cost_usd":0.0013,"latency_ms":1420,"ending":"complete","outcome":"shown"}
log.info({ event: 'ai.call', requestId, callId, feature, promptId: prompt.id, promptVersion: prompt.version, model: response.model,
  inputTokens: usage.inputTokens, cachedInputTokens: usage.cachedInputTokens, outputTokens: usage.outputTokens,
  costUsd: callCostUsd(response.model, usage), latencyMs, ending, outcome });
log.info("ai.call", request_id=request_id, call_id=call_id, feature=feature, prompt_id=prompt.id, prompt_version=prompt.version,
         model=response.model, input_tokens=usage.input_tokens, cached_input_tokens=usage.cached_input_tokens,
         output_tokens=usage.output_tokens, cost_usd=call_cost_usd(response.model, usage),
         latency_ms=latency_ms, ending=ending, outcome=outcome)

How to check

Parse one hour of gateway logs with a JSON tool. Every ai.call line has all the listed fields, and none contains a field holding prompt or answer text.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers ai features playbook: https://agentwranglers.se/playbook/ai-features/logs-privacy-and-feedback/log-model-calls.