$ lexprog.com

// notes from an old coder -- php, databases, and the occasional rant

[November 03, 2026] AI

Log Every Tool Call With Arguments

Persist tool name, arguments, latency, and a redacted result. When the agent loops, the log is the only ground truth.

────────────────────────────────────────────────────────

Log Every Tool Call With Arguments

Tip: Agents without traces are undebuggable

Persist tool name, arguments, latency, and a redacted result. When the agent loops, the log is the only ground truth.

log.info('tool', extra={'name': name, 'args': redact(args), 'ms': elapsed})

Gotcha: Logging raw results stores secrets

Tool output may contain tokens or PII. Redact known keys before the log leaves the process.

log.info(result)  # may contain Authorization headers

Source: https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/overview

────────────────────────────────────────────────────────
<-- back to posts