Skip to main content

GAMA Decision OS

PyPI License: Apache-2.0 Python

An open-core control plane for autonomous agents: decide before acting, constrain execution, and require evidence that the action actually happened.

GAMA Decision OS sits between your agent and its tools. It answers three questions that most agent stacks leave to the model:

  1. Should this action run at all? Risk, intent/tier, confidence and the evidence that will be required.
  2. How should it run? Allow, sandbox, ask a human, or deny.
  3. Did it actually work? A verifiable evidence receipt instead of the model's own ok: true.

The core is licensed Apache-2.0. Enterprise capabilities are licensed separately; see Open-core.


Three gates

Gate Entry point What it does
Gate 1 — pre-action decide_request(text) Deterministic precheck plus calibrated classification into READ, DRAFT, SEND, IRREVERSIBLE. Produces a decision envelope with verdict, route, confidence, expected_evidence_spec, decision_hash.
Gate 2 — in-action decide_tool(tool, args, ctx) Tool-level gate: allow, sandbox, ask, deny. Blocks mutations in READ, blocks unrequested destructive shell and mail calls.
Gate 3 — post-action verify_evidence(envelope, tool, result) Checks the expected evidence contract and emits a hashed EvidenceReceipt. Verifies deletes on disk, SQL rows, external sends, code changes.
agent ──▶ decide_request ──▶ decide_tool ──▶ tool ──▶ verify_evidence ──▶ done / rollback

Install

The core has no third-party runtime dependencies (Python standard library only).

pip install gama-decision-os

From a checkout (editable, for development):

python3 -m pip install -e .
python3 -m pytest tests/ -q

Requirements: Python 3.9+.

The wheel also installs a gama-decision command that dispatches to the bundled tools (gama-decision mcda, gama-decision ledger, gama-decision eval, gama-decision calibration, gama-decision dpo-near-miss, gama-decision dpo-dataset).

Quick start

from gama_decision import decide_request, decide_tool, verify_evidence

envelope = decide_request("delete /tmp/report.txt")
print(envelope["tier"], envelope["verdict"], envelope["expected_evidence_spec"])

decision = decide_tool("delete_file", {"path": "/tmp/report.txt"}, envelope)
receipt = verify_evidence(decision, "delete_file", {"ok": True, "verified": True, "exists": False})
print(receipt["verified"], receipt["receipt_hash"])

See examples/ for a Python client and curl examples.

Decision framework (MCDA)

The three gates answer "may this run?" and "did it happen?". They do not answer "which of these options should we run?". gama_decision/mcda.py adds that layer: explicit options, weighted criteria, a sensitivity check and one falsifier per option.

This is a layer above the L0 gate, not a replacement. MCDA picks the option; decide_request / decide_tool / verify_evidence still gate every action that the chosen option produces.

from gama_decision.mcda import decide

result = decide({
    "id": "portfolio_90d",
    "criteria": [
        {"id": "cash", "weight": 0.6},
        {"id": "proof", "weight": 0.4},
    ],
    "options": [
        {"id": "A", "scores": {"cash": 4, "proof": 1}},
        {"id": "B", "scores": {"cash": 2, "proof": 5}},
    ],
    "falsifiers": {
        "A": "no 2 paid pilots in 30 days",
        "B": "no reproducer passing in CI by 2027-01-15",
    },
})
print(result["winner"], result["margin"], result["warnings"])
python3 -m gama_decision.mcda score    --input examples/portfolio_90d.yaml --json
python3 -m gama_decision.mcda validate --input examples/portfolio_90d.yaml
python3 -m gama_decision.mcda example

The real 90-day portfolio case lives in examples/portfolio_90d.yaml: B (Anna) scores 3.60, C (proofgate) 3.15, A (Floor Copilot) 2.50, D (status quo) 1.40; margin 0.45, and the winner does not flip for any single weight shift of ±0.2. validate fails a decision that has no falsifier, a score outside 1..5, or weights that do not sum to 1 (±1e-6). YAML input uses PyYAML when installed; otherwise the CLI tells you to install it or use JSON. JSON always works with zero dependencies.

Decision ledger

gama_decision/ledger.py closes the loop from decision to outcome. log() appends the MCDA result to a hash-chained JSONL file (decisions.jsonl by default; override with GAMA_DECISION_LEDGER or --ledger). resolve() later records whether the winner was verified or its falsifier fired, without editing the original record. stats() reports, per decision, confirmed vs rejected, calibration split by margin (< 0.5 vs >= 0.5), and decisions still unresolved after N days (default 90). verify_chain() recomputes every SHA-256 and prev_sha256, so one edited byte fails verification. Standard library only.

python3 -m gama_decision.ledger log     --input examples/portfolio_90d.yaml --json
python3 -m gama_decision.ledger resolve --decision-id portfolio_90d_2026-12-04 \
    --option B --outcome verified --evidence "grant terms signed 2026-12-10" --json
python3 -m gama_decision.ledger stats   --json
python3 -m gama_decision.ledger verify  --json

What is in the core

  • gama_decision/decision_l0.py — deterministic rules, tiering, calibrated probabilities, session slot filling, speculative override hook, tool gate, evidence gate.
  • gama_decision/mcda.py — MCDA layer above the gate: options, weighted criteria, ranking/margin, weight sensitivity with break-even points, falsifier testability.
  • gama_decision/ledger.py — append-only, hash-chained decision log: log the winner and falsifiers, resolve outcomes later, calibration by margin bucket, chain verification.
  • gama_decision/decision_context.py — dependency-free repository/context compression (optional gama_repomap3 backend when installed).
  • gama_decision/calibration_evaluator.py — ECE and Brier score with a pure-Python fallback.
  • gama_decision/eval_adapter_ece.py — adapter evaluation and temperature-scaling calibration (optional scipy/torch backends).
  • gama_decision/dpo_near_miss.py, dpo_dataset_generator.py — near-miss DPO dataset generation from receipt logs.
  • tests/ — decision, speculative, context and calibration tests.

Open-core

Core (Apache-2.0) Enterprise
Three-gate runtime Yes Yes
Evidence receipts Yes Yes
Calibration tooling Yes Yes
Compliance reporting / retention — Yes
SSO / SCIM, multi-tenancy — Yes
ERP / database connectors — Yes
Signed releases, SLA, support — Yes

The enterprise license template is in LICENSE-ENTERPRISE.md. Core code is governed only by Apache-2.0.

Security

  • No secrets are required to run the core.
  • All network features are opt-in via environment variables.
  • Report vulnerabilities per SECURITY.md.

Documentation

License

Apache License 2.0. See LICENSE.

Brojevi (jedan izvor istine)

Svi brojevi u dokumentaciji i na sajtu dolaze iz config/FACTS.json u internom repou:

Stavka Vrijednost Kako je izmjereno
Alati (katalog) 398 len(all_tools())
Alati (runtime prompt) 296 len(TOOLS)
Vještine (biblioteka) 5.024 direktoriji u ~/.agents/skills
Persone 409 gama_persona_ondemand.list_personas()
Baseline šema 53.226 tokena sve šeme prije kompresije
Prosječno šema (live) 2.312 tokena _token_ledger.db, 24 h
Ušteda (live, 24 h) 85,4 % (n=3.252) python3 benchmarks/ledger_stats.py (token_ledger, 2026-11-26)
Ušteda (7 dana) 78,8 % (n=14.669) isto; projekcija do 93 % važi samo za veći udio ponavljanja
Short-circuit 0,6 % upita (24 h) · 2,4 % (7 d) isto. Ranije navedenih „28 %" nije reproducirano
L0 odluka 0,0025 ms p50 (READ) · 0,0021 (IRREVERSIBLE) · 0,0022 (SEND) python3 benchmarks/decision_latency.py --n 500, 0 pogrešnih odluka, 2026-11-26
ECE (kalibracija, dry-run) 0,407 (Brier 0,317, accuracy 0,643, n=42) python3 -m gama_decision.eval_adapter_ece --dry-run (2026-11-23). Broj sa adapterom (0,2973 → 0,0347) traži GPU + adapter i nije reproduciran ovdje

Napomena o brojevima iz žive baze: token_ledger raste, pa ledger_stats.py danas vraća drugačiji n i procenat od onog u tabeli. Brojevi u tabeli su snimak na navedeni datum i nisu CI-provjerljivi; provjerljiva je komanda, ne vrijednost. „Short-circuit“ je 0,6 % (24 h) i 2,4 % (7 d); ranije je pisalo 7,2 % — udio zavisi od sastava saobraćaja u prozoru i ne treba ga čitati kao fiksnu osobinu sistema.

Nije reproducirano u ovom repou

Sljedeće je mjereno interno, ali artefakt nije objavljen — tretirati kao nepotvrđeno dok se ne doda skripta: Tier model 40/40 (100%) · Tool paging 97,3 % · Code Mode −82,3 % tokena

Šta je novo (2026-11-15)

Sloj Rezultat Kako je izmjereno
Code Mode (kod umjesto tool-callova) −82,3 % tokena na 3 koraka (−70,6 % na 1, −89,2 % na 10) bench, 5 realnih multi-step zadataka, 40 alata
Deterministički obrasci 10 obrazaca = 27 % stvarnog prometa, 0 tokena regex na 318 stvarnih upita
Canary ramp 5 % (shadow mjeri prije 25 % / 100 %); sve uštede aktivne na 6 čvorova (16 flagova) hash bucket po (sid, obrazac)
Gated semantički keš 89 % hit, USR = 0 % (20/20 trapova blokirano) bench 200 upita
Exact cache na ingress −13,8 % ponovljenih poziva (prije se gubilo) live, cache hit verifikovan
Dedup tool rezultata (TOOL_RESULT_DEDUP) 0–37 %, zavisno od ponavljanja: 0 % bez ponavljanja, 19,4 % na 10 %, 24,2 % na 25 %, 36,9 % na 40 % bench sa realnim, unikatnim sadržajima (pošteno mjereno, bez lažnih dedupova)
Token ledger po fazi (TOKEN_PHASE_V1) ingress / loop / chat odvojeno; prvi snimak 26 zapisa, 8.670 prompt, 1.502.633 ušteđenih tokena token ledger (SQLite), izvještaj po fazi i modelu
Audit popravke (Claude + Codex) decision cache scopiran po sid (sigurnosni), exact cache u stream putu, output budget u streamu, paging 4k / truncate 6k, Code Mode timeout guard 28 testova u ovom repou: 27 prošlo, 1 skip bez GAMA_SPECULATIVE_URL (python3 -m pytest -q tests); deploy na svih 6 čvorova
Brain v2 100.222 zapisa, sync 60 s, opoziv + stale detekcija /api/stats
Javna verifikacija dokaza https://gamai.io/api/verify?hash=... → chain_ok=true live curl

Sigurnosne ograde Code Modea: samo READ/DRAFT tier, AST validacija (bez importa/atributa/lambde), max 40 linija i 10 poziva, automatski fallback na normalan tok ako kod ne prođe.

Metadata

Release files for gama-decision-os 1.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for gama-decision-os 1.2.3
File Interpreter ABI Platform Actions
gama_decision_os-1.2.3-py3-none-any.whl Python 3 none any Details for gama_decision_os-1.2.3-py3-none-any.whl

Release files / gama_decision_os-1.2.3-py3-none-any.whl

Download URL gama_decision_os-1.2.3-py3-none-any.whl
Size 72.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9fbf06cc4887e10bb0288092cb76aa671ffcef7a10c37ef058cf76960c73fe3
BLAKE2b-256 checksum
How to use checksums
d66ab5b418201610c48aee1eed66b2a75b193f911d0a2cc0d152427c661e22fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for gama-decision-os 1.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.2.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page