log_agent_run
Record completed agent runs to the database for audit and dashboard tracking. Accept task summary, paths, tokens, and session ID to link pipeline results.
Instructions
Log a completed agent run to the database for audit and dashboard tracking.
Records that an agent did a piece of work so it appears in the dashboard's
Agents view and in get_agent_runs. Call it after writing an output file, per
the output contract. When a session_id is supplied it also writes a "result"
event to session_events, closing the loop for /metis pipeline calls.
Args:
agent_slug: Slug of the agent that performed the work (e.g. "librarian").
task_summary: Brief description of what the agent did.
input_path: Path to the input file(s), if any (default empty string).
output_path: Path to the output file(s) produced, if any (default empty).
complexity: The run status stored in the `status` column — typically
"completed", "partial", or "failed" (default "standard").
input_tokens: Input tokens consumed, for cost tracking (default 0).
output_tokens: Output tokens produced, for cost tracking (default 0).
model: Model identifier used, e.g. "claude-sonnet-4-6" (default empty).
session_id: Pipeline session ID from session_bootstrap(); when set, also
records a result event in session_events (default empty string).
Returns:
A confirmation message naming the agent and task that were logged.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_slug | Yes | ||
| task_summary | Yes | ||
| input_path | No | ||
| output_path | No | ||
| complexity | No | standard | |
| input_tokens | No | ||
| output_tokens | No | ||
| model | No | ||
| session_id | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |