{"slug": "llm-nano-vm-v0-8-0-deterministic-fsm-runtime-for-llm-pipelines-now-with-output", "title": "llm-nano-vm v0.8.0 — deterministic FSM runtime for LLM pipelines, now with output validation and per-step timeouts", "summary": "The article introduces **llm-nano-vm v0.8.0**, a deterministic Finite State Machine (FSM) runtime for LLM pipelines that flips the typical architecture by making the runtime the orchestrator rather than the LLM. Key new features include `allowed_outputs` for strict output validation against an explicit enum list and per-step `timeout_seconds` with configurable fallback policies, ensuring the model cannot skip steps or escape guardrails. The system has been benchmarked at over 1 million operations with zero violations and demonstrates crash consistency with 100% hash match on replay.", "body_md": "PyPI: pip install llm-nano-vm\nGitHub: http://github.com/Ale007XD/nano_vm\nMCP gateway: http://github.com/Ale007XD/nano-vm-mcp\nI've been building a deterministic FSM execution kernel for LLM workflows. v0.8.0 just shipped to PyPI. Here's what it is, what's new, and where it's going.\nMost LLM frameworks treat the model as the orchestrator. nano-vm flips that: the runtime is the orchestrator, the model is just one step in a deterministic graph.\nδ(S, E) → S'\nCurrent state + validated event = next state. The model cannot skip steps, reorder them, or escape guardrails. The FSM is the source of truth.\nFour step types: llm\n, tool\n, condition\n, parallel\n. Programs are plain Python dicts. No DSL parser, no heavy framework magic, and zero dependency overhead.\nprogram = Program.from_dict({\n\"name\": \"customer_refund\",\n\"steps\": [\n{\n\"id\": \"analyze\",\n\"type\": \"llm\",\n\"prompt\": \"Valid refund? Reply 'yes' or 'no'.\\nRequest: $user_input\",\n\"output_key\": \"decision\",\n\"allowed_outputs\": [\"yes\", \"no\"], # ← v0.8.0\n},\n{\n\"id\": \"guardrail\",\n\"type\": \"condition\",\n\"condition\": \"'yes' in '$decision'\",\n\"then\": \"process_refund\",\n\"otherwise\": \"reject\",\n},\n{\"id\": \"process_refund\", \"type\": \"tool\", \"tool\": \"issue_refund\", \"is_terminal\": True},\n{\"id\": \"reject\", \"type\": \"tool\", \"tool\": \"send_rejection\", \"is_terminal\": True},\n],\n})\nThe guardrail step cannot be bypassed regardless of what the model returns.\nWhat's new in v0.8.0\nallowed_outputs — LLM enum guard\nValidates the model's raw output against an explicit list before the value touches anything downstream.\n{\n\"id\": \"classify\",\n\"type\": \"llm\",\n\"prompt\": \"Classify. Reply ONLY with: refund / query / other\",\n\"allowed_outputs\": [\"refund\", \"query\", \"other\"],\n\"on_error\": \"skip\", # → falls back to \"refund\" (first element) on mismatch\n}\nThree policies on mismatch: fail (default, trace → FAILED), skip (substitute allowed_outputs), retry (retry up to max_retries, then FAILED).\ntimeout_seconds + on_timeout — per-step LLM timeout\nPrevents a hung API call from stalling the entire FSM.\n{\n\"id\": \"analyze\",\n\"type\": \"llm\",\n\"timeout_seconds\": 5.0,\n\"on_timeout\": \"fallback\", # → falls back to allowed_outputs[0] or ''\n}\nTwo policies: fail (default) and fallback. Both features are independent and composable — you can use either or both on any llm step.\nWhat it can do right now\nBenchmark — v0.8.0 (WSL2 · Python 3.12 · MockAdapter · 3×5×10k)\n10/10 PASS · 1,096,500 ops · 0 violations\nScenarioMean TPSp95\nRefund pipeline\n2,200/s\n123 ms\nDouble-execution guard\n2,800/s\n69 ms\nBudget enforcement\n2,400/s\n97 ms\nParallel throughput\n1,000/s\n196 ms\nMCP store round-trip\n11,000/s\n0.13 ms\nGovernanceEnvelope\n2,100/s\n108 ms\nCrash consistency\n11/s\n115 ms\nReplay equivalence\n1,300/s\n164 ms\nAdversarial retries\n2,600/s\n87 ms\nLong-horizon (1k steps)\n95/s\n11,887 ms\nBM-INT-07 (Crash consistency): crash_rate=100% hash_match=100% — replay after simulated crash produces identical trace hash every time.\nBM-INT-10 (Memory footprint): peak RSS 76.5 MB, alloc 3.62 MB for 1,000-step programs — no memory leaks detected.\nValidated on real payment APIs\nWhat's coming next\nPhase 0 (Immediate): ProgramValidator — static analysis at Program build time. Catches missing then/otherwise/next_step targets, unreachable steps, and cycle detection. Currently these fail at runtime; when dealing with LLM-generated workflows, static analysis is a must.\nPhase 1 (Gateway Correctness): StateContext persistence between MCP calls in SQLite WAL. Right now, if the gateway process restarts after /create but before polling completes, you get a new requestId — which is a real financial duplicate risk. Closing this with an execution_contexts table + upsert on every step. Up next: TRACE projection to SQLite, GovernedToolExecutor (policy-level tool capability enforcement), idempotency_store, and native vm.step() MCP wiring.\nPhase 2 (Dev Agent): nano-vm-dev-agent — the FSM runtime managing its own development stack (read_repo_files → generate_patch(llm) → run_mypy → run_pytest → write_repo_files). DA-1 milestone is done (12/12 tests). DA-2 will be the first live run against a real sprint task (StateContext persistence). Still working on search_code and reproduce_bug tool-functions before launching live.\nPhase 3 (Observability): OpenTelemetry span per FSM step + incremental counters in Trace (llm_calls, tool_calls, retries_total).\nInstall\npip install llm-nano-vm==0.8.0\npip install llm-nano-vm[litellm]==0.8.0 # LiteLLM provider support\npip install nano-vm-mcp # MCP gateway\nLLMs are completely optional. The runtime works perfectly fine as a pure, lightweight deterministic workflow engine.\nQuestions / feedback welcome!", "url": "https://wpnews.pro/news/llm-nano-vm-v0-8-0-deterministic-fsm-runtime-for-llm-pipelines-now-with-output", "canonical_source": "https://dev.to/ale007xd/llm-nano-vm-v080-deterministic-fsm-runtime-for-llm-pipelines-now-with-output-validation-and-57ch", "published_at": "2026-05-23 04:36:37+00:00", "updated_at": "2026-05-23 05:03:00.267319+00:00", "lang": "en", "topics": ["large-language-models", "open-source", "developer-tools", "artificial-intelligence", "machine-learning"], "entities": ["llm-nano-vm", "PyPI", "GitHub", "MCP"], "alternates": {"html": "https://wpnews.pro/news/llm-nano-vm-v0-8-0-deterministic-fsm-runtime-for-llm-pipelines-now-with-output", "markdown": "https://wpnews.pro/news/llm-nano-vm-v0-8-0-deterministic-fsm-runtime-for-llm-pipelines-now-with-output.md", "text": "https://wpnews.pro/news/llm-nano-vm-v0-8-0-deterministic-fsm-runtime-for-llm-pipelines-now-with-output.txt", "jsonld": "https://wpnews.pro/news/llm-nano-vm-v0-8-0-deterministic-fsm-runtime-for-llm-pipelines-now-with-output.jsonld"}}