Deterministic Intent Compiler & Typed DAG Execution Planner for Autonomous AI Agents & MCP Servers.
Eliminates prompt injection, hallucinated tool calls, and redundant token waste by compiling natural language into typed, cryptographically-sealed execution graphs before invoking LLMs.
In 2026, autonomous agent frameworks like LangChain, AutoGen, and CrewAI feed raw, ambiguous user strings directly into multi-step LLM reasoning loops.
This creates four critical failure modes in production:
- Indirect Prompt Injection & Jailbreaks: Hidden zero-width characters or adversarial override payloads (
"ignore previous instructions") hijack agent tool chains. - Hallucinated Tool Parameters: LLMs generate invalid JSON or missing required arguments, resulting in catastrophic runtime exceptions mid-pipeline.
- Loop Runaways & Token Burn: Agents spend hundreds of tokens debating which tool to call sequentially when tasks could be grouped and executed in parallel.
- Lack of Non-Repudiation: There is no cryptographic audit proof verifying whether an executed tool call actually matched the user's intended request.
agent-intent-compiler acts as a Deterministic Pre-Execution Compiler situated between user inputs and agent runtimes.
User Prompts / Agent Frameworks / MCP Clients
│
├──► Python API IntentCompiler.compile(prompt)
└──► CLI / JSON agent-intent-compiler "<prompt>"
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ agent-intent-compiler │
│ │
│ ┌───────────────────┐ ┌───────────────────┐ ┌─────────────────┐ │
│ │ Prompt Sanitizer │ │ Typed Intent & │ │ Kahn's DAG │ │
│ │ • Zero-Width │─►│ Slot Compiler │─►│ Planner │ │
│ │ Strip │ │ • Query/Mutation │ │ • Cycle Guard │ │
│ │ • Entropy Shield │ │ • Research/Eval │ │ • Parallel │ │
│ └───────────────────┘ └───────────────────┘ │ Stages │ │
│ └─────────────────┘ │
│ ┌───────────────────┐ ┌───────────────────┐ ┌─────────────────┐ │
│ │ SHA-256 Merkle │ │ MCP JSON-RPC 2.0 │ │ Live Telemetry │ │
│ │ Execution Seal │ │ Adapter │ │ & Doctor / │ │
│ │ • Non-Repudiation │ │ • tools/call │ │ Bench Matrix │ │
│ └───────────────────┘ └───────────────────┘ └─────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
│ │
▼ ▼
Cryptographic ExecutionPlan MCP Tool Runtime
(Staged Nodes + Merkle Root) (JSON-RPC 2.0 Payloads)
- Zero-Cloud, Sub-Millisecond Execution: Compiles execution DAGs in under 0.3ms on local CPU with zero cloud API dependencies.
- Topological Stage Parallelism: Automatically groups independent tool calls into concurrent batches via Kahn's algorithm, cutting sequential wait stages.
- Zero Tool Injection: Strict parameter validation and static pattern + Shannon entropy checks block adversarial prompts (
IntentType.SECURITY_AUDIT) before any tool is dispatched. - Cryptographic SHA-256 Merkle Root: Every
ExecutionPlancomputes a deterministic 64-char SHA-256 Merkle hash sealing the intended execution trajectory. - Native MCP Compatibility: Directly translates execution stages into standard Model Context Protocol
tools/callJSON-RPC 2.0 payloads.
pip install agent-intent-compilerZero external dependencies (dependencies = []). Works across Python 3.9, 3.10, 3.11, and 3.12.
from agent_intent_compiler import IntentCompiler
compiler = IntentCompiler()
# Compile a multi-step user prompt
prompt = "Migrate the production PostgreSQL database schema and verify data integrity"
plan = compiler.compile(prompt)
print(f"Plan ID: {plan.plan_id}")
print(f"Intent Type: {plan.intent_type}")
print(f"Compilation Latency: {plan.compilation_latency_ms:.2f}ms")
print(f"Execution Stages (Parallel Groups): {plan.execution_order}")
print(f"Cryptographic Merkle Seal: {plan.merkle_root}")from agent_intent_compiler import IntentCompiler, MCPAdapter
compiler = IntentCompiler()
plan = compiler.compile("Search for recent advancements in quantum error correction")
# Generate standard MCP JSON-RPC 2.0 tool requests
mcp_requests = MCPAdapter.to_mcp_requests(plan)
for req in mcp_requests:
print(f"MCP Tool Call -> {req['params']['name']}: {req['params']['arguments']}")agent-intent-compiler "Deep research on LLM inference optimizations on edge hardware"pytest -v
# 14 passed (test_compiler.py, test_dag.py, test_mcp_adapter.py, test_sanitizer.py, test_subpackages.py, test_telemetry.py, test_tools.py)agent-intent-compiler/
├── src/
│ └── agent_intent_compiler/
│ ├── __init__.py # Public package exports
│ ├── cli.py # CLI entrypoint
│ ├── compiler.py # Backwards-compatible shim -> core.compiler
│ ├── dag.py # Backwards-compatible shim -> core.dag
│ ├── mcp_adapter.py # Backwards-compatible shim -> serve.mcp_adapter
│ ├── models.py # Backwards-compatible shim -> core.models
│ ├── sanitizer.py # Backwards-compatible shim -> core.sanitizer
│ ├── core/
│ │ ├── __init__.py # Core compilation subpackage exports
│ │ ├── compiler.py # Deterministic IntentCompiler orchestrator
│ │ ├── dag.py # Kahn's algorithm topological DAG planner
│ │ ├── models.py # Typed ExecutionNode, ExecutionPlan & Merkle seal
│ │ └── sanitizer.py # Zero-width, regex & Shannon entropy shield
│ ├── serve/
│ │ ├── __init__.py # Serving & telemetry subpackage exports
│ │ ├── mcp_adapter.py # MCP JSON-RPC 2.0 tools/call emitter
│ │ └── telemetry.py # P50/P90/P99 latency & intent distribution
│ └── tools/
│ ├── __init__.py # Diagnostics & benchmark subpackage exports
│ ├── bench_matrix.py # Multi-category compilation latency matrix
│ └── doctor.py # Runtime health & injection shield probe
├── docs/
│ └── ARCHITECTURE.md # Detailed compiler & DAG architecture spec
├── examples/
│ ├── mcp_pipeline_export.py # Compile + MCP JSON-RPC export + telemetry
│ └── quickstart_compile.py # Minimal multi-step DAG compilation example
├── scripts/
│ ├── benchmark_latency.py # Sub-millisecond compilation matrix runner
│ └── gate_injection_shield.py # Adversarial prompt injection gate suite
└── tests/ # Full pytest suite (14 tests)
| Metric | Raw Prompt to LLM | Multi-Turn Agent Frameworks | agent-intent-compiler |
|---|---|---|---|
| Compilation Latency | 1,800ms – 3,500ms (network + LLM) | 450ms – 1,200ms | < 0.3ms (Observed ~0.12ms Local CPU) |
| Token Cost per Intent | ~450 – 1,200 tokens | ~250 – 600 tokens | 0 Tokens ($0.00) |
| Prompt Injection Defense | 0% (Vulnerable) | Inconsistent | Sub-ms Regex + Zero-Width + Entropy Shield |
| DAG Cycle Prevention | None (Risk of loops) | Runtime crash | Static Kahn's Algorithm |
| Cryptographic Receipt | No | No | SHA-256 Merkle Root |
| MCP Native JSON-RPC | Manual boilerplate | Partial | 1-Click Native MCPAdapter |
| Runtime Dependencies | Cloud SDKs | Heavy Python/JS stacks | Zero (Pure Python Stdlib) |
agent-intent-compiler is part of the coordinated Benni Master OS v9.4 open-source infrastructure suite:
| Repository | Focus & Architecture | Stars |
|---|---|---|
conductor-sdd |
Zero-Dependency Spec-Driven Development, Static AST Drift Detector & MCP Guardrail | |
benni-inference-engine |
High-Throughput Sovereign Local Inference for 8GB–16GB Consumer GPUs | |
agent-eval-harness |
Deterministic Zero-Cloud Agent Evaluation, Red-Teaming & Benchmark Harness | |
agent-code-sandbox |
Micro-Second Zero-Dependency Code Sandbox & Execution Shield for AI Agents | |
agent-deep-research |
Autonomous Multi-Source Deep Research & Evidence Synthesis Engine | |
agent-browser-mesh |
Token-Saving Resilient Headless Browser Automation & A11y DOM Compiler | |
agent-intent-compiler |
Deterministic Intent Compiler & Typed DAG Execution Planner for AI Agents | |
agent-token-optimizer |
Sub-Millisecond Context Compression & Semantic Deduplication Engine | |
bio-sync-operator-os |
Real-Time Biometric Swarm Governance & 120 FPS Resonant Kinetic Interface | |
agent-cyber-sentinel |
Zero-Trust Runtime Security, Prompt Injection Firewall & Secrets Redaction | |
agent-run-ledger |
Deterministic Multi-Step Task Execution Ledger & Anti-Looping Engine | |
reality-lock |
Cryptographic State Verification & Invariant Proof Engine for Agents | |
agent-memory-mesh |
Hybrid Vector + BM25 Hierarchical Session Memory & Continuity Engine | |
benni-operator-gateway |
Human-in-the-Loop Approval & Policy Enforcement Gateway | |
mcp-forge |
Rapid Model Context Protocol (MCP) Server Scaffolding & Dynamic Tooling | |
benni-nexus |
Autonomous Multi-Agent Intent Routing & Swarm Coordination Hub | |
community-autopilot |
Autonomous GitHub Community Triaging & PR Feedback Agent |
Need deterministic intent compilation, autonomous multi-agent swarm orchestration, or enterprise Spec-Driven Governance?
- Official Website: https://benni-os.net
- Technical Masterclasses & Architecture: https://benni-os.net/blog/academy.html
- GitHub Organization: https://github.com/Benni-OS
- Maintainer: Benni Alencar
- License: MIT License
- Author: Benni Alencar (
bennialencar@gmail.com) - Architecture: Benni Master OS v9.4 Deterministic Intent Standard
agent-intent-compiler — Deterministic Intent Compiler & Typed DAG Execution Planner • benni-os.net • MIT License