
Initial Release
Hospital interoperability and exception management on InterSystems IRIS, with an AI Hub agent and a deterministic policy gate.
A simulated laboratory sends HL7 v2 results to an IRIS interoperability production. When a result can’t be routed safely, an IRIS AI Hub agent investigates it with read-only tools and recommends an action. A deterministic policy gate decides whether that action may run, and the production carries it out. All data is synthetic.
Demo video (3 min 24 s, real application footage, synthetic-voice narration): YouTube · download MP4 (no login needed) · captions
Article: CareBridge AI: Building a Governed Hospital Interoperability Agent with InterSystems IRIS AI Hub (InterSystems Developer Community)
| The agent investigates with read-only tools (LIVE, local model) | The policy gate refuses an unsafe recommendation |
|---|---|
![]() |
![]() |
A lab result can be valid HL7 and still be unsafe to route:
Interface teams triage these by hand: look up the patient, the order and the history, then hold, reject, suppress, retry or escalate. Ambiguous identity must always reach a person.
flowchart LR
LIS[[Simulated LIS]] -- "ORU^R01 / MLLP :7011" --> S[LIS.ORU.In
HL7 TCP service]
HIS[[Simulated HIS]] -- "ADT, ORM / MLLP :7010" --> H[HIS.ADT.In] --> REG[HISRegistry
process]
S --> R[LabResultRouter
business process]
R -- "exception" --> O[ExceptionInvestigator
operation] --> A{{AI Hub agent
%AI.Agent + 6 read-only tools}}
A -- "JSON recommendation" --> P[Policy gate]
P --> EMR[EMR.ClinicalReceiver]
P --> Q[Quarantine]
P --> X[LIS reject ACK]
P --> W[Workflow Engine
manual review] -- "reviewer decision" --> P
P --> RQ[(Retry queue)] --> RS[RetryScheduler
custom inbound adapter] --> R
LIS.ORU.In (EnsLib HL7 TCP service) ACKs the message and passes it to CareBridge.LabResultRouter. The router stores the original as an immutable record with a correlation id.CareBridge.ExceptionInvestigator business operation runs the %AI.Agent of the same name. The agent gets a sanitised case (no names, no result values, no free text) and six read-only tools: LookupPatient, LookupOrder, OrdersForPatient, MessageHistory, DuplicateStatus and ValidationFindings. It returns a strict JSON recommendation, and AI Hub audit and authorization policies record or deny every tool call.CareBridge.Engine.PolicyGate checks the contract, that the evidence was actually observed, which actions are permitted for this exception type, identity rules, the retry budget and duplicate delivery. Every rule result is stored. The agent is never allowed to ACCEPT a result with an open exception. Invalid output, a timeout or a provider error falls back to manual review.Why separate AI from enforcement? The agent is good at gathering context and choosing among options, but its output is untrusted text. The gate is small, deterministic, unit-tested and authoritative, so the set of possible actions doesn’t depend on the model.
Details: architecture · the agent · observability · security · design decisions
You need Docker. The AI Hub image isn’t on any public registry: download it with your InterSystems login, and don’t push it (or images built from it) anywhere.
git clone https://github.com/shaileshvats/carebridge-ai && cd carebridge-ai1. From https://evaluation.intersystems.com/Eval/early-access/AIHub download
irishealth_arm64-community-2027.1.0AI.109.0-docker.tar.gz (Apple Silicon / ARM64, tested)
irishealth-community-2027.1.0AI.109.0-docker.tar.gz (x86-64, untested)
then load and tag it:
scripts/load-image.sh ~/Downloads/irishealth_arm64-community-2027.1.0AI.109.0-docker.tar.gz
2. Build and start (REPLAY mode: no API key needed)
docker compose up -d --build scripts/wait-ready.sh
Then open:
Full instructions, including manual load/retag, IPM install and reset: https://github.com/shaileshvats/carebridge-ai/blob/main/docs/installation.md.
| REPLAY (default) | LIVE | |
|---|---|---|
| Production, tools, contract validator, policy gate, Workflow, retries | Real | Real |
| Agent reply | Scripted fixture, hand-written, including adversarial ones | Real model through the AI Hub agent |
| Needs | Nothing | A model endpoint or key in .env |
| Shown as | REPLAY badge, and Mode=REPLAY on every agent run |
LIVE badge, with provider and model on every run |
LIVE with a free local model (the tested configuration). Install LM Studio, download and load qwen/qwen3-4b-2507 (Qwen3-4B-Instruct-2507), and start its local server on port 1234 (or run lms server start). Then:
cat > .env <<'EOF'
CAREBRIDGE_AGENT_MODE=LIVE
CAREBRIDGE_LLM_PROVIDER=openai
CAREBRIDGE_LLM_BASE_URL=http://host.docker.internal:1234/v1
CAREBRIDGE_LLM_MODEL=qwen/qwen3-4b-2507
EOF
docker compose up -d && scripts/wait-ready.sh
LIVE with a hosted provider (untested here). Set CAREBRIDGE_LLM_PROVIDER (openai, anthropic, gemini, …), CAREBRIDGE_LLM_MODEL and the provider’s key variable (OPENAI_API_KEY, ANTHROPIC_API_KEY or GEMINI_API_KEY) in .env. .env is git-ignored, and the API never returns keys.
The agent sees identifiers, codes and findings only. See what is sent to a model.
scripts/run-tests.sh --all # 37 unit + 8 integration tests through the running production
scripts/demo.sh # all 11 scenarios
scripts/qc.sh --live # full release check: clean rebuild, tests, scenarios, restart, live run
The adversarial scenarios cover prompt injection in an NTE segment, a “model” that tries merge_patient_records, malformed output and a persistent outage. In every one, nothing unsafe is executed.
In an interoperability-enabled namespace on an AI Hub build:
zpm "install carebridge-ai" // once the package is published on the community registry
do ##class(CareBridge.Setup.Installer).StartProduction()
The manifest declares <SystemRequirements Version=">=2026.3" Interoperability="enabled"/>. scripts/ipm-check.sh installs the module into a bare AI Hub container with no CareBridge build. On build 109, IPM 0.10.10 refused it in a namespace without interoperability, and in an interoperability namespace it compiled, started the production and routed messages (evidence). The Docker build installs from this repository the same way, with zpm "load".
Copyright (C) 2026 Shailesh Vats. Licensed under the GNU Affero General Public License v3.0 only (https://github.com/shaileshvats/carebridge-ai/blob/main/LICENSE). Like any open-source licence, the AGPL allows commercial use and resale. Its condition is that anyone who distributes a modified version, or runs it as a network service, must make their source available under the same licence. InterSystems IRIS and AI Hub are separate proprietary products and are not covered. See https://github.com/shaileshvats/carebridge-ai/blob/main/THIRD_PARTY_NOTICES.md.
The code was written with an AI coding assistant (Claude Code).