
Initial Release
Agentic AI for Healthcare using InterSystems IRIS for Health + CrewAI
This is a reference demo showing how event-driven, explainable, auditable Agentic AI can be applied to real healthcare workflows.
When an abnormal laboratory result is received (FHIR Observation), an automated multi-agent workflow:
This is not a chatbot. This is event-driven, explainable, auditable Agentic AI for healthcare.
Key steps:
For detailed architecture, design principles, and execution models, see https://github.com/intersystems-ib/iris-health-fhir-agentic-demo/blob/main/ARCHITECTURE.md.
Clone the repository and create a Python virtual environment:
git clone https://github.com/intersystems-ib/iris-health-fhir-agentic-demo cd iris-health-fhir-agentic-demoCreate and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activateInstall Python dependencies
pip install -r requirements.txt
Copy the example environment file and add your OpenAI API key:
cp .env.example .env
Edit .env and set your OPENAI_API_KEY:
OPENAI_API_KEY=your_openai_api_key_here OPENAI_MODEL=gpt-4o-miniIRIS_HOST=localhost
IRIS_PORT=1972
IRIS_NAMESPACE=INTEROP
IRIS_USERNAME=superuser
IRIS_PASSWORD=SYS
EMBEDDING_MODEL=my-openai-config
Build and run the IRIS container:
docker-compose build
docker-compose up -d
Create a FHIR R4 repository in IRIS using the Management Portal:
superuser / SYSINTEROPdemo/interop/fhir/r4clinicalai.fhirserver.InteractionsStrategy
Load the sample patient bundle (Jose Garcia) into the FHIR server.
Using curl
curl -X POST http://localhost:52773/interop/fhir/r4/ \
-u "superuser:SYS" \
-H "Content-Type: application/fhir+json" \
-d @iris/init/fhir/JoseGarcia.json | jq
Or using IRIS Management Portal:
This loads:
Navigate to IRIS SQL Explorer (System Explorer β SQL β INTEROP) and run the schema initialization:
LOAD SQL FROM FILE '/app/iris/init/schema.sql' DIALECT 'IRIS' DELIMITER ';'
This creates:
clinicalai_data.GuidelineChunks - Vector DB for clinical guidelinesclinicalai_data.Cases - AI evaluation resultsclinicalai_data.CaseRecommendations - Recommended actionsclinicalai_data.CaseEvidences - Evidence citationsCreate the IRIS EMBEDDING configuration for OpenAI:
INSERT INTO %Embedding.Config (Name, Configuration, EmbeddingClass, VectorLength, Description)
VALUES (
'my-openai-config',
'{"apiKey":"your-openai-api-key-here", "sslConfig": "llm_ssl", "modelName": "text-embedding-3-small"}',
'%Embedding.OpenAI',
1536,
'OpenAI text-embedding-3-small for clinical guidelines'
)
Important: Replace your-openai-api-key-here with your actual OpenAI API key.
Run the ingestion script to embed clinical guidelines into the vector database:
python iris/vector/ingest_guidelines.py
This script:
iris/vector/guidelines/GuidelineChunks tableEMBEDDING() functionNote: Add your own clinical guideline documents (.txt, .md, .markdown) to iris/vector/guidelines/ before running the script.
First, start the CrewAI FastAPI service that will be called by the IRIS Business Operation:
./run_api.sh
The service will start on http://localhost:8000. You should see output indicating the server is running.
Note: Keep this terminal running. Open a new terminal for the next steps.
Launch the interactive web interface:
python run_ui.py
Then open your browser to http://localhost:7860
The UI provides an intuitive interface to:
Note: The API service must be running (see previous step) for the UI to work.
Recommended: Use VS Code REST Client
Open https://github.com/intersystems-ib/iris-health-fhir-agentic-demo/blob/main/samples/demo.http in VS Code and execute the βPOST new observationβ request. This will POST an abnormal lab result that triggers the AI workflow.
Alternative: Using curl
curl -X POST http://localhost:52773/interop/fhir/r4/Observation \
-u "superuser:SYS" \
-H "Content-Type: application/fhir+json" \
-d '{
"resourceType": "Observation",
"status": "final",
"category": [{"coding": [{"code": "laboratory"}]}],
"code": {
"coding": [{"system": "http://loinc.org", "code": "2160-0"}],
"text": "Serum creatinine"
},
"subject": {"reference": "Patient/1"},
"effectiveDateTime": "2026-01-08T10:00:00Z",
"valueQuantity": {"value": 2.1, "unit": "mg/dL"},
"interpretation": [{"coding": [{"code": "H"}]}]
}' | jq
This will automatically:
Interoperability Production Messages:
View message trace in IRIS Management Portal:
For detailed project structure and architecture, see https://github.com/intersystems-ib/iris-health-fhir-agentic-demo/blob/main/ARCHITECTURE.md.
SQL Query Results:
-- View all AI evaluation cases (latest first)
-- Shows: Patient, Observation, Risk Level, Confidence, Reasoning Summary
SELECT * FROM clinicalai_data.Cases ORDER BY CreatedAt DESC
-- View all recommendations generated by the AI
-- Shows: Action Type, Action Description, Timeframe
SELECT * FROM clinicalai_data.CaseRecommendations
-- View all clinical evidence used (explainability)
-- Shows: Guideline citations, similarity scores, text excerpts
SELECT * FROM clinicalai_data.CaseEvidences
FHIR DiagnosticReport:
Use https://github.com/intersystems-ib/iris-health-fhir-agentic-demo/blob/main/samples/demo.http or curl:
curl -u "superuser:SYS" \
"http://localhost:52773/interop/fhir/r4/DiagnosticReport?subject=Patient/1" | jq
Every recommendation includes:
superuserSYSINTEROPhttp://localhost:52773/interop/fhir/r4superuser:SYS)Use https://github.com/intersystems-ib/iris-health-fhir-agentic-demo/blob/main/samples/demo.http for demo requests or https://github.com/intersystems-ib/iris-health-fhir-agentic-demo/blob/main/samples/fhir.http for comprehensive FHIR testing. Alternatively, use curl:
# Get all patients curl -u "superuser:SYS" http://localhost:52773/interop/fhir/r4/Patient | jqGet specific observation
curl -u "superuser:SYS" http://localhost:52773/interop/fhir/r4/Observation/1 | jq
This is a reference demo. Contributions that maintain simplicity and explainability are welcome.
Guidelines:
MIT License - See LICENSE file for details
Inspired by the InterSystems customer-support-agent-demo.