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

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.3
File Size Uploaded
yagami-0.8.3.tar.gz 400.2 kB Details

Built distribution (wheel)

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

Total release size: 850.6 kB

Release files / yagami-0.8.3.tar.gz

Download URL yagami-0.8.3.tar.gz
Size 400.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9394b8e17ead3c2eb3f19767bea11e8b85f6c456595a464a3f525a6574f55a39
BLAKE2b-256 checksum
How to use checksums
f418a8756e8f79259be25ff138874d6052302b458f33f3bac2bb36d71416dd11
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.3-py3-none-any.whl

Download URL yagami-0.8.3-py3-none-any.whl
Size 450.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8115f85ad36a8ec6f1e33be160e73d0c13e071e0b77a8d984787cdcfb97ad6c
BLAKE2b-256 checksum
How to use checksums
e5d57e1e1bf4dff3c035508e324aec68a908b38764ff33e27396c449150956ad
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

This release

0.8.3 This release

2 release files

0.8.2

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