v1.44.1: log per-completion tool census (sent, mcp, core, lazy, names)
This commit is contained in:
+13
-8
@@ -87,7 +87,7 @@ configure. Logging never raises: a failed write is counted in
|
||||
| `LOG_MSG_MAX` | 2000 | message truncation, chars |
|
||||
| `LOG_TEXT_MAX` | 4000 | each trapped text (system/user/assistant) in DB meta, chars |
|
||||
| `LOG_PREVIEW` | 300 | each trapped text in the file sink, chars |
|
||||
| `LOG_META_MAX` | 16384 | `meta_json` truncation, bytes |
|
||||
| `LOG_META_MAX` | 16384 | `meta_json` cap, bytes; oversized metas shrink longest strings first, so the stored JSON stays valid |
|
||||
|
||||
## The rules
|
||||
|
||||
@@ -109,11 +109,13 @@ defaults under explicit arguments.
|
||||
|
||||
R4. LLM completions trap the full accounting tuple: backend,
|
||||
model, `exec_ms`, `tokens_in`, `tokens_out`, `tokens_total`,
|
||||
`cost_usd`, message char counts, and the system, user, and
|
||||
assistant texts (full to `LOG_TEXT_MAX` in the DB, previewed to
|
||||
`LOG_PREVIEW` in the file). Tokens are estimated at 4 chars each
|
||||
unless a backend reports real usage (none do today);
|
||||
`cost_usd` is null until a backend reports cost.
|
||||
`cost_usd`, message char counts, the system, user, and assistant
|
||||
texts (full to `LOG_TEXT_MAX` in the DB, previewed to
|
||||
`LOG_PREVIEW` in the file), and the tool census: how many schemas
|
||||
were actually sent, split into MCP, core, and lazy-native, plus
|
||||
the sorted name list. Tokens are estimated at 4 chars each unless
|
||||
a backend reports real usage (none do today); `cost_usd` is null
|
||||
until a backend reports cost.
|
||||
|
||||
R5. Timed operations always log `exec_ms` as an integer. The
|
||||
measurement wraps the operation, never the logging.
|
||||
@@ -151,7 +153,10 @@ line-delimited and greppable without a parser.
|
||||
R12. New events extend the registry below with a fixed level, a
|
||||
single site, and a fixed meta vocabulary (`exec_ms`, `tokens_in`,
|
||||
`tokens_out`, `tokens_total`, `cost_usd`, `outcome`, `error`,
|
||||
`steps`, `*_chars`, `*_text`). Synonyms are rejected in review.
|
||||
`steps`, `tools_sent`, `tools_mcp`, `tools_core`, `tools_lazy`,
|
||||
`tool_names`, `*_chars`, `*_text`). A schema counts as MCP when
|
||||
its name is not a native `TOOL_SCHEMAS` name. Synonyms are
|
||||
rejected in review.
|
||||
|
||||
## Event registry
|
||||
|
||||
@@ -163,7 +168,7 @@ single site, and a fixed meta vocabulary (`exec_ms`, `tokens_in`,
|
||||
| `agent.turn_end` | INFO | `run_turn` wrapper | `exec_ms`, `steps`, `tools_used`, `outcome`, `reply_chars` |
|
||||
| `agent.verified` | INFO | `ensure_verified` end | `success`, `failures` |
|
||||
| `agent.compact` | INFO | `compact_messages` end | `before_tokens`, `after_tokens`, `kept_turns` |
|
||||
| `llm.completion` | INFO | `try_candidate` success | `backend`, `model`, `exec_ms`, `tokens_in`, `tokens_out`, `tokens_total`, `cost_usd`, `history_msgs`, `system_chars`, `user_chars`, `assistant_chars`, `system_text`, `user_text`, `assistant_text`, `tool_calls`, `retried_without_tools` |
|
||||
| `llm.completion` | INFO | `try_candidate` success | `backend`, `model`, `exec_ms`, `tokens_in`, `tokens_out`, `tokens_total`, `cost_usd`, `history_msgs`, `system_chars`, `user_chars`, `assistant_chars`, `system_text`, `user_text`, `assistant_text`, `tool_calls`, `retried_without_tools`, `tools_sent`, `tools_mcp`, `tools_core`, `tools_lazy`, `tool_names` |
|
||||
| `llm.failed` | WARNING | `try_candidate` failure | `backend`, `model`, `error`, `transient` |
|
||||
| `llm.round_retry` | WARNING | `complete()` before sleep | `round`, `pause_s`, `candidates`, `errors` |
|
||||
| `llm.fatal` | ERROR | `complete()` wrapper on `BackendError` | `error` |
|
||||
|
||||
Reference in New Issue
Block a user