Returns the small set of health numbers behind an agent_run: call counts,
token totals, tool and blocked-event counts, summed call durations, and the
study's manifest_hash. Token and outcome figures are read through
LLMR::llm_usage() over the run's call-level rows, so they match the rest of
the LLMR ecosystem.
Usage
# S3 method for class 'agent_run'
diagnostics(x, ...)
# S3 method for class 'Agent'
diagnostics(x, ...)Arguments
- x
An
agent_runor an Agent. Convert other results withas_agent_run()first.- ...
Unused.
Value
A one-row tibble with the following columns.
run_id,kindRun identifier and kind.
n_calls,n_ok,n_failed,ok_rateStored call counts and success rate.
n_truncated,n_filteredCounts of recorded finish reasons.
tokens_sent,tokens_received,tokens_total,reasoning_tokensSums of reported counts.
n_tool_callsRows in the tool view.
n_blockedEvents with status
"blocked"or"stopped".duration_sSum of available call durations in seconds.
manifest_hashStudy manifest hash, or
NAwhen unavailable.n_unknown_tokensCalls whose sent, received, or total count is missing, as defined by
LLMR::llm_usage().
Details
Token sums omit missing values, and n_unknown_tokens counts the calls,
failed ones included, whose sent, received, or total count is missing (a
total counts as known when both parts are), so a sum of zero with a
positive n_unknown_tokens does not mean that nothing was used. Skipped
rows and batch follow-on rows are not counted. When a level of the
run cannot be read, the figures that depend on it are NA and a warning
names the level and the reason; the other figures are still computed. A run
with no calls has zero counts and sums. duration_s adds the recorded call
durations rather than measuring elapsed time, and is NA when calls exist
but none recorded a duration. An agent's own accounting (agent$usage())
can include tool-loop rounds, compactions, and embedding operations that
have no call row, so the two need not agree.
Examples
a <- agent("Aria", LLMR::llm_config("groq", "openai/gpt-oss-20b"), quiet = TRUE)
diagnostics(a) # no calls yet: zero counts and sums
if (FALSE) { # \dontrun{
a$chat("Hello")
diagnostics(a)
} # }