Mendari
Open-source governance and evaluation for healthcare AI agents.
Mendari wraps an AI agent (an LLM behind a prompt, a LangGraph workflow, an HTTP service of your
own) in a deterministic governance engine. Every call to the agent ends in one of four explicit
outcomes, AUTO, HUMAN_REVIEW, ABSTAIN or BLOCK, decided by a policy you can read, capped
by the agent's risk level, and written to an append-only, hash-chained audit trail. The same
engine evaluates the agent on labelled cases and publishes it, with its evaluations, as a signed
archive that anyone can pull and verify.
It is built for two groups, and for the loop between them:
- Developers build an agent, run it through the engine and publish every evaluation with it: how each configuration and model did on the same cases, so whether one clearly did best is there to read.
- Hospitals adopt an agent that already comes with its evaluations and a governance structure, try it in shadow on their own workflows (a person decides every case, and the engine records what the agent would have automated), then share their results back as signed counts, never cases.
Status: research preview (0.1.0, the first release). Everything here runs on synthetic data. Mendari is not a medical device, and it must not be used with real PHI or real patients: its external security review has not happened yet (Status and limits).
your AI agent (LLM, LangGraph, HTTP service)
│ answers the questions the manifest declares, with a confidence
▼
input schema ──► agent ──► policy: rules, thresholds, risk-level caps ──► AUTO | HUMAN_REVIEW | ABSTAIN | BLOCK
│
audit trail · review queue · FHIR Task
The four outcomes
| Outcome | Meaning |
|---|---|
AUTO |
Acted on without a person, within the agent's risk cap and confidence policy. |
HUMAN_REVIEW |
A person decides, with the agent's recommendation in front of them. |
ABSTAIN |
No recommendation: the agent was not confident enough, or did not answer. |
BLOCK |
The input failed its schema or a guardrail, and the agent never saw it. |
The policy turns the agent's answers into an outcome in three steps: named rules first (in the
demo agent, a message that may describe same-day symptoms goes to a nurse as HUMAN_REVIEW,
priority urgent), then confidence thresholds on the primary question, then caps. Caps only
lower automation: a per-label limit, a failed or timed-out agent call, or the risk level can
turn AUTO into HUMAN_REVIEW, never the reverse.
The risk level is declared in the agent's manifest and enforced by the runtime, not by the agent (ADR-0002):
| Level | Kind | Automation |
|---|---|---|
| 0 | Administrative (scheduling, routing, billing) | AUTO allowed by policy |
| 1 | Clinical information processing | AUTO allowed; audited |
| 2 | Clinical support | Human review by default; AUTO needs a recorded governance approval |
| 3 | Patient-specific prediction | As level 2, with stronger validation expected |
| 4 | Time-critical, diagnostic or treatment | Never automated |
What an agent does is gated too. An agent may ask to have something done besides answer: a message put in a queue, a reply sent, an order placed. Its manifest declares each action with an effect, the agent proposes actions with its answers, and the decision's outcome decides what may be done with each. Mendari authorizes an action and records that it did; it runs none, and your caller runs only what was released (Governing actions).
| The decision is | read, draft |
write, contact |
order |
|---|---|---|---|
AUTO |
released | released | never: proposing one sends the decision to a person |
HUMAN_REVIEW |
released | held for the reviewer | held for the reviewer |
ABSTAIN |
released | blocked | blocked |
BLOCK |
blocked | blocked | blocked |
The gate is the runtime's, like the risk caps: a manifest can tighten it (allow_auto: false)
and nothing loosens it. An action the agent never declared is blocked.
The confidence the thresholds cut on can be checked: mendari calibrate fits an external
agent's confidence on labelled cases, for the version its service reported then, and when the
service reports another version nothing is automated until it is calibrated again. A second
signal (each case asked several times, or a second model that checks the first) sends a
decision to a person when the answers disagree, and never raises automation
(Calibration and a second signal).
Install
Mendari needs Python 3.11+. One install brings the command line and the server
(mendari serve), with no extra to name:
pip install mendari
To work on Mendari itself, or to run the commands below as they are written, clone the repository and use uv:
git clone https://github.com/mendari-hq/mendari.git
cd mendari
uv sync # the package, the server, and the test and lint tools
Without uv, in the clone, into any Python 3.11+ virtual environment:
pip install .
mendari --help lists the commands to start with, and mendari help all every one.
Five minutes: from the demo to your own agent
The commands are written for a clone, as CI runs them. Installed with pip install mendari,
leave out uv sync and uv run, and where a command names the demo agent's folder
(agents/portal-message-agent), name the agent instead (mendari/portal-message-agent).
1. Run the demo
Mendari bundles one agent, mendari/portal-message-agent
(agents/portal-message-agent/).
It reads a patient portal message, says what the patient asks for (a refill, an appointment,
something else) and whether the message describes symptoms that need attention today. It
answers offline from canned answers, so nothing here needs a key or a network. Like everything
in this repository it is a Synthetic example. Not clinically reviewed. Not for patient care.
uv sync
uv run mendari demo
The demo decides six messages and shows what the agent asked to do with them:
released assign_queue (write) with the AUTO decision on message 1
held send_acknowledgement (contact) message 3 waits for a reviewer
released send_acknowledgement (contact) the reviewer confirmed it
blocked an action the agent never declared asked for message 1
It then works the review queue, verifies the audit chain, evaluates the agent on 600 synthetic messages and says not ready: the canned answers do not detect 33 of the 114 urgent messages, those worded as a patient might, and 9 of them would have been automated, so no person would have read them. That is on purpose: the evaluation is there to catch it before anything decides alone. Its operating point adds that no automation threshold keeps such critical misses to 1% with 95% confidence: the fix is the agent, not the threshold. And a probe rewrites cases in ways that keep their meaning (a typing error, a line break, an instruction slipped in) to find the failures nobody wrote a case for. Last, it grades what the agent wrote against a rubric: a judge's grades are shown only for the criterion on which it agrees with the graders, and withheld for the rest. The demo's graders are simulated and its judge's grades are canned, and it says so.
2. Scaffold, validate, test and evaluate your own
uv run mendari new my-agent --id my-clinic/my-agent # a working copy of the demo agent, under your id
uv run mendari validate my-agent # the manifest and every file it names
uv run mendari test my-agent # its behaviour tests
uv run mendari eval my-agent --dataset examples # accuracy, calibration, outcomes, the operating point
uv run mendari eval my-agent --dataset examples --provider reader=rules # the keyword-rules variant, same cases
uv run mendari probe my-agent # its failures; --write keeps each as a test
The folder is plain text:
my-agent/
├── agent.yaml the agent's manifest: id, risk level, questions, the agent slot, policy
├── schemas/input.schema.json what a valid input looks like (anything else is BLOCK)
├── fixtures/mock_agent.json canned agent answers, used while no live agent is set
├── logic/rules.yaml a keyword-rules variant to compare the agent with
├── data/examples.jsonl labelled cases for `mendari eval`
├── tests/cases.yaml behaviour tests for `mendari test`
└── .github/workflows/mendari.yml the same checks on every change (no part of the agent)
The manifest declares questions, not models: each question has a fixed set of answers with
criteria written in words, and the policy is written against those answers. A slot answers
them, and each of its variants is one of four types: rules (weighted patterns), llm (a model
behind a prompt), agent (your service, over HTTP) or check (one variant answers, a second
checks it, and a person decides where they disagree). Edit the questions and the policy for
your own task: mendari validate says what is wrong, by file and field, and mendari eval gives
each figure as k of n with its exact 95% interval (twelve cases are a smoke test, not an
estimate). The
authoring guide
explains every section, and
the spec
specifies it.
In CI. The workflow uses Mendari's GitHub Action: on a pull request or a push to main it
validates, tests and evaluates the agent, writes the figures and the operating point to the
job's summary, and fails the job when a limit you state is not met or the result is worse than
a baseline. It needs no secret, and resolves once a release is tagged (none is yet)
(Evaluating an agent on every change).
3. Put a real model behind it
The answers come from a service you run: Mendari sends it one POST per decision, with the
questions and the input fields the manifest allows, and checks every answer. Three starters
speak that contract, each with one function to replace:
examples/http-agent,
examples/langgraph-agent
and examples/claude-agent.
cd examples/http-agent
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
AGENT_TOKEN=a-long-random-string .venv/bin/uvicorn api.index:app --port 8787
In a second terminal, in the clone, the same commands now call it instead of the canned answers:
MENDARI_AGENT_URL=http://127.0.0.1:8787/decide MENDARI_AGENT_TOKEN=a-long-random-string \
uv run mendari eval my-agent --dataset examples
A wrong, missing or late answer is a provider failure, and the decision goes to HUMAN_REVIEW
or ABSTAIN: an unreachable agent never automates
(the contract).
Measured through Mendari on the demo agent's 600 synthetic test messages (2026-11-21, exact 95%
intervals):
| Canned answers (offline) | claude-agent (live) |
|
|---|---|---|
| Request correct | 549 of 600 [89.0-93.6%] | 598 of 600 [98.8-99.96%] |
| Urgent messages caught | 81 of 114 [61.8-79.2%], 9 automated | 114 of 114 [96.8-100.0%], none automated |
| Automated and wrong | 9 of 600 | 0 of 600 |
| Cost per decision | $0 | $0.0075 |
| Latency, median / 95th percentile | under 1 ms | 2.2 s / 4.2 s |
The set is synthetic, built from fixed phrase lists: it shows how the evaluation tells two configurations apart, not how either would do on real patients.
4. Serve it and open the console
MENDARI_AGENTS_PATH=my-agent uv run mendari serve --db var/demo.db # http://127.0.0.1:8000
The Governance Console at http://127.0.0.1:8000 shows each agent's Decision Card, the review
queue, the audit trail, evaluations and monitoring; the demo agent is served beside yours (set
MENDARI_AGENT_URL as in step 3 and the server calls your live agent). From a second terminal,
ask for a decision:
curl -sS -X POST http://127.0.0.1:8000/api/agents/mendari/portal-message-agent/decide \
-H 'content-type: application/json' \
-d '{"message": {"body": "Please refill my inhaler. Also I have had chest pain since last night."}}'
The answer is the decision ("outcome": "HUMAN_REVIEW", "priority": "urgent"): the rule
same-day-symptoms sends a refill request that mentions chest pain to a nurse. It is now in the
review queue (GET /api/review) and the audit trail (GET /api/audit/{id}). The JSON names the
agent under agent: its id, version and digest. The server is open by default, for local use,
and documents its API at /docs; with sign-in on, canned answers never automate.
The same decision from Python:
from mendari import Decision
agent = Decision.from_hub("mendari/portal-message-agent")
result = agent({"message": {"body": "Please refill my inhaler. Also I have had chest pain since last night."}})
result.outcome # Outcome.HUMAN_REVIEW
result.recommendation # 'refill'
result.priority # Priority.URGENT
result.reasons # ('rule same-day-symptoms: The message may describe symptoms that need a nurse today.',)
Another AI agent calls the same decisions as tools: mendari mcp --db var/mcp.db is a
Model Context Protocol server on stdio.
The Agent Hub: publish and pull
An agent travels as a deterministic archive signed with its publisher's Ed25519 key. A registry
keeps immutable versions and shows only what it checked itself
(ADR-0012);
the Agent Hub (hub/) is its website.
No registry address is built into the client: mendari login names one, and
mendari registry serve runs your own.
mendari keys generate --out keys/ # a publisher key pair (Ed25519)
mendari login --registry https://hub.example.org --token <publisher token>
mendari keys register --namespace my-clinic --public-key keys/publisher.pub
mendari push my-agent --key keys/publisher.key --evaluate test # build, sign, publish, and evaluate every configuration
mendari search portal # anyone, from that registry
mendari pull my-clinic/my-agent # download, verify, cache
- Publishing. Your organization claims a namespace and mints a publisher token. The
registry refuses a version
mendari validatewould refuse, and lists a first one once a reviewer approves the namespace. - Publishing its evaluations.
push --evaluate DATASETthen runs every configuration of the agent on a dataset of 100 cases or more that its manifest declares, and publishes each result signed with the same key: counts only, and the registry runs a local configuration again and refuses counts that differ (ADR-0020). The Hub gives the agent an evaluation page (/agents/<namespace>/<name>/evaluation): what was evaluated and on what data, the configurations side by side, and which one did best on that dataset only when one clearly did. The command prints the page's address and a badge for your README that says the same in one line.eval --publishpublishes one configuration at a time (Publishing an agent's evaluations). - Pulling.
pullchecks the archive's digest, every file's hash and the signature before it caches the agent, and pins the namespace's key on first use. Served, a pulled agent never automates until your organization approves its exact digest, nor while its registry recalls it (Running a registry).
Adopting an agent at a hospital
Install with one command. On one machine with Docker, ./mendari-site install
(deploy/site/) asks for what
only the site knows (its address, its identity provider, its first administrator), generates
every secret, and starts the engine behind https with its database, daily jobs and backups.
The first administrator signs in through the hospital's own identity provider, and the console
opens on what is left to set up
(Install Mendari at your site).
From there the console is enough: its System view lists what the deployment needs to run
safely, each check with what is so and what to do, and its Agents view finds an agent in
the registry, adds a verified version, and connects the service that runs it
(Adopting an agent from the console).
The steps below are the same path, whichever way the engine was installed.
- Read before you run. An agent's page on the Hub shows its Decision Card (intended use, risk level, policy, known failure modes), what the registry checked, the publisher's evaluations of each configuration and other sites' pooled results.
- Pull it and measure it on your own cases, inside your environment (Evaluating at your site), and ask which automation threshold those cases support: a publisher's threshold is evidence about the publisher's cases (Choosing an automation threshold).
- Run it in shadow. A decide call with
?shadow=true(or the headerX-Mendari-Shadow: 1), or a shadow pilot started in the console, holds automation: each decision goes to a person while the engine records what the agent would have automated.GET /api/agents/{namespace}/{name}/validation-briefsums it up, with no case text. - Bring it to your AI governance committee. The committee packet is one page to print per
agent, as your organization sees it: what the agent is and what the runtime enforces, the
publisher's evidence and your own, monitoring and approvals, then what nobody has stated
and a crosswalk to four published frameworks. A reading aid, not a certification: from the
console's Overview, or
mendari packet <agent> --db <the server's database>. Without--dba publisher makes it from the agent's files alone, before any deployment exists, and its sections on a deployment's data say that none was read (The committee packet). - Let it decide, under your governance. Your organization approves the agent's exact digest; at risk level 2 or 3 it automates only after a named approver records a governance approval, and automation can be held for one agent or all of them at once. Sign-in, roles, tenancy and PHI mode are in Deploying with real patient data and Organizations and memberships; FHIR, CDS Hooks and the SMART launch in Connecting an EHR; an organization's own versions of agents in the agent store.
- Share back. Once your site is registered with the registry,
mendari eval <agent> --dataset your-cases.jsonl --sharesends it your signed counts, never a case; the Hub shows them beside other sites'.
What every decision leaves
Every decision is an event in an append-only, hash-chained trail (SQLite locally, Postgres on a
server): the agent's id, version and digest, each answer with its provider and evidence, the
outcome and the reasons. A HUMAN_REVIEW decision waits in the review queue, ordered by
priority, and what the reviewer decides is recorded in the same trail. Reports and exports
carry ids, never case text. Anyone with the database can check the chain:
uv run mendari decide agents/portal-message-agent --text "I need to reschedule my appointment next week." --db var/readme-audit.db
uv run mendari audit verify --db var/readme-audit.db
uv run mendari card agents/portal-message-agent # the Decision Card: intended use, risk, policy, limits
uv run mendari --version
The server also speaks an EHR's standards: FHIR R4 (POST /fhir/$decide, decisions as Task,
the trail as AuditEvent and Provenance), checking the FHIR it is given against US Core
6.1.0; CDS Hooks 2.0; SMART App Launch, for a clinician the EHR launches into the console, and
SMART Backend Services, for machines; and Bulk Data, whose export mendari bulk turns into a
local dataset. The demo agent maps a FHIR Communication and declares a hook, so $decide and
CDS Hooks both answer for it
(Using the API,
Connecting an EHR).
Documentation
The pages in docs/ build into a site
with MkDocs Material (uv sync --group docs, then uv run mkdocs build --strict); it is not
hosted yet.
| If you want to | Read |
|---|---|
| write an agent's manifest | the authoring guide |
| find an agent's failures, set its threshold, check every change | Finding failures, Choosing an automation threshold, Evaluating an agent on every change |
| check an agent's confidence, add a second signal, gate what it does | Calibration and a second signal, Governing actions, the spec |
| grade what an agent writes, with clinicians and a judge whose agreement is measured | Evaluating written output |
| call Mendari over REST or FHIR | Using the API |
| read an evaluation report | Evaluation reports and ledgers |
| publish an agent's evaluations, with a page and a badge | Publishing an agent's evaluations |
| install it at a hospital and adopt an agent from the console | Install Mendari at your site, Adopting an agent from the console |
| deploy it another way | deploy/, the incident runbook |
| understand how the engine works | Architecture |
| read why it is built this way | the decision records |
| review its security | SECURITY.md, the threat model |
| see where the project is going | Roadmap |
Project layout
agents/ the bundled demo agent (portal-message-agent)
examples/ three starters for the service behind an agent: HTTP, LangGraph, Claude
src/mendari/
├── core/ manifest spec and loading, digest, runtime, policy, audit, Decision Card, committee packet
├── providers/ what can fill an agent's slot: rules, llm, agent (HTTP), check; repeated runs, calibration; the judge
├── evals/ metrics, the evaluation harness, the operating point, the probe, written output, behaviour tests, reports
├── standards/ FHIR R4 and US Core, reading an EHR's records, CDS Hooks, SMART on FHIR, Bulk Data
├── server/ the FastAPI app: REST, FHIR, CDS Hooks, review, audit, sign-in
├── dashboard/ the Governance Console: HTML, CSS and ES modules, no build step
├── hub/ the registry service and its client (push, pull, verify)
├── sandbox/ `mendari demo` and the `mendari sandbox` commands, on the demo agent
├── templates/ what `mendari new` writes
├── agent_kit.py the kit the starters answer the agent contract with
└── mcp.py governed decisions as MCP tools
tests/ the test suite (tests/fixtures/ holds synthetic fixtures only, the agents it decides with among them; tests/support/ makes them)
docs/ guides, spec, operations, security, decision records (the documentation site)
hub/ the Agent Hub website (Next.js), a front end to a registry
web/ the public page, mendari.co (static HTML and CSS)
deploy/ the one-machine install (site/), on-premises, Kubernetes and Vercel templates, a status page's checks
scripts/ checks and generators that CI runs
action.yml the GitHub Action that checks an agent in its own repository's CI
sandbox/ Inferno conformance kits against the engine (inferno/)
licenses/ licence texts and notices for what the images and NOTICE carry
notes/, tasks/ project notes, plans and lessons
Development
uv sync
uv run pytest # the full suite; warnings are errors
uv run pytest -m core # the edit loop, about a minute: loading, decisions, policy, audit
uv run pytest tests/test_agent_provider.py # and the file for what you changed
uv run ruff check src tests scripts && uv run ruff format --check src tests scripts
uv run mypy src tests
No real PHI, ever: test data is synthetic. How to contribute is in CONTRIBUTING.md, how the project is run in GOVERNANCE.md, and how to report a vulnerability in SECURITY.md.
Status and limits
- Research preview. 0.1.0 is the first release (Install): what it reads and writes is the baseline every later release reads, and nothing from before it is read.
- Synthetic data only. Every agent, dataset and figure here is synthetic: the figures show that the evaluation works, not how an agent does on real patients.
- Not a medical device, and not for emergencies: patients should call 911.
- No real PHI yet. Organization sign-in and PHI mode are built and have had no external security review: until they have, Mendari must not hold real PHI or decide about real patients.
License
Apache-2.0. See LICENSE, and NOTICE for the third-party material and terminology notices. Changes: CHANGELOG.md.
Metadata
Release files for mendari 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mendari-0.1.0.tar.gz | 1.9 MB | With provenance | Details for mendari-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mendari-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mendari-0.1.0-py3-none-any.whl |
Total release size: 3.9 MB
Release files / mendari-0.1.0.tar.gz
| Download URL | mendari-0.1.0.tar.gz |
|---|---|
| Size | 1.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72b0238636246cfdaba455e5db02e3d9f3d577babb2ad075586e6280ba6cd555
|
|
BLAKE2b-256 checksum How to use checksums |
5f16393ae1fc6634b41f7138730a85845bb6f5ec23e1d717c5c2bd52676265be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 26, 2026.
Transparency logRelease files / mendari-0.1.0-py3-none-any.whl
| Download URL | mendari-0.1.0-py3-none-any.whl |
|---|---|
| Size | 2.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
75e60e5aa5092669e313a1835c44afd44e8006ff18469bdbf4dfc9453492a588
|
|
BLAKE2b-256 checksum How to use checksums |
dab4e27a594003fdfa4ab96cd87ff03600476992b052252d2feea7b38153c69d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 26, 2026.
Transparency logSecurity for mendari 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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mendari-0.1.0.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 Nov 26, 2026.
Transparency logA 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.