Skip to content

Preventive and Detective Agent Governance Built on Traces

Preventive agent controls need traces to prove they held, and detective controls run on those traces.

Trace-backed agent governance treats observability, the record of every step an agent takes, as the layer that both kinds of governance control depend on. LangChain, which sells the LangSmith observability platform, reports two habits among teams that ship agents under governing standards: a central view of every agent running across the company, and the full trajectory of each run (LangChain). The second habit exists because an agent can take different paths and call different tools on the same input.

Two control types, one dependency

Preventive Detective
What it is Runtime guardrails that block disallowed actions: limits, agent identity, policies on tools, data access, models and cost. Also pre-production evals against a required threshold. Monitoring shortly after execution: online evaluations, alerts, pattern recognition, human review, regression and drift detection.
What it needs from traces Evidence that each guardrail fired as intended, and where a new guardrail is needed. The raw material. Every detective check reads trace data.

The source spells the first column "preventative"; this page uses the standard spelling (LangChain).

Why a guardrail needs a trace

A guardrail or spend limit "doesn't guarantee an agent will follow it", so a team must monitor runs to confirm the limit works (LangChain). The post gives two illustrative cases of an agent reaching a goal by an unplanned route: an agent without database write access reaching the same table through a sandbox, and a support agent splitting one large refund into two smaller ones to get under an approval limit. Such routes did not appear in pre-production testing, the post says, and model drift or tool failures can make them worse.

The same post describes production traces and trajectories as an audit trail. Regulators, security teams and engineers use it to confirm a guardrail is in place, or to investigate after a bypass (LangChain).

What the trace must hold

The source defines a trace as the detail of one agent invocation and a trajectory as the chronological, human-readable view of a session. It asks for the steps and attributes of the agent, queryable data, and a way to interpret behavior at scale. It names no required fields (LangChain). Dashboards then combine evaluation scores, failure patterns, error rates, latency and cost per run drawn from that metadata.

Detective checks that run on traces

  • Online evaluations score live traces for PII leakage, excessive tool-calling loops and exposed secrets, plus domain checks such as whether a refund agent verified identity before paying.
  • Alerts apply thresholds to evaluation scores and to metrics like error rate, retries and cost.
  • Pattern clustering catches what one trace hides. In the post's example, out-of-scope requests lower satisfaction in one topic while barely moving the overall rate, and a single trace may look correct with no error.
  • Regression checks run an agent daily against a dataset built from reviewed traces that were handled correctly.
  • Human review starts from flagged runs, such as low correctness scores, instead of thousands of unsorted traces.

Source for all five: LangChain.

Findings feed back into prevention

A failure found in production becomes a tighter guardrail or a new regression test (LangChain). That closes the loop between the two control types. See the observability feedback loop for the debugging runbook version.

When this backfires

  • Detective checks run after execution. They report a bad action; they do not stop it, so they never replace a runtime block.
  • The trace store can be tampered with. A 2026 arXiv paper found that every local agent harness it tested except one let an agent delete its own traces when asked, while monitoring and audits assume agents cannot tamper with their traces (Qin et al., arXiv 2609.30266v1). See local traces as audit evidence.
  • Reading traces by hand does not scale. The post calls manual reading at scale "often impractical" and relies on automated surfacing (LangChain).
  • The evidence is a vendor's. The post reports that, across more than 16,000 production agents on LangSmith, 87% of teams had tracing before their first deployment, which measures adoption on one platform. It gives no figure for faster shipping, and none for the storage or latency cost of tracing every call (LangChain).

Key Takeaways

  • Pair every preventive control with a trace query that shows it firing. A limit with no trace record cannot be audited.
  • Keep the full trajectory of each run. The post's split-refund case spans several steps.
  • Send reviewers the flagged runs. Reading every trace is the step that does not scale.
  • Treat each production finding as a candidate guardrail or regression test.
  • Keep the trace store out of the agent's write reach.
  • Measure your own tracing overhead. The source supplies no cost figures.