TriCEGAR: Agentic AI Runtime Verification
- TriCEGAR is an automated, trace-driven mechanism that builds behavioral models from execution traces to verify agentic AI systems.
- It integrates online Markov Decision Process construction with probabilistic model checking and likelihood-based anomaly detection for real-time assurance.
- Its dynamic counterexample-guided refinement eliminates manual state abstraction, supporting scalable and precise verification in complex environments.
TriCEGAR is an automated, trace-driven, counterexample-guided abstraction refinement mechanism for runtime verification (RV) of agentic AI systems operating in stochastic, high-dimensional environments. Developed to address the challenge of scalable, application-agnostic assurance for agents—such as LLM-based tool-using workflows—TriCEGAR eliminates the need for manually engineered state abstractions by constructing behavioral models from execution traces and dynamically refining them using decision trees and formal counterexamples. The system supports online Markov Decision Process (MDP) construction, probabilistic model checking (PMC), and likelihood-based anomaly detection, all integrated within standard agent frameworks (Koohestani et al., 30 Jan 2026).
1. Motivation and Context
Agentic AI systems, typified by LLM-based agents that invoke external tools, manage evolving representations, and adapt prompts or workflows over time, exhibit highly stochastic behavior due to nondeterministic tool outputs, environmental variation, and agent evolution. Traditional offline or deterministic verification is typically inadequate, as transient and probabilistic failures (e.g., alignment slips, stochastic loop exits) often manifest only at runtime. RV approaches provide empirical assurance over live traces, but depend critically on state abstraction: the reduction of complex, high-dimensional execution states into finite monitorable states suitable for model checking.
Earlier runtime verification frameworks, such as AgentGuard/Dynamic Probabilistic Assurance (DPA), required developers to explicitly define these abstractions, tying verification to brittle, application-specific heuristics and impeding adoption. TriCEGAR addresses this by inferring abstractions directly from traces, using a counterexample-guided approach to balance succinctness of the model with monitoring precision.
2. Architecture and Data Structures
TriCEGAR maintains and synchronizes three principal online data structures:
- Typed execution traces: Each agent tool call is intercepted, logging a concrete snapshot
where encodes immutable task context, captures workflow flags, and stores dynamic counters, statistics, and optionally text embeddings.
- Predicate-tree abstraction : A binary decision tree in which internal nodes are predicates over trace variables (e.g., threshold tests, boolean flags), and leaves correspond to finite abstract states . A mapping function is used to assign each concrete state to its abstract state by traversing the predicates from root to leaf.
- Constructed MDP : The abstract states are the leaves of , is the finite set of observed tool actions, and gives empirically observed, unsmoothed transition probabilities. Transition counts are maintained online.
The system executes in iterative cycles: mapping new logged concrete states through , updating the transition count matrix, invoking model checking queries, and—if property violations are detected—triggering counterexample-guided abstraction refinement.
3. Predicate-Tree Learning and Counterexample-Guided Refinement
The predicate-tree abstraction is constructed using an ID3-style, top-down recursive splitting process:
- Initial Tree Construction: For a batch of concrete states/actions , candidate predicates are drawn from a domain-specific grammar, including numeric thresholds, boolean variables, collection-emptiness, and text-embedding hyperplanes. At each node:
- Compute conditional entropy on the empirical next-action distribution.
- For each , calculate the information gain (IG):
- Select the predicate with the highest IG, provided (minimum gain threshold). Otherwise, terminate recursion with a leaf.
- Refinement via Counterexamples: Following model checking, if the property (e.g., upper bound on failure probability) is violated, an abstract counterexample path is extracted. The system attempts to concretize in the trace trie. If is spurious (no match exists), the abstract state at the point of failure is refined: the set of concrete states mapping there are re-split using the IG criterion, and the refinements are propagated through the predicate tree, trace trie, and MDP structure. PMC is rerun after each refinement, continuing until either the property is satisfied or no further gainful splits are possible.
4. MDP Induction and Probabilistic Model Checking
The induced abstract MDP is defined by:
- State space : leaves of the current predicate tree.
- Action set : observed tool types in the trace.
- Transition function: , computed as a sum over outgoing transitions. No smoothing is applied; absent transitions are assigned zero probability.
Reachability queries are performed via external PMC engines (e.g., Storm). Key probability bounds include:
- : maximum probability of reaching success.
- : minimum probability of reaching failure.
These extrema are computed over the full space of nondeterministic strategies via standard Bellman-type value iteration. The probability bounds define risk envelopes for runtime guardrails; for instance, an alarm is raised if exceeds a policy-defined threshold .
5. Likelihood-Based Anomaly Detection
TriCEGAR supports anomaly detection through model-induced run likelihoods. For an abstract run
the log-likelihood is computed as
Offline, a reference distribution (mean , standard deviation ) is computed from historical run log-likelihoods. A run is flagged as anomalous if . Online anomaly detection utilizes length- prefixes and checkpointed conditional means/standard deviations to account for drift with run length, raising alerts when
6. Implementation and Empirical Results
TriCEGAR's implementation features:
- Trace storage: Typed records with primitive fields and optional embeddings are stored in both an append-only log and a prefix trie, with trie nodes maintaining pointers to concrete records and abstract state handles.
- Three-dimensional linkage: Each abstract state links to its predicate tree node, MDP vertex, and set of trie node endpoints, ensuring local consistency during predicate splits and abstraction refinement.
- Performance: Tree-splitting and MDP updates over several thousand transitions complete in under 100 ms, with PMC queries for small MDPs (≤50 states) completing in ≤200 ms. Trace-trie updates are per transition.
- Case study: For a file-I/O agent, 1,000 baseline traces and 1,000 anomalous traces were generated. The initial abstraction (depth-4 tree on iteration count, filesWritten0, lastFileRead path) robustly detected length-based anomalies. Overly general ratio-based anomalies were mitigated by a refinement split on filesWrittenCountthreshold. PMC bounds tracked long-term probabilities of success (testedcommitted) and failure (error or budget overrun), while low-likelihood runs were consistently flagged before commitment.
A summary of TriCEGAR's components and functions is presented below:
| Component | Core Function | Update Frequency |
|---|---|---|
| Typed Trace Log/Trie | Capture agent lifecycle events and support concretization | Per tool invocation |
| Predicate Tree () | State abstraction, counterexample-driven refinement | Periodic/incremental |
| Abstracted MDP () | Enables PMC and anomaly detection | After batch update |
TriCEGAR is implemented natively in agent frameworks (e.g., Java/Kotlin with Koog-style interceptor), with model export in Storm's JSON and asynchronous PMC query execution.
7. Significance and Impact
TriCEGAR advances runtime assurance for agentic AI by decoupling verification from static, application-specific abstractions and enabling online, data-driven model construction directly from execution traces. This supports quantitative risk assessment, rapid turn-around of verification properties, and outlier detection within operational workflows. A plausible implication is that automated state abstraction may substantively lower barriers to deploying formal guardrails for adaptive, tool-using agents, especially in dynamic or evolving task environments (Koohestani et al., 30 Jan 2026).