Zero-token procedural execution for autonomous AI agents
Semantic Harness compiles multi-turn LLM reasoning loops into deterministic, type-safe Python AST procedures. Re-execute recurring enterprise workflows in microseconds at 0 model tokens with 100% parameter accuracy.
See the Execution Difference
Click any quick scenario or customize parameters to see how Semantic Harness compiles and re-executes verified ASTs compared to standard LLMs and traditional vector caches.
# Step 1: Inbound Request -> "Calculate total closed won revenue for Europe region"
# Step 2: TurboQuant PolarQuant Fuzzy Match (Similarity: 0.94, Confidence: 0.92 >= 0.85)
# Step 3: Parameter Slot Binding -> params = {'region': 'Europe', 'stage': 'Closed Won'}
# Step 4: Python REPL Exec -> execute_ast(crm_revenue_ast, params=params)
# Step 5: Live Database Result -> {"revenue": 300000.0, "region": "Europe"} (1.12 ms)
The Four Architectural Pillars
How Semantic Harness combines verified execution contracts with extreme vector compression.
1. Verified Semantic Compilation
Treats multi-turn LLM reasoning as a JIT program synthesis step. Once verified against Pydantic schema contracts, execution paths are compiled into parameterized ASTs for zero-token re-execution.
2. Chaos2Clarity (C2C) Self-Healing
Intercepts schema validation failures and synthesizes minimal, targeted differential prompts. Elevates Small Language Model (≤3B) structured output pass rates from 41.2% to 96.8%.
3. Google TurboQuant / PolarQuant
Compresses continuous procedural intent vectors by $8\times\text{--}16\times$ using random orthogonal polar transforms with QJL 1-bit residual correction for unbiased sub-microsecond retrieval.
4. ACT-R Cognitive 3-Tier Memory
Integrates a sliding Short-Term FIFO buffer, an embedded Long-Term SQLite datastore ranked by ACT-R cognitive activation equations $A_i(t)$, and quantized procedural caching.
Unified 5-Layer Stack
Decoupled hierarchy bridging probabilistic reasoning models with deterministic execution engines.
DeepSeek Harness (DSH) — Lifecycle & Governance
Waterfall event pipeline (turn/start → step/start → step/end → turn/end) with immutable append-only JSONL session logging and proactive loop guards.
NVIDIA Object-Oriented Agents (NOOA) — Execution Model
Class-as-Agent contracts with docstring prompt binding and a stateful, sandboxed CodeAct Python REPL for persistent multi-turn variables and AST capture.
Semantic Harness Core — Cognitive Middleware & C2C
Deterministic Pydantic validation, dynamic context token budgeting, and the Beta-Bernoulli conjugate reliability gate for safe fast-path routing ($0.00\%$ False Reuse Rate).
Google TurboQuant / PolarQuant — Vector Compression
1-Bit polar vector quantization and fast Walsh-Hadamard transforms enabling CPU bitwise XOR search ($1.5\ \mu\text{s}$ per query).
Multi-Provider Inference Layer
Universal model interoperability across local Ollama SLMs (Qwen, Gemma), vLLM engines, and cloud providers (OpenAI, Anthropic, Gemini).
Research Figures & Benchmark Data
Evaluated across 89 verified unit test suites, a 48-turn enterprise runtime stream, and a 200-turn relational SQL benchmark.
Drop-In Usage Recipes
Get started with one decorator, or build object-oriented stateful agents.
from pydantic import BaseModel
from semantic_harness import step
class RevenueReport(BaseModel):
region: str
total_revenue: float
deal_count: int
# Validates Pydantic schema and compiles procedural fast-path
@step(validates=RevenueReport, cache=True)
def get_regional_sales(region: str) -> dict:
prompt = f"Extract revenue figures for {region} from current pipeline."
return llm_client.generate_json(prompt)
# Turn 1 (Cold): Calls LLM -> Validates schema -> Compiles AST logic
report1 = get_regional_sales(region="North America")
# Turn 2 (Warm): Re-executes AST in REPL -> 1.1 ms response, 0 TOKENS billed!
report2 = get_regional_sales(region="Europe")
print(report2)
from semantic_harness import Agent, AgentConfig
class FinancialAnalyst(Agent):
"""You are an autonomous corporate financial analyst."""
def calculate_margin(self, revenue: float, cost: float) -> float:
"""Compute gross profit margin percentage."""
return ((revenue - cost) / revenue) * 100.0
agent = FinancialAnalyst(config=AgentConfig(model="qwen2.5-coder:3b", strategy="codeact"))
# Store enterprise metadata with ACT-R importance ranking
agent.long_term.remember(
key="q4_targets",
content="Q4 revenue target is $100M with max operating expense of $65M.",
importance=0.95
)
# Run multi-turn task with persistent CodeAct variables
result = agent.run("Evaluate projected Q4 EBITDA margin based on target figures.")
print(result)
import { Agent, step } from "semantic-harness";
import { z } from "zod";
const UserProfileSchema = z.object({
userId: z.number(),
name: z.string(),
activeSubscription: z.boolean(),
});
export class CustomerSupportAgent extends Agent {
@step({ schema: UserProfileSchema, cache: true })
async lookupUser(email: string) {
// Re-executes verified AST without token inference on warm paths
return await this.callLLM(`Fetch structured profile for ${email}`);
}
}
from semantic_harness import ProceduralMemory, C2CValidator
proc_mem = ProceduralMemory(enable_fuzzy_search=True)
def validated_tool_node(state):
intent = state["current_intent"]
# 1. Zero-Token Fast Path Check
cached_proc = proc_mem.lookup(intent)
if cached_proc and cached_proc.is_reliable:
state["result"] = cached_proc.execute(state["params"])
state["tokens_used"] = 0
return state
# 2. Standard LLM Execution + C2C Validation
raw_output = call_llm(state["prompt"])
state["result"] = C2CValidator(state["schema"]).validate(raw_output)
proc_mem.cache(intent, state["result"])
return state
Citation & Zenodo DOI
Semantic Harness is archived on Zenodo with an open-access Digital Object Identifier.
Semantic Harness: Cognitive Middleware, Procedural Acceleration, and Layered Runtime Architecture for Autonomous AI Agents
@article{bankupalli2026semanticharness,
author = {Bankupalli, Ravi Teja},
title = {{Semantic Harness: Cognitive Middleware, Procedural Acceleration, and Layered Runtime Architecture for Autonomous AI Agents}},
year = {2026},
month = {August},
journal = {arXiv preprint},
publisher = {Zenodo},
version = {0.2.3},
doi = {10.5281/zenodo.19414309},
url = {https://zenodo.org/records/19414309}
}