Table of Contents
Fetching ...

From Inference Routing to Agent Orchestration: Declarative Policy Compilation with Cross-Layer Verification

Huamin Chen, Xunzhuo Liu, Bowei He, Xue Liu

Abstract

The Semantic Router DSL is a non-Turing-complete policy language deployed in production for per-request LLM inference routing: content signals (embedding similarity, PII detection, jailbreak scoring) feed into weighted projections and priority-ordered decision trees that select a model, enforce privacy policies, and produce structured audit traces -- all from a single declarative source file. Prior work established conflict-free compilation for probabilistic predicates and positioned the DSL within the Workload-Router-Pool inference architecture. This paper extends the same language from stateless, per-request routing to multi-step agent workflows -- the full path from inference gateway to agent orchestration to infrastructure deployment. The DSL compiler emits verified decision nodes for orchestration frameworks (LangGraph, OpenClaw), Kubernetes artifacts (NetworkPolicy, Sandbox CRD, ConfigMap), YANG/NETCONF payloads, and protocol-boundary gates (MCP, A2A) -- all from the same source. Because the language is non-Turing-complete, the compiler guarantees exhaustive routing, conflict-free branching, referential integrity, and audit traces structurally coupled to the decision logic. Because signal definitions are shared across targets, a threshold change propagates from inference gateway to agent gate to infrastructure artifact in one compilation step -- eliminating cross-team coordination as the primary source of policy drift. We ground the approach in four pillars -- auditability, cost efficiency, verifiability, and tunability -- and identify the verification boundary at each layer.

From Inference Routing to Agent Orchestration: Declarative Policy Compilation with Cross-Layer Verification

Abstract

The Semantic Router DSL is a non-Turing-complete policy language deployed in production for per-request LLM inference routing: content signals (embedding similarity, PII detection, jailbreak scoring) feed into weighted projections and priority-ordered decision trees that select a model, enforce privacy policies, and produce structured audit traces -- all from a single declarative source file. Prior work established conflict-free compilation for probabilistic predicates and positioned the DSL within the Workload-Router-Pool inference architecture. This paper extends the same language from stateless, per-request routing to multi-step agent workflows -- the full path from inference gateway to agent orchestration to infrastructure deployment. The DSL compiler emits verified decision nodes for orchestration frameworks (LangGraph, OpenClaw), Kubernetes artifacts (NetworkPolicy, Sandbox CRD, ConfigMap), YANG/NETCONF payloads, and protocol-boundary gates (MCP, A2A) -- all from the same source. Because the language is non-Turing-complete, the compiler guarantees exhaustive routing, conflict-free branching, referential integrity, and audit traces structurally coupled to the decision logic. Because signal definitions are shared across targets, a threshold change propagates from inference gateway to agent gate to infrastructure artifact in one compilation step -- eliminating cross-team coordination as the primary source of policy drift. We ground the approach in four pillars -- auditability, cost efficiency, verifiability, and tunability -- and identify the verification boundary at each layer.

Paper Structure

This paper contains 85 sections, 5 figures, 3 tables.

Figures (5)

  • Figure 1: End-to-end compilation targets from a single DSL source. Inference routing is the established deployment; this paper extends the same language to agent orchestration, protocol boundaries, and infrastructure artifacts. Signal definitions, thresholds, and verification guarantees are shared across all targets; a change in one DSL parameter propagates to every layer on recompilation.
  • Figure 2: Multi-target compilation. A single DSL source emits artifacts for four target classes. Cross-target consistency (same thresholds, same source hash) is enforced by the compiler.
  • Figure 3: The tuning loop. Each iteration changes one DSL parameter, recompiles (with full re-verification), deploys, and observes. Causal tracing chen2026tdn localizes the parameter responsible for misrouting.
  • Figure 4: Three DSL-compiled gates add a policy layer between agent orchestration, inference, and tool calling. All three are compiled from the same DSL source, ensuring consistent policy across the workflow.
  • Figure 5: Policy drift without vs. with the DSL. Left: three teams maintain gateway config, LangGraph gate, and MCP middleware independently; a threshold update reaches two artifacts but not the third. Right: one .sr source compiles to all three; consistency is a compiler invariant.