Skip to main content

nooa-governance

Object-oriented cost, retry, and timeout governance for NOOA agents — baked into the agent's own class, not bolted on as an external proxy.

Why

A June 2026 preprint catalogued 63 LLM-agent budget-overrun incidents across 21 orchestration frameworks, with uncontrolled retry loops as a leading cause. Every existing fix (agent-gov, LiteLLM per-key budgets, Microsoft's Agent Governance Toolkit) works as a reverse proxy sitting between the agent and the LLM provider — external, opaque to the agent's own codebase, untestable alongside the agent's own logic.

NOOA agents are plain Python classes. That makes a different answer possible: governance as an ordinary, inheritable, unit-testable mixin, living in the same codebase as the agent it governs.

Install

pip install nooa-governance

Usage

from nooa import Agent
from nooa.unifiedllm.registry import get_llm_client
from nooa_governance import GovernedMixin

llm = get_llm_client("gemini/gemini-3.5-flash-lite")

class MyAgent(GovernedMixin, Agent, llm=llm):
    def __init__(self):
        super().__init__()
        self.init_governance(max_calls=10, max_retries_per_call=2, timeout_s=30.0)

    async def _do_the_llm_thing(self, x: str) -> str:
        """..."""
        ...

    async def do_the_thing(self, x: str) -> str:
        return await self.governed_call("_do_the_llm_thing", lambda: self._do_the_llm_thing(x))

Every governed call is checked against a hard call budget before any LLM spend happens, retried a bounded number of times with exponential backoff on failure, and time-limited per attempt — never delegated to the LLM, so enforcement holds no matter what the model decides to do. agent.governance_report() gives a deterministic audit trail: the limits enforced, calls made, retries used, failures, elapsed time, and a per-attempt log.

init_governance() also accepts non_retryable (a tuple of exception types to fail fast on instead of retrying — useful for deterministic failures like bad auth) and max_total_time_s (an optional cap on cumulative wall-clock time across every governed call, since a per-attempt timeout alone doesn't bound total run time).

What this doesn't do (yet)

calls_made counts governed method invocations, not raw LLM API calls — NOOA's execution strategy can make more than one real model round-trip per method call, so this is a solid retry/circuit-breaker mechanism but an imperfect proxy for exact dollar cost. A future version should hook into NOOA's own tracing or LiteLLM's token-usage callbacks for precise cost accounting.

Full example

A complete, real application built on this library — a claim/due-diligence verification agent with a live dashboard, Docker, and Kubernetes manifests — is in the same repository: github.com/malikbello/governed-research-agent.

License

Apache-2.0

Metadata

Release files for nooa-governance 0.1.1

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

Source distribution (sdist)

Source distribution for nooa-governance 0.1.1
File Size Uploaded
nooa_governance-0.1.1.tar.gz 40.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nooa-governance 0.1.1
File Interpreter ABI Platform
nooa_governance-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 50.4 kB

Release files / nooa_governance-0.1.1.tar.gz

Download URL nooa_governance-0.1.1.tar.gz
Size 40.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7835b1d0127826f3826c0f2f86bf837874279be3897b354e9df8c8bdf6d6e13e
BLAKE2b-256 checksum
How to use checksums
d936a199e4edf85a3c102f9cc90a8ba506ebb0611a99fd3f3c05c50e5b15e0e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release files / nooa_governance-0.1.1-py3-none-any.whl

Download URL nooa_governance-0.1.1-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d803ba2e58d84e78fbb17d6d2a941300b4d21592484e1d0bc55a385bc815c132
BLAKE2b-256 checksum
How to use checksums
677554d6af722a3a85b1f18be562461aba7dfce470ad35269be1545b6932a3a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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