{"repo":"jaineet17/causal-agent-replay","free":true,"listed":false,"github":"https://github.com/jaineet17/causal-agent-replay","clone":"git clone https://github.com/jaineet17/causal-agent-replay.git","description":"Counterfactual replay and causal attribution over LLM-agent trajectories: find which step actually caused a failure by intervening on it.","language":"Python","stars":13,"topics":["agents","causal-inference","counterfactual","debugging","interpretability","llm","llm-agents","observability"],"license":null,"category":"ai-agents","readme_excerpt":"causal-agent-replay Find which step actually caused your agent to fail — by intervening on it and measuring whether the outcome changes. When an LLM agent does something wrong — issues a refund it shouldn't have, calls the wrong tool, leaks data — observability tools (LangSmith, Langfuse) show you what happened , and eval tools (Promptfoo) score pass/fail . Neither answers the question that actually matters for debugging: Which step caused the bad outcome? causal-agent-replay (CAR) answers it the only principled way: it intervenes on a step and re-runs the agent forward to see if the outcome changes. The step where changing the decision changes the outcome — but changing later steps does not — is the causal locus . Proven by counterfactual, not guessed from a trace. --- The idea in one picture A recorded run is modelled as a structural causal model (Pearl): - s k — the exact state the agent decided from (system prompt, tools, full message history) - a k — the action it took (a tool call or a final answer), drawn from the stochastic policy π - o k — the tool result - y — the outcome, scored by a user-supplied function Y(τ) An intervention is a do(·) on one variable, after which the agent re-decides everything downstream . Because the policy is stochastic, running forward K times gives a distribution over outcomes — never a single path. The causal effect of step k is how much that distribution shifts versus the observed run. Attribution ranks steps by causal effect. The headlin","default_branch":null,"files":null,"tree":[],"storefront":"/r/jaineet17","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/jaineet17/causal-agent-replay/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}