Skip to main content

The glass-box agent loop — policy-governed AI agents with runtime gates, audit and escalation. GMS-optional.

Project description

Beyond Prompt and Pray

Building policy-governed AI agents from scratch.

Most agent code is "prompt and pray" — you wire up a model, hand it tools, and hope it stays in scope. This is the open, inspectable alternative: an agent loop you can read in an afternoon, with typed actions, runtime gates that detect and stop risky or out-of-scope behavior before it executes, multi-axis budgets, human escalation, and a tamper-evident audit log. Everything runs on the standard library plus pydantic — the baseline works with no license and no GMS.

For production-grade guarantees — geometric plausibility, calibrated admissibility, signed verdicts — the optional GMS backend (knowlytix) snaps in via a lazy seam. Clone it, run the baseline, see exactly where GMS lifts detection and validation.

Part of the "Beyond … and Pray" series: governed agents · trustworthy RAG · test & validate · LLMs from scratch

What's inside

  • Governed agent loop — generator-based, every step inspectable
  • Runtime gatesALLOW / DENY / ESCALATE, stop bad actions before they run
  • Typed actionsToolCall / AskUser / Finish / Escalate
  • Budgets — token / time / tool-call / dollar caps, first-class
  • Human escalation — reviewer protocol, not an error path
  • Tamper-evident audit — hash-chained record of every decision
  • GMS-optional — baseline runs free; geometric guarantees via knowlytix

Install

pip install forgeloop                 # core: loop, typed actions, tools, gates, audit, planning, memory
pip install "forgeloop[ml]"           # + open-weight model tools (torch, transformers)
pip install "forgeloop[gms]"          # + the licensed GMS backend (knowlytix; see below)

Quickstart

A gate (or policy) is just (action, state) -> ALLOW / DENY / ESCALATE:

from forgeloop.core import ToolCall
from forgeloop.governance import pii_policy

action = ToolCall(tool_name="send_reply", arguments={"message": "Your SSN is 123-45-6789."})
verdict = pii_policy(action, None)
print(verdict.decision.value, "—", verdict.reason)   # escalate — detected PII: ssn

Those policies compose into a GovernanceHarness that runs gates before each agent action. For the full live ALLOW / DENY / ESCALATE stream and the hash-chained audit trail, see the runnable demos in beyond-ship-and-pray.

The GMS upgrade (open-core)

forgeloop runs fully without a license. The GMS-backed features — geometric plausibility gate, calibrated admissibility, signed verdicts — require the licensed knowlytix package, installed separately. forgeloop imports it lazily:

import forgeloop.gms as gms
gms.available()   # True if the licensed backend is installed
gms.require()     # returns knowlytix, or raises with install instructions

The production-grade, GMS-native edition is the Beyond Prompt and Pray, Pro Edition — see knowlytix.ai.

License

Apache-2.0. © 2026 Knowlytix.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

forgeloop-0.1.1.tar.gz (99.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

forgeloop-0.1.1-py3-none-any.whl (129.9 kB view details)

Uploaded Python 3

File details

Details for the file forgeloop-0.1.1.tar.gz.

File metadata

  • Download URL: forgeloop-0.1.1.tar.gz
  • Upload date:
  • Size: 99.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for forgeloop-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d9a1a00730b352e58f55d4d36555405e949d79ceec9722422890b6750ad27fdf
MD5 9b9202d1123988e58693dd878739fbe4
BLAKE2b-256 9bab360083885c61de994230b88c3343fe9b6254cade7a508d5434ddfe4fbe9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for forgeloop-0.1.1.tar.gz:

Publisher: publish.yml on knowlytix/beyond-prompt-and-pray

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file forgeloop-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: forgeloop-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 129.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for forgeloop-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72d8af6e323ef3a432351f79aa19178908519655a486320d3f9c6c3b64ab0dd4
MD5 0620fbdbea13ff6a9dda0d3b2c50bc17
BLAKE2b-256 5d3e9b02c01783050b274948f42bfb9554617a5cf2c99a360610cb758f6191ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for forgeloop-0.1.1-py3-none-any.whl:

Publisher: publish.yml on knowlytix/beyond-prompt-and-pray

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page