The Autonomous Stack
Deterministic Game Engine icon

Deterministic Game Engine · Ops · v1.0

Deterministic Python game engine for API-driven games

A reusable Python engine for games controlled through an API. It separates the

$9.00one-timePay with crypto

Buy on Gumroad → https://6355137346884.gumroad.com/l/tas-agent-game-engine-v1

game-automation deterministic-engine adapter-sdk idempotency operations

agent ⟶ theautonomousstack.xyz

01GET /api/v1/pack/agent-game-engine-v1

402 Payment RequiredPAYMENT-REQUIRED

02sign TransferWithAuthorization9.00 USDC · Base (eip155:8453)

03GET + PAYMENT-SIGNATURE

200 OKapplication/zip · 65 files

pay per pack over x402no account

What's inside

  • .dockerignore
  • CHECKLIST.md
  • CUSTOMIZE.md
  • Dockerfile
  • PROMPTS.md
  • README.md
  • REUSE_REPORT.md
  • SOUL.md
  • SPEC.md
  • adapters/__init__.py
  • adapters/demo/__init__.py
  • adapters/demo/adapter.py
  • adapters/demo/session.py
  • agent-game-engine-v1-watchdog.service
  • agent-game-engine-v1-watchdog.timer
  • agent-game-engine-v1.json
  • agent-game-engine-v1.service
  • agent.py
  • config.example.yaml
  • core/__init__.py
  • core/antiloop.py
  • core/blacklist.py
  • core/budget.py
  • core/health.py
  • core/journal.py
  • core/loop.py
  • core/outcome.py
  • core/persistence.py
  • core/scheduler.py
  • core/singleflight.py
  • core/state.py
  • core/storage_guard.py
  • core/transport.py
  • deploy.sh
  • docker-compose.yml
  • examples/canonical_task.json
  • healthcheck.py
  • install.sh
  • llm_adapter.py
  • pack_memory.py
  • manage.sh
  • ops/__init__.py
  • ops/backup.py
  • ops/config.py
  • ops/diagnose.py
  • ops/logs.py
  • ops/runtime.py
  • ops/watchdog.py
  • requirements.txt
  • run_engine.py
  • sdk/__init__.py
  • sdk/adapter.py
  • sdk/capabilities.py
  • sdk/testkit.py
  • sdk/types.py
  • sim/__init__.py
  • sim/__main__.py
  • sim/server.py
  • sim/world.py
  • smoke_test.sh
  • test_agent.py
  • test_core_sdk.py
  • test_guards.py
  • test_ops.py
  • test_sim_demo.py

A reusable Python engine for games controlled through an API. It separates the generic observe–plan–act–reconcile loop from game rules, provides typed outcomes, persists in-flight intent before mutations, and includes bounded operational tooling.

The default configuration runs a bundled loopback demonstration. The canonical contract scenario goes further: it runs entirely in memory, with no socket, account, token, language model, container, or real sleep.

Quick start

./install.sh --no-service
./manage.sh start
./manage.sh status

Run the sale-contract smoke test:

./smoke_test.sh
python3 agent.py canonical

Validate an adapter before connecting it to a real game:

from sdk.testkit import run_conformance

report = run_conformance(your_adapter_factory)
print(report.summary())

What is included

  • core/: deterministic loop, typed outcomes, persistence, pacing, guards, journal, health and storage protection.
  • sdk/: five-method adapter contract and offline conformance kit.
  • sim/ and adapters/demo/: seed-derived reference world and complete adapter.
  • ops/: configuration, runtime, diagnostics, backup and bounded watchdog.
  • agent.py: offline benchmark hook plus optional post-run briefing.

The language-model adapter is not imported by core/, sdk/, ops/ or run_engine.py. It can only summarize an already completed report.

Safety boundary

The engine never purchases, transfers, trades, messages, or authenticates on its own. A game adapter defines the authorized API and credentials. Start with the simulator, pass the conformance suite, inspect the configuration, and only then point an adapter at an endpoint you control.

See SPEC.md for the contract, CUSTOMIZE.md for adapter wiring, and CHECKLIST.md for deployment gates.

Use a local model (Ollama)

The optional LLM step can also run on your own machine through Ollama, so no text leaves your server. No account and no API key.

ollama pull <model>               # any chat model you like
export PACK_LLM=ollama            # prefer Ollama even if a coding-agent CLI is installed
export PACK_OLLAMA_MODEL=<model>  # optional: default is the first chat model the server lists
python3 -c "import llm_adapter; print(llm_adapter.detect())"   # prints: ollama
  • PACK_OLLAMA_HOST points to another server (default http://127.0.0.1:11434); OLLAMA_HOST is also read when PACK_LLM=ollama.
  • PACK_OLLAMA_NUM_CTX sets the context size if your reports or prompts are long.
  • Without PACK_LLM, a local Ollama server is used only when no Claude Code, Kimi Code or Codex CLI is found.
  • If the server is down or the model is missing, the pack keeps working in its deterministic mode.

Learning memory (local and private)

Every LLM call this pack makes is journaled in ./.pack_memory/ next to the code, so the pack can improve for you. Nothing is ever sent anywhere.

  • What is kept: the task name, the masked input, the masked answer, status and latency. Keys, tokens, e-mails, phone numbers, IP addresses, card and IBAN numbers and personal paths are masked before writing; the system prompt is never stored.
  • Teach it: python3 pack_memory.py feedback last ok confirms a result, python3 pack_memory.py feedback last bad --fix "the right answer" corrects it. Confirmed and corrected runs are reused as validated examples when a similar input comes in. Unrated runs are never injected into a prompt.
  • Find similar cases: python3 pack_memory.py similar "some text" and python3 pack_memory.py clusters (groups of near-identical failures) work in plain Python, no model needed. Optional meaning-based matching uses an embedding model you already run locally: python3 pack_memory.py enable-semantic (Ollama on this machine only).
  • Share, only if you want: python3 pack_memory.py export writes an anonymised summary (counts, statuses, size buckets, no text) for you to review.
  • Control: PACK_MEMORY=0 turns it off, PACK_MEMORY_STORE_TEXT=0 keeps fingerprints only, python3 pack_memory.py purge --yes wipes it.