Audit Trail
Track every agent task with cost estimates, token counts, tool call logs, and duration. Dashboard with daily, weekly, and monthly cost breakdowns, filtering, and CSV/JSON export. Per-project SQLite storage.
README
Audit Trail Plugin for Agent Zero
If you're running Agent Zero for real work, you have no idea what it's actually costing you. You fire off tasks, agents call tools, sub-agents spin up — and at the end of the day you have no record of what happened, how long it took, or what you spent.
This plugin fixes that.
What it does
Every time an agent starts a task, the plugin opens a ticket. When the task finishes, it closes the ticket and records:
- What the input was and what the agent responded
- Every tool call the agent made during the task
- How many tokens were used (prompt + completion)
- Estimated cost in USD based on your model's pricing
- Duration, status (completed / failed / timeout), and which agent profile ran it
- Parent-child relationships when sub-agents are involved
All of this is stored per-project in a local SQLite database (.a0proj/audit.db) and surfaced through a dashboard you can open from the sidebar.
Why you'd want this
You're spending money and don't know how much. LLM API calls cost real money. Without tracking, you can't tell if a task cost $0.002 or $0.20, or whether your agents are burning tokens on unnecessary tool calls. The dashboard shows daily, weekly, and monthly cost breakdowns so you can spot trends before your bill surprises you.
You need to know what your agents actually did. Chat history shows you the conversation, but not the full picture — which tools were called, in what order, with what parameters. The audit trail records every tool call with timestamps, so you can reconstruct exactly what happened during any task.
Tasks fail silently and you don't notice. Agents sometimes time out, hit errors, or produce empty responses. The plugin flags these as FAILED or TIMEOUT so you can review what went wrong instead of assuming everything worked.
You're running multiple agents and projects. The plugin tracks per-project, per-agent-profile. If you have different agents handling different workloads, you can see which agent is doing what and how much each project costs.
You want accountability over time. The export feature (CSV / JSON) lets you pull data into spreadsheets or other tools for reporting, budgeting, or compliance.
Installation
Clone or copy this plugin into your Agent Zero plugins directory:
plugins/ciq_audit_trail/
Restart Agent Zero. The plugin will appear in your settings where you can enable it per project.
Dashboard
Open the dashboard from the sidebar button or the quick-actions dropdown. It shows:
- Summary cards — total tasks, total cost, average duration
- Cost chart — daily, weekly, or monthly breakdown with task counts per period
- Ticket list — filterable by status, agent profile, search text, and tags
- Ticket detail — full input/output, tool call log, token counts, cost, timestamps
Cost tracking
The plugin tries to extract real token counts from the agent's log entries. If the LLM provider returns usage data, it uses that. Otherwise it estimates tokens from text length and applies pricing from the bundled cost models.
Included models (all under $3/1M output, OpenRouter-compatible):
| Model | Input/1M | Output/1M |
|---|---|---|
| minimax-m2.5 (default) | $0.30 | $1.20 |
| deepseek-v3.2 | $0.26 | $0.38 |
| deepseek-r1 | $0.70 | $2.50 |
| gemini-2.5-flash | $0.30 | $2.50 |
| gemini-2.5-flash-lite | $0.10 | $0.40 |
| llama-4-maverick | $0.27 | $0.85 |
| qwen3.5-plus | $0.26 | $1.56 |
Set default_cost_model in the plugin config to match the model your agents actually use.
Settings
| Setting | Default | Description |
|---|---|---|
enabled |
true |
Turn tracking on/off |
summary_max_chars |
500 |
Truncation limit for input/output summaries |
auto_tags |
[] |
Tags automatically applied to every ticket |
cost_log_fetch_count |
100 |
How many recent log entries to scan for token data |
default_cost_model |
minimax-m2.5 |
Fallback pricing model when the agent's model can't be identified |
retention_days |
0 |
Auto-delete tickets older than this (0 = keep forever) |
show_sidebar_panel |
true |
Show the quick-access sidebar button |
stale_timeout_minutes |
10 |
Mark stuck RUNNING tickets as TIMEOUT after this many minutes |
Tests
pytest
License
MIT — Animus Systems SL