Expand description
§agent-decision-log
WHY-layer decision log for AI agents. Records the reasoning behind each branch in an agent run: what options were considered, which one was chosen, why, and what happened afterward.
Sibling of agentsnap (CALLS) and agenttrace (COST + LATENCY).
Together they cover the three audit dimensions of an agent run.
§Quick example
use agent_decision_log::DecisionLog;
use serde_json::json;
let mut log = DecisionLog::new();
let id = log.add(
vec!["search_web", "ask_user"],
"search_web",
"Query is specific enough to search without clarification.",
json!({"turn": 3}),
);
log.set_outcome(&id, "Found 5 relevant docs.");
let d = log.find_by_id(&id).unwrap();
assert_eq!(d.chosen, "search_web");
assert_eq!(d.outcome.as_deref(), Some("Found 5 relevant docs."));§Round-trip to JSONL
use agent_decision_log::DecisionLog;
use serde_json::json;
let dir = tempfile::tempdir()?;
let path = dir.path().join("decisions.jsonl");
let mut log = DecisionLog::new();
log.add(
vec!["a", "b"],
"a",
"a is cheaper",
json!({}),
);
log.to_jsonl(&path)?;
let loaded = DecisionLog::from_jsonl(&path)?;
assert_eq!(loaded.len(), 1);Structs§
- Decision
- A single decision point in an agent run.
- Decision
Log - Append-only log of agent decisions.