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.2

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.2
File Size Uploaded
yagami-0.8.2.tar.gz 400.1 kB Details

Built distribution (wheel)

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

Total release size: 850.5 kB

Release files / yagami-0.8.2.tar.gz

Download URL yagami-0.8.2.tar.gz
Size 400.1 kB
Tags Source
SHA-256 checksum
How to use checksums
de1b1ebf65116de934f6b3aeb2d02d2f0857f6bee8805dfa37adba8fcc9d0fca
BLAKE2b-256 checksum
How to use checksums
e77766c006a32998a08fa9503d6ceba4f67c3937fcf5b9567f03217d8a2cd8e9
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 6, 2026.

Transparency log

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

Download URL yagami-0.8.2-py3-none-any.whl
Size 450.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9b85349975f57c81ac0fc03def53f21453e0cde71c2a4e2f26f65a51cfc9ff4
BLAKE2b-256 checksum
How to use checksums
ebbb244391121fa4b233ed261af0062e606a2937119eee8b994dd4e83c282840
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 6, 2026.

Transparency log

Release history Release notifications | RSS feed

0.8.3

2 release files

This release

0.8.2 This release

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

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