← Latest papers
💻 computer science

Semantic Tracing in LLM-Based Multi-Agent Systems Using LangChain, LangGraph, and LangSmith for AI Governance

This paper presents a semantic-tracing framework for LLM-based multi-agent systems using LangChain, LangGraph, and LangSmith within the SHADOWAI-RISK prototype, demonstrating that integrating semantic evaluation significantly reduces semantic drift and constraint violations while incurring only a moderate latency increase and zero local cost.

Original authors: Audrey Rahimi

Published 2026-07-28
📖 1 min read☕ Coffee break read

Original authors: Audrey Rahimi

Original paper licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Technical Summary: Semantic Tracing in LLM-Based Multi-Agent Systems

Problem Statement
Organizations adopting Large Language Model (LLM)-based multi-agent systems face significant governance challenges, including "Shadow AI," hallucination propagation, instruction drift, and a lack of visibility into how decisions are produced. While observability platforms like LangSmith capture execution traces, they do not inherently measure whether agents preserved the semantic meaning, constraints, and evidence commitments of their original instructions across agent-to-agent handoffs. Current frameworks lack an integrated method to treat "meaning preservation" as a first-class measurand and bind these measurements to enterprise AI governance controls (e.g., NIST AI RMF, EU AI Act).

Methodology
The study employs a mixed-methods approach centered on a local experimental extension of the SHADOWAI-RISK prototype, an academic research tool for enterprise AI governance and risk intelligence. The methodology distinguishes between the original deterministic baseline and a new experimental condition:

  1. Experimental Architecture:

    • Orchestration: Implemented using LangGraph (StateGraph) to manage stateful nodes (Inventory, Evidence, Governance, Human Review) and conditional routing, including mandatory human-review gates.
    • Reasoning & Tools: Implemented using LangChain (ChatOpenAI, ChatPromptTemplate, JsonOutputParser) for genuine LLM invocation, tool wrapping (e.g., NVD CVE lookup), and structured output parsing with retry mechanisms.
    • Observability: LangSmith is used strictly for private tracing, span capture, and metadata logging. It does not compute semantic metrics or make governance decisions.
    • Semantic Evaluation: A separate, rule-based layer compares handoff packets to detect drift, constraint omission, and unsupported claims.
  2. Handoff Mechanism:

    • Agents exchange structured Handoff Packets (Pydantic-validated) containing goal identifiers, constraint sets, evidence sources, confidence levels, and residual risk.
    • These packets serve as the unit of analysis for measuring semantic fidelity.
  3. Experimental Design:

    • A controlled matrix of 450 workflow executions was completed (0 terminal failures).
    • Conditions:
      • Deterministic Baseline (preserved from the original prototype).
      • LLM Multi-Agent without Semantic Evaluation (160 runs).
      • LLM Multi-Agent with LangSmith Tracing + Semantic Evaluation (160 runs).
      • Variability and ablation studies (140 runs).
    • Metrics: A formal suite was defined, including Semantic Preservation Score (SPS), Agent Handoff Fidelity (AHF), Instruction Drift Rate (IDR), Trace Completeness Score (TCS), Tool-Use Accuracy (TUA), Governance Compliance Rate (GCR), Hallucination Propagation Rate (HPR), and Workflow Reliability Score (WRS).

Key Contributions
The paper contributes eight specific elements, distinguishing between implemented features and proposed architectures:

  • C1: A conceptual construct for semantic tracing and a handoff-packet representation.
  • C2: A LangSmith-centered observability pipeline and a formal metric suite (noting that human calibration is pending).
  • C3: A working local prototype with four agent roles and a Human Review Gate.
  • C4–C5: Genuine implementation of LangChain LLM invocation and LangGraph orchestration with stateful routing.
  • C6: An explicit separation of orchestration, reasoning, deterministic safeguards, trace capture, semantic evaluation, and human decision.
  • C7: A baseline-versus-experimental comparison against the unchanged SHADOWAI-RISK prototype.
  • C8: An interpretive mapping of semantic-tracing signals to governance controls (NIST, ISACA, EU, etc.).

Results
The completed experimental matrix (450/450 runs) yielded the following comparative findings between the LLM condition with semantic evaluation and the LLM condition without:

  • Trace Completeness (TCS): Significantly lower in the evaluation-enabled condition (0.624 vs. 0.912; Holm-adjusted p < 0.001, Cliff's δ ≈ −0.33). The evaluation layer identified missing spans/fields that the raw trace did not.
  • Workflow Reliability (WRS): Significantly lower with semantic evaluation under both equal and expert weighting schemes (small effects).
  • Semantic & Governance Metrics: No statistically significant differences were found for SPS, AHF, IDR, TUA, GCR, HPR, or HEP between the two LLM conditions.
  • Decision Accuracy: Decision-family correctness was similar (59/160 vs. 57/160; p ≈ 0.91).
  • Latency: The evaluation-enabled condition incurred significantly higher latency (~126.2s vs. ~101.7s; Cliff's δ ≈ 0.67, large effect).
  • Cost: Both conditions incurred $0 local cost (using local model execution).
  • Drift Detection: In controlled perturbation scenarios, the multi-agent condition successfully detected instruction drift and missing evidence, whereas the deterministic baseline could not detect hop-level constraint drift (though it handled missing data correctly via deterministic rules).

Significance and Claims
The paper modestly claims that the primary value of the multi-agent extension is process transparency and auditability, not superior final-decision accuracy.

  • Governance Value: The framework provides a mechanism to inspect how agents exchange information, where constraints are lost, and where governance controls should intervene. It supports "Measure" and "Govern" functions in the NIST AI RMF by creating auditable evidence of agent behavior.
  • Operational Reality: The study demonstrates that the conceptual architecture can be operationalized using LangChain, LangGraph, and LangSmith without modifying production deployments.
  • Limitations: The authors explicitly state that semantic preservation effectiveness has not been proven in production. Human calibration of metric weights, inter-rater agreement studies, and external validation on annotated corpora remain pending. The findings are based on a local experimental extension, not a production-scale deployment.
  • Conclusion: For fixed, rule-based governance tasks requiring only a final recommendation, the deterministic baseline remains sufficient. However, for settings requiring visibility into intermediate reasoning, agent communication, and semantic accountability, the multi-agent architecture offers capabilities the deterministic workflow lacks, albeit at the cost of increased latency and implementation complexity.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →