1. Introduction
The companion paper on Action Router Intelligence Theory established the theoretical foundation: routing is an action control problem, not a text classification problem. The formal definition R: (Context × Intent × State) → Action was proven to subsume keyword and semantic routing while enabling compositional gate integration and responsibility preservation. But theory without implementation is architecture without a building.
This paper bridges the gap. We present the complete Action Router implementation as deployed within MARIA OS, covering three questions that the theory paper left open. First, how is the routing triple (Context, Intent, State) constructed from raw system inputs? The Intent Parser layer answers this by defining concrete extraction pipelines for each component. Second, how does the Action Resolver select among potentially thousands of registered actions in real time? We answer with a hierarchical search algorithm that exploits MARIA coordinate structure for O(log|A|) action selection. Third, how does the system improve over time? We formalize recursive self-improvement as an online learning problem and prove convergence guarantees.
1.1 Architecture Overview
The Action Router consists of three layers, each with a clearly defined interface:
| Layer | Name | Input | Output | Latency Budget |
|---|---|---|---|---|
| L1 | Intent Parser | Raw input x + session metadata | (Context C, Intent I) | ≤ 12ms |
| L2 | Action Resolver | (C, I, S) triple | Action a ∈ A_feasible | ≤ 10ms |
| L3 | Gate Controller | Action a + risk assessment | Gated execution envelope | ≤ 5ms |
The total latency budget is 27ms, leaving 3ms of headroom against the 30ms P99 target. Each layer is independently deployable and horizontally scalable. The layers communicate through typed interfaces defined in the MARIA OS SDK, ensuring that changes to one layer do not break others.
1.2 Design Principles
Three principles guide the implementation: (1) No classification, only control — at no point does any layer produce a category label; every output is either structured data or an executable action. (2) Fail-closed by default — if any layer cannot produce a confident output, the request is escalated to human review rather than routed to a default handler. (3) Observable by construction — every layer emits structured telemetry including input/output pairs, confidence scores, and timing data, enabling the recursive learning loop.
2. Layer 1: Intent Parser
2.1 Context Extraction Pipeline
The Intent Parser constructs the Context C from three sources: (a) the user’s MARIA coordinate and authority level, retrieved from the authentication session; (b) the session history, including prior routing decisions and their outcomes within the current interaction; (c) active organizational policies that may constrain available actions (e.g., a freeze on refunds during audit periods). Context extraction is deterministic and rule-based, requiring no ML inference:
Context extraction completes in under 2ms because all inputs are available from in-memory caches (session cache, policy cache, MARIA coordinate registry).
2.2 Intent Extraction Model
Intent extraction transforms raw text x and context C into a structured intent I. Unlike keyword extraction, intent extraction produces a four-field structure:
The goal field g ∈ G is drawn from a finite goal taxonomy specific to the MARIA Universe. Goals are not keywords — they are structured specifications. For example, goal = resolve_multi_issue(issues=[contract_cancellation, refund_processing, compliance_verification]) specifies a compound goal with three sub-components. The constraint set restricts which actions are acceptable (e.g., “refund must not exceed $10,000”). Priority is a continuous score reflecting the user’s stated or inferred priority. Urgency is a discrete field determined by context signals (SLA timers, escalation history, user role).
2.3 Lightweight Intent Classifier
The intent extraction model is deliberately lightweight: a 2-layer transformer encoder with 12M parameters, fine-tuned on organizational data. We avoid large language models for intent extraction because (a) latency: a 7B parameter model requires 40-80ms for inference, consuming the entire latency budget; (b) determinism: large models exhibit non-deterministic outputs that complicate audit logging; (c) organizational specificity: a small model fine-tuned on 50,000 labeled organizational requests outperforms a general-purpose large model on domain-specific intent extraction.
The intent classifier achieves 94.2% accuracy on held-out organizational data with P99 inference latency of 8ms on a single GPU. Combined with the 2ms context extraction, Layer 1 completes within its 12ms budget with margin.
2.4 Ambiguity Detection and Clarification
When the intent classifier’s confidence falls below a threshold τ = 0.7, the Intent Parser triggers a clarification protocol rather than guessing. The clarification protocol generates a structured question based on the top-2 candidate intents:
This fail-closed behavior prevents the cascade of errors that occurs when an uncertain router guesses wrong. In production, the clarification rate is 6.8% of requests, and clarified requests achieve 99.1% routing accuracy.
3. Layer 2: Action Resolver
3.1 Action Registry
The Action Resolver operates on a pre-registered action space A. Each action is registered with its full specification: preconditions, effects, responsibility assignment, gate level, and cost function. The registry is organized hierarchically by MARIA coordinate:
ActionRegistry
G1 (Galaxy: Enterprise)
U1 (Universe: Sales)
P1 (Planet: Customer Success)
Z1 (Zone: Retention)
a_101: initiate_retention_offer
a_102: process_cancellation
a_103: escalate_to_manager
Z2 (Zone: Billing)
a_201: process_refund
a_202: adjust_invoice
U2 (Universe: Legal)
P1 (Planet: Contracts)
Z1 (Zone: Review)
a_301: initiate_contract_review
a_302: flag_compliance_issueThis hierarchical structure enables O(log|A|) action lookup by narrowing the search path: Galaxy → Universe → Planet → Zone → Actions. For a typical enterprise with |A| = 500, the search visits at most 4 levels × 5 nodes per level = 20 nodes, compared to 500 for a flat linear scan.
3.2 Precondition Filtering
Given the routing triple (C, I, S), the Action Resolver first computes the feasible action set by evaluating preconditions:
where A_scope is the subset of actions within the MARIA coordinate scope determined by the user’s authority level. A user with coordinate G1.U1.P1.Z1 can only access actions registered under that zone (and parent scopes, if elevated permissions are granted). Precondition evaluation is parallelized across the feasible candidate set using a thread pool, completing in under 3ms for typical scope sizes of 20-50 actions.
3.3 Effect-Based Action Ranking
Among the feasible actions, the resolver ranks candidates by predicted effect quality — how closely the action’s predicted outcome matches the user’s stated goal:
The distance function d operates on structured state representations, not text embeddings. For example, if the goal is resolve_multi_issue with three sub-issues, d counts the number of sub-issues addressed by the action’s predicted effect, weighted by urgency. This structured distance computation avoids the embedding conflation problem where semantically similar but operationally distinct actions receive similar scores.
3.4 Compound Action Composition
When no single action satisfies a compound intent, the resolver composes multiple actions into an action plan:
Composition uses a greedy set-cover algorithm: at each step, select the action whose effect covers the most unsatisfied goal components. The greedy algorithm achieves a (1 - 1/e) approximation ratio for submodular goal coverage, which is provably optimal in polynomial time. In practice, compound intents require 2-3 actions on average, and the composition completes in under 2ms.
4. Layer 3: Gate Controller
4.1 Risk Assessment
The Gate Controller receives the selected action (or action plan) and computes a risk score that determines the gate level. The risk assessment combines three factors:
ImpactScore measures the magnitude of the action’s effects (financial amount, number of affected entities, scope of state change). ReversibilityScore measures how easily the action can be undone (fully reversible = 0, partially reversible = 0.5, irreversible = 1.0). ConfidenceGap measures the uncertainty in the routing decision (difference between the Action Resolver’s confidence in the top-ranked action versus the second-ranked action). A high ConfidenceGap indicates the router is uncertain, warranting additional oversight.
4.2 Gate Level Assignment
The risk score maps to a gate level through configurable thresholds:
| Risk Score | Gate Level | Execution Mode | Expected Latency |
|---|---|---|---|
| [0, 0.3) | Level 0: Auto-Execute | Immediate execution, async audit log | 0ms (fire-and-forget) |
| [0.3, 0.6) | Level 1: Soft Review | Execute immediately, flag for retrospective review | 0ms + async review |
| [0.6, 0.8) | Level 2: Human Review | Queue for human approval before execution | Minutes to hours |
| [0.8, 1.0] | Level 3: Escalation | Route to senior decision-maker with full context bundle | Hours to days |
The thresholds are configurable per MARIA Universe, allowing different business units to calibrate their risk tolerance. A high-risk trading desk might set the Level 2 threshold at 0.8 (aggressive), while a compliance department might set it at 0.4 (conservative).
4.3 Execution Envelope Construction
The Gate Controller wraps the action in an execution envelope — a structured packet that contains everything needed for execution and audit:
The execution envelope is immutable once constructed. It is persisted to the MARIA OS audit log before the action is dispatched. The TTL (time-to-live) field ensures that gated actions that are not approved within a configurable window are automatically expired and the requester is notified, preventing stale routing decisions from executing in a changed system state.
5. Recursive Self-Improvement
5.1 The Feedback Loop
The Action Router improves continuously through a feedback loop that connects execution outcomes back to routing weights. After every action completes (or fails), the outcome is recorded:
The outcome record captures whether the action succeeded, how well it satisfied the original intent, how long it took, and whether it produced unexpected side effects. This outcome data feeds into two learning mechanisms: weight updates for the Action Resolver and threshold calibration for the Gate Controller.
5.2 Online Weight Updates
The Action Resolver maintains a weight vector w ∈ ℝ^{|A|} that biases action selection. After observing outcome o_t, the weights are updated using the exponentiated gradient algorithm:
where ℓ_t(a) is the loss incurred by action a at time t (combining goal distance, cost, and failure penalty), η is the learning rate, and Z_t is a normalization constant. This multiplicative update has three desirable properties: (a) it never assigns zero weight to any action (exploration is preserved); (b) it converges at rate O(√T) to the best fixed action in hindsight; (c) it is computationally trivial (O(|A|) per update).
5.3 Convergence Analysis
Theorem 1 (Recursive Improvement Convergence). Under the exponentiated gradient update with learning rate η = √(ln|A| / (2T)), the Action Router’s cumulative loss satisfies:
For |A| = 500 and T = 30,000 (approximately 30 days of production routing at 1,000 decisions per day), the average per-decision regret is √(2 · 30000 · ln 500) / 30000 ≈ 0.018. This means the router is within 1.8% of the optimal fixed policy after 30 days — consistent with the observed +4.4% accuracy improvement from 93.4% to 97.8%.
5.4 Gate Threshold Calibration
The Gate Controller’s risk thresholds are also calibrated through recursive learning. We use a Bayesian approach: the prior on each threshold is set by organizational policy, and the posterior is updated based on observed false-positive (action gated unnecessarily) and false-negative (ungated action causes harm) rates:
The asymmetric weights α_FP and α_FN reflect the relative cost of false positives (unnecessary delays) versus false negatives (uncontrolled risk). In practice, α_FN ≫ α_FP by a factor of 5-10, meaning the system is conservative: it tolerates unnecessary gates to avoid missing genuine risks.
6. Scaling Architecture for 100+ Agent Deployments
6.1 The Scaling Challenge
Enterprise MARIA OS deployments can involve 100+ concurrent agents across multiple Universes, each with its own action space. Naive centralized routing creates a bottleneck: all routing decisions funnel through a single resolver that must search the entire action space. At 10,000 requests per second and |A| = 2,000, the centralized approach exceeds the 30ms latency target.
6.2 Coordinate-Based Sharding
We shard the Action Router by MARIA coordinate. Each Universe receives a dedicated routing partition that handles all routing decisions within that organizational scope:
Each partition maintains its own action registry, weight vector, and gate thresholds. Cross-Universe routing (rare, approximately 3% of requests) is handled by a lightweight meta-router that determines the target Universe before delegating to the appropriate partition.
6.3 Hierarchical Action Cache
Within each partition, we maintain a three-level action cache:
- L1 Cache (Zone-local): The 10 most frequently selected actions per Zone, stored in-memory with sub-microsecond access. Cache hit rate: 72%.
- L2 Cache (Planet-local): The 50 most frequently selected actions per Planet, stored in a shared memory region. Cache hit rate: 91% (cumulative with L1).
- L3 Cache (Universe-wide): The full action registry for the Universe, stored in a Redis cluster. Cache hit rate: 100% (by definition).
The cache hierarchy reduces average action lookup from 5ms (full registry search) to 0.8ms (L1 hit) for the common case. Cache invalidation is event-driven: when an action’s preconditions change (e.g., an agent goes offline), the relevant cache entries are invalidated immediately via MARIA OS event bus.
6.4 Throughput Analysis
With 4 Universe partitions, each handling 2,500 rps, and the cache hierarchy reducing per-request latency to 14ms (P50), the system sustains 10,000 rps with P99 latency of 28ms. The bottleneck shifts from action search to intent extraction (Layer 1), which we address by deploying multiple intent classifier replicas behind a load balancer.
7. Integration with the Decision Pipeline State Machine
7.1 The Decision Pipeline
The MARIA OS Decision Pipeline implements a 6-stage state machine:
proposed → validated → [approval_required | approved] → executed → [completed | failed]Every decision in MARIA OS traverses this pipeline. The Action Router must interface with the pipeline because routed actions create decisions: an action a selected by the router enters the pipeline in the “proposed” state and must progress through the appropriate stages before execution.
7.2 Product Automaton
We formalize the integration as a product automaton of the Action Router state and the Decision Pipeline state. Let Q_R = {idle, parsing, resolving, gating, dispatched} be the Action Router states and Q_P = {proposed, validated, approval_required, approved, executed, completed, failed} be the Pipeline states. The product automaton Q = Q_R × Q_P has |Q_R| × |Q_P| = 5 × 7 = 35 states, of which 18 are reachable:
We verify by exhaustive enumeration that all 12 valid pipeline transitions (as defined in the MARIA OS valid_transitions table) are reachable from the routing layer. This means the Action Router can drive any valid decision through the pipeline — there are no dead states.
7.3 Transition Mapping
Each routing outcome maps to a specific pipeline transition:
| Router Outcome | Pipeline Transition | Condition |
|---|---|---|
| Action selected, gate = L0 | proposed → validated → approved → executed | Auto-execute path |
| Action selected, gate = L1 | proposed → validated → approved → executed | Execute + async review |
| Action selected, gate = L2 | proposed → validated → approval_required | Queue for human approval |
| Action selected, gate = L3 | proposed → validated → approval_required | Escalate to senior |
| No feasible action | proposed → failed | Fail-closed |
| Ambiguous intent | (no pipeline entry) | Clarification loop |
7.4 Atomicity and Rollback
The product automaton guarantees that routing and pipeline transitions are atomic: either the entire routing-to-pipeline handoff succeeds, or the system rolls back to the pre-routing state. This is implemented using a two-phase commit protocol: Phase 1 constructs the execution envelope and reserves the pipeline slot; Phase 2 dispatches the action and advances the pipeline state. If Phase 2 fails (e.g., the target agent is unavailable), Phase 1 is rolled back and the routing decision is retried with updated state.
8. Production Metrics and Benchmarks
8.1 Deployment Configuration
The benchmarks are conducted on a simulated production deployment with the following configuration: 4 MARIA Universes (Sales, Legal, Compliance, Operations), 12 Planets, 48 Zones, 127 active agents, 523 registered actions, and an average request rate of 10,000 routing decisions per second during peak hours. The evaluation period is 30 days with a total of 8.6 million routing decisions.
8.2 Accuracy Over Time
| Day | Routing Accuracy | Clarification Rate | Fail-Closed Rate |
|---|---|---|---|
| 1 | 93.4% | 6.8% | 1.2% |
| 7 | 95.1% | 5.4% | 0.9% |
| 14 | 96.3% | 4.7% | 0.7% |
| 21 | 97.2% | 4.1% | 0.5% |
| 30 | 97.8% | 3.6% | 0.4% |
The accuracy improvement follows the theoretical O(√T) convergence rate. The clarification rate decreases as the intent classifier improves through fine-tuning on production data. The fail-closed rate decreases as the action registry expands to cover edge cases identified during operation.
8.3 Latency Profile
| Component | P50 | P90 | P99 | P99.9 |
|---|---|---|---|---|
| Intent Parser (L1) | 7ms | 10ms | 12ms | 18ms |
| Action Resolver (L2) | 4ms | 7ms | 10ms | 15ms |
| Gate Controller (L3) | 2ms | 3ms | 5ms | 8ms |
| Total (end-to-end) | 14ms | 22ms | 28ms | 38ms |
The P99 total of 28ms is within the 30ms target. The P99.9 of 38ms exceeds the target but occurs at a rate of 1 in 1,000 requests, acceptable for enterprise workloads where critical requests receive priority queue treatment.
8.4 Scaling Efficiency
| Metric | 1 Partition | 2 Partitions | 4 Partitions | 8 Partitions |
|---|---|---|---|---|
| Max RPS | 3,200 | 6,100 | 10,400 | 18,700 |
| P99 Latency | 28ms | 27ms | 28ms | 29ms |
| Scaling Efficiency | 1.0x | 0.95x | 0.81x | 0.73x |
Scaling efficiency decreases at 8 partitions due to cross-partition routing overhead (the 3% of requests that cross Universe boundaries). For most enterprise deployments, 4 partitions provide sufficient throughput with near-linear scaling.
8.5 Comparison with Baselines
| Metric | Keyword Router | Semantic Router | Action Router (Day 1) | Action Router (Day 30) |
|---|---|---|---|---|
| Accuracy | 62.1% | 74.3% | 93.4% | 97.8% |
| P99 Latency | 12ms | 89ms | 28ms | 26ms |
| Gate Compliance | 71.3% | 76.8% | 99.5% | 99.7% |
| Audit Completeness | 41.2% | 55.1% | 100% | 100% |
| Responsibility Attribution | 34.8% | 48.3% | 97.1% | 98.4% |
9. Discussion
9.1 Lessons from Implementation
Three implementation lessons stand out. First, the intent classifier’s training data quality matters more than model size. A 12M parameter model trained on 50,000 high-quality organizational examples outperforms a 7B parameter general model on domain-specific intents by 11 percentage points. This is because organizational intents have distributional properties (e.g., compound goals, authority-dependent semantics) that general models have not been trained on.
Second, the action registry is a living artifact that requires continuous curation. Over the 30-day evaluation, 23 new actions were registered, 8 actions were deprecated, and 41 actions had their preconditions updated. The recursive learning loop identifies the need for new actions by detecting clusters of requests that consistently fail to match existing actions with high confidence.
Third, the fail-closed design is essential for building user trust. Early in deployment, the 6.8% clarification rate was perceived as a weakness (“the system doesn’t understand me”). After users observed that clarified requests achieved 99.1% routing accuracy versus 93.4% for auto-routed requests, the clarification prompt became a positive signal (“the system is being careful”). By day 30, user satisfaction scores for clarified requests exceeded those for auto-routed requests by 8 points.
9.2 Limitations
The Action Router has three known limitations. First, the action registry requires upfront investment: each action must be specified with preconditions, effects, and responsibility assignments. For organizations with poorly documented processes, this registration effort can be substantial. We mitigate this with an auto-discovery tool that observes existing workflows and proposes action definitions for human review. Second, the 12M parameter intent classifier may not generalize well to novel request types not represented in the training data. We address this through the clarification protocol and through periodic retraining on accumulated production data. Third, the coordinate-based sharding strategy assumes that cross-Universe routing is rare. In organizations with heavy cross-functional collaboration, the 3% assumption may not hold, requiring a more sophisticated meta-routing layer.
10. Conclusion
This paper presented the complete engineering architecture of the Action Router as implemented in MARIA OS. The three-layer stack — Intent Parser, Action Resolver, Gate Controller — transforms the theoretical framework of Action Router Intelligence Theory into a production-ready system. Each layer has a clearly defined interface, a latency budget, and independent scalability.
The recursive self-improvement mechanism demonstrates that the Action Router is not a static system but a learning one. The +4.4% accuracy improvement over 30 days, achieved through the principled application of online convex optimization with provable regret bounds, suggests that longer deployment periods will yield further gains, asymptotically approaching the optimal routing policy for the organization.
The scaling architecture proves that action-level routing is not inherently more expensive than keyword routing. Through coordinate-based sharding and hierarchical caching, the Action Router sustains 10,000 rps at sub-30ms P99 latency — performance that is 3.2× faster than semantic routing at the P99 and competitive with keyword routing, while delivering dramatically higher accuracy and responsibility compliance.
The integration with the Decision Pipeline state machine, formalized as a product automaton, ensures that every routing decision connects seamlessly to the governance infrastructure. No routed action bypasses the pipeline. No pipeline state is unreachable from the router. The routing layer and the governance layer are not separate systems bolted together; they are a single compositional architecture.
The Action Router is not the last word in intelligent routing. Future work includes multi-step planning (routing to action sequences rather than single actions), adversarial robustness (resistance to prompt injection attacks that attempt to manipulate routing), and federated learning across MARIA Galaxies (sharing routing knowledge across organizational boundaries without sharing private data). But the core insight — that routing must control actions, not classify words — is the foundation on which all future advances will build.
References
1. Sakura / BONGINKAN (2026). Why AI Routing Should Be Action-Based, Not Keyword-Based. note.com. 2. Shalev-Shwartz, S. (2012). Online Learning and Online Convex Optimization. Foundations and Trends in ML, 4(2), 107-194. 3. Arora, S. et al. (2012). The Multiplicative Weights Update Method. Theory of Computing, 8(1), 121-164. 4. Hopcroft, J.E. et al. (2006). Introduction to Automata Theory, Languages, and Computation. 3rd Edition, Pearson. 5. MARIA OS Technical Documentation (2026). Action Router Implementation Guide, v1.0. 6. MARIA OS Technical Documentation (2026). Decision Pipeline State Machine Specification, v2.1.