Skip to main content

Yagami

Open-source AI context firewall for governed model, retrieval, memory, and tool access.

CI Python License: MIT

Yagami is a self-hosted LLM gateway and policy boundary for applications and AI agents. It classifies context locally, maps destinations to trust zones, applies versioned policy, governs tool execution, and records content-free evidence. Existing OpenAI SDK applications can adopt it by changing one base_url.

Try it in 60 seconds

Choose one command:

uvx yagami demo
# or: python -m pip install yagami && yagami demo
# or: docker run --rm -p 127.0.0.1:8000:8000 ghcr.io/matthewtracy/yagami:latest yagami demo --host 0.0.0.0 --allow-remote

Open http://127.0.0.1:8000. The no-credential demo uses the configured Ollama model when it is installed and otherwise presents a clearly labeled policy-only fallback. It disables cloud routing while still exercising classification, policy, lineage, storage, and audit behavior.

For local model-backed answers, install Ollama, run ollama pull llama3.2:3b-instruct-q4_K_M, and restart the demo.

Watch the two-minute demo.

Protect an application

yagami init
yagami doctor
yagami serve
from openai import OpenAI

client = OpenAI(
    base_url="http://127.0.0.1:8000/v1",
    api_key="your-yagami-project-key",
)

response = client.chat.completions.create(
    model="yagami-auto",
    messages=[{"role": "user", "content": "Summarize this document."}],
    metadata={"sensitivity": "none", "purpose": "internal-documentation"},
)
print(response.choices[0].message.content)

Install yagami[providers] when the Yagami process or example client needs Anthropic/OpenAI-compatible SDKs. PDF extraction uses yagami[ingest], OS keyring storage uses yagami[desktop], and yagami[all] retains the previous batteries-included behavior.

What Yagami enforces

  • Sensitive-context containment. Caller labels and local detectors can force PHI, clinical context, credentials, and inherited sensitive history to device/private-network backends.
  • Governed tools. Function tools and MCP calls pass through policy, schema checks, risk controls, and optional identity-bound one-time approvals.
  • Retrieval and memory boundaries. Namespaces, provenance, labels, TTLs, quarantine, and policy govern stored and retrieved context.
  • Content-free evidence. Policy passports, audit chains, metrics, and traces carry labels, hashes, reason codes, counts, and timing rather than prompts, completions, retrieved text, or tool arguments/results.
  • Self-hosted operations. Use SQLite locally or PostgreSQL plus distributed coordination for production. Containers, Compose, Helm, Prometheus, OpenTelemetry, backup/restore, and signed policy bundles are supported.

Yagami exposes OpenAI-compatible Chat Completions and core Responses APIs plus Streamable HTTP MCP. It works with local Ollama, explicitly configured llama.cpp, Foundry Local, direct cloud providers, and existing OpenAI-compatible gateways. Frameworks can use the standard endpoint without bypassing the same policy and evidence pipeline.

Limits and trust

Yagami is alpha software and an enforcement component, not a compliance certification. Detection can miss sensitive or malicious content. Strict deployments should declare known sensitivity at the caller, fail closed, use a local-only policy where appropriate, test organization-specific cases, and review the threat model before production use. Telemetry is disabled by default.

Metadata

Release files for yagami 0.8.4

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

Source distribution (sdist)

Source distribution for yagami 0.8.4
File Size Uploaded Provenance Actions
yagami-0.8.4.tar.gz 400.3 kB With provenance Details for yagami-0.8.4.tar.gz

Built distribution (wheel)

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

Total release size: 850.7 kB

Release files / yagami-0.8.4.tar.gz

Download URL yagami-0.8.4.tar.gz
Size 400.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4f8a5bb979e26f5401cc4304bcd3379e5683d66953f9c92373c67bb9336cbf9f
BLAKE2b-256 checksum
How to use checksums
a4306ab9f2313c773dd71186baba581b04bcf640426a078af3f3ba1c0848685e
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 Oct 30, 2026.

Transparency log

Release files / yagami-0.8.4-py3-none-any.whl

Download URL yagami-0.8.4-py3-none-any.whl
Size 450.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a6fef1f39186e1989c47c8858bc4bddf976cd5efc984d145b8fe07c4358c2e0
BLAKE2b-256 checksum
How to use checksums
d433f7ceaf8f774cd0526293faed2c058b5878297ae6cb13b080228a640842d3
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 Oct 30, 2026.

Transparency log

Security for yagami 0.8.4

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for yagami-0.8.4.tar.gz

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 Oct 30, 2026.

Transparency log

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