Skip to main content

amiril (Python)

The Python Amiril SDK: the rule engine (spec/edoc.md) and the kernel (spec/kernel.md) with no runtime dependencies, amiril.init() and amiril.instrument(), and the framework adapters as extras: amiril[adk] (Google ADK) and amiril[langgraph] (LangGraph and LangChain create_agent). amiril.plain is the same checks for an agent written by hand, with no extra. Getting started: docs/frameworks/adk.md, docs/frameworks/langgraph.md and docs/frameworks/no-framework.md.

src/amiril/
  __init__.py      init(), instrument(), the handle (_runtime.py) and the install errors
  adk.py           the ADK adapter: one plugin, first in the app's plugin list
  langgraph.py     the LangGraph adapter: create_agent middleware and a ToolNode for StateGraph
  plain.py         no framework (spec/plain.md): name an agent, wrap its tools, mark a run,
                   or check each call by hand; also what an adapter for another framework calls
  _adapters.py     what the adapters share: parent link, faults, coercion, coverage entries
  core.py          the public surface adapters import: Guard, RunContext, CallRecord,
                   Decision, Outcome, load_document, coerce_args, ...
  seams.py         the interfaces between the kernel, the adapters and the control-plane
                   client (bundle source, decision sink, resolver, registration reporter,
                   kernel stats), each with a local-only implementation
  control/         the control-plane client (spec/protocol.md): registration, rule sync,
                   heartbeats, decision delivery and spool, holds, redaction, path C
  testing.py       InjectedFault, the fault-injection seam the conformance suite uses
  _engine/         loader and validator, evaluator, sentences
  _kernel/         records, history store, Guard, decision lines, coercion, ids
tests/
  control/         the client against a fake control plane that schema-checks every request
                   (../../spec/protocol), and an integration test against the real ingest
                   service, skipped unless AMIRIL_TEST_ENDPOINT and AMIRIL_TEST_KEY are set
  conformance/     the runner over ../../conformance (scenarios and golden lines, probes,
                   bad documents, catalogue, coercion)
  frameworks/      the scenarios through real ADK and LangGraph runs (scripted models), the
                   span constants, install order, coverage, tool-error parity, the examples
  unit/            eviction, history report, swap, tool_id, holds and faults, init()
examples/          runnable offline examples behind the getting-started pages
scripts/
  test-installed.sh  build the wheel, install it into a fresh venv, run the suite against it
  bench.py           latency benchmark: 50 rules, 200 prior calls, p50 and p99 per decision

Running the control-plane client in production:

  • SIGTERM loses queued records unless the host acts: Python's default SIGTERM handling skips atexit, so the client neither sends nor spools what is queued. Call the handle's shutdown() (or the client's) from a SIGTERM handler, or install one that raises SystemExit.
  • Forking servers (gunicorn --preload, celery prefork) are supported: each child re-initialises the client with a new process id and starts it on first use.
  • Proxies come from HTTPS_PROXY/HTTP_PROXY and NO_PROXY.
  • Disk: the spool and bundle cache live in AMIRIL_CACHE_DIR, else $XDG_CACHE_HOME/amiril, else <tmp>/amiril-<uid>, a directory that must be private to the user (0700); otherwise they are not used.
  • DNS is not bounded by the client's timeouts (hold reads included); the system resolver's own timeouts apply.

Develop with uv sync then uv run pytest; for the framework tests, uv sync --group frameworks --python 3.12. Prove publishability with scripts/test-installed.sh [3.11] and, with the frameworks, scripts/test-installed.sh 3.12 frameworks, which is what CI runs.

With a framework, local-only (no API key, no network):

import amiril

amiril.init(rules_file="rules.json")
amiril.instrument(app)  # an ADK App or Runner; for LangGraph see docs/frameworks/langgraph.md

The kernel on its own:

from amiril.core import Guard, RunContext, load_document_file

guard = Guard(mode="enforce", document=load_document_file("rules.json"))
ctx = RunContext(run_id="run-1", agent_id="planner")
outcome = guard.before_call(ctx, "call-1", "update_record", {"id": "rec_1", "count": 12}, batch_id="turn-1")
if outcome.proceeds:
    result = update_record(id="rec_1", count=12)
    guard.after_call(ctx, "call-1", raw_result=result)
else:
    result = outcome.message  # what the model is told
guard.end_run(ctx)

For AI assistants

The installed package carries its docs for the installed version in amiril/docs/ under site-packages; start at amiril/docs/README.md. They need no network call. Find the folder with python -c "import amiril, pathlib; print(pathlib.Path(amiril.__file__).parent / 'docs')". Fuller docs: https://docs.amiril.ai/llms.txt

Metadata

Release files for amiril 0.1.0

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

Source distribution (sdist)

Source distribution for amiril 0.1.0
File Size Uploaded Provenance Actions
amiril-0.1.0.tar.gz 176.9 kB Without provenance Details for amiril-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for amiril 0.1.0
File Interpreter ABI Platform Actions
amiril-0.1.0-py3-none-any.whl Python 3 none any Details for amiril-0.1.0-py3-none-any.whl

Total release size: 385.6 kB

Release files / amiril-0.1.0.tar.gz

Download URL amiril-0.1.0.tar.gz
Size 176.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e341e5be6240b03daef62424db9cd9235c7467fcd1310e6df48296b59855b28c
BLAKE2b-256 checksum
How to use checksums
f22afb71b676f3ebc9a0429beda36871708a8310eb299ff2d5fd5566ddac06e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.12 {"installer":{"name":"uv","version":"0.13.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / amiril-0.1.0-py3-none-any.whl

Download URL amiril-0.1.0-py3-none-any.whl
Size 208.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c5a603415b91544b38196d3e0f11a66a73e10d11483977afa8b0869805de4ba
BLAKE2b-256 checksum
How to use checksums
a54b85e7d0b4fcb657503b3b32299d5dd8f81b384c11b04ae43742027495183a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.12 {"installer":{"name":"uv","version":"0.13.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for amiril 0.1.0

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.

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