Source: gemeni
ClinicPulse AI is a smart clinic flow manager that coordinates patient intake, triage, and clinician briefing using a multi-agent architecture powered by Google's Agent Development Kit (ADK). The goal is to reduce bottlenecks in outpatient clinics by giving every care team member up-to-date context before a consultation begins.
Smaller clinics still rely on manual questioning, paper forms, and ad-hoc note taking. As a result:
- Patients repeat the same information multiple times.
- Staff lose precious minutes clarifying missing details.
- Clinicians only see partial context when they enter the exam room.
ClinicPulse AI orchestrates a multi-stage pipeline:
- Intake Agent – Collects demographics, chief complaints, and symptom duration. Uses a loop validator to ensure all mandatory fields are captured before handing off.
- Triage Agent – Prioritizes queues using guideline lookups (Google Search tool) and custom EHR tools to pull vitals/lab history.
- Lab Wait Agent – When diagnostics are pending, this loop agent pauses the workflow until lab data is provided, demonstrating long-running operations and resume support.
- Clinician Briefing Agent – Generates a concise patient dossier with recommended next steps, outstanding orders, and suggested follow-up questions.
Session memory keeps a shared patient dossier so every agent reads/writes from the same state. Observability hooks emit structured logs (think: patient_id, step, result) using clinicpulse.logging_utils for compliance audits.
- Multi-agent system: Sequential pipeline with loop agents for intake and triage validation.
- Tools: Combination of built-in Google Search, custom EHR lookup tool (mocked), and a code execution tool for quick vital-score computations.
- Sessions & Memory:
InMemorySessionServiceplus a simple embedded “Patient Memory Bank” file to simulate persistence across pauses. - Observability: Logging/tracing for agent handoffs; metrics for average loop retries.
- Long-running operations: Ability to pause when waiting for lab uploads and resume once data is available.
- Agent evaluation: Automated script that grades briefing quality using a rubric (clarity, completeness, safety flags).
- Deployment readiness: Instructions for running via
adk weblocally; optional Agent Engine/Cloud Run deployment notes for bonus points.
┌───────────────────────────────────────────┐
│ clinicpulse_ai (root) │
│ Orchestrator / entry Agent │
└───────────────────────────────────────────┘
│
│ user session
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ intake_loop (Loop Agent) │
│ │
│ ┌─────────────────────────────┐ ┌─────────────────────────────┐ │
│ │ intake_collector │ ───────► │ intake_validator │ │
│ │ - asks questions │ │ - checks dossier fields │ │
│ │ - updates patient dossier │ ◄─────── │ - returns missing items │ │
│ └─────────────────────────────┘ └─────────────────────────────┘ │
│ │
│ loop until: demographics + chief complaint + onset + severity complete │
└─────────────────────────────────────────────────────────────────────────────┘
│
│ dossier complete
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ triage_loop (Loop Agent) │
│ │
│ ┌─────────────────────────────┐ │
│ │ triage_coordinator │ │
│ │ - reads dossier │ │
│ │ - calls tools / validator │ │
│ └─────────────────────────────┘ │
│ │ ▲ │
│ │ calls │ feedback │
│ ▼ │ │
│ ┌───────────────────────────┐ │ │
│ │ triage_validator │ │ │
│ │ - checks safety & │──────────────┘ │
│ │ completeness │ loop until triage decision ok │
│ └───────────────────────────┘ │
│ │
│ External tools used by triage_coordinator: │
│ │
│ ┌────────────────────┐ ┌────────────────────┐ │
│ │ record_triage_ │ │ google_search │ │
│ │ decision │ │ - guideline lookup │ │
│ │ - log priority │ └────────────────────┘ │
│ └────────────────────┘ ▲ │
│ ▲ / │
│ │ calls / │
│ ▼ / │
│ ┌────────────────────────┐ / │
│ │ fetch_patient_records │◄─────────── │
│ │ - mocked EHR tool │ │
│ └────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
│
│ triage complete
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ clinician_briefing (Agent) │
│ │
│ - reads full patient dossier │
│ - synthesizes: │
│ • summary │
│ • problem list │
│ • suggested clinician questions │
│ • suggested next steps / orders │
│ │
│ Optional long-running wait: │
│ │
│ ┌──────────────────────────────┐ │
│ │ wait_for_lab_results │ │
│ │ - tool to simulate │ │
│ │ pause/resume on labs │ │
│ └──────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
Shared state is managed through ADK session services. Tools expose the following interfaces:
fetch_patient_records(patient_id)– mocked EHR dataset.record_triage_decision(patient_id, priority_level)– logs decision to state + external sink.wait_for_lab_results(patient_id)– demonstrates long-running operations by pausing/resuming agents.
clinicpulse_ai/
├── README.md
├── requirements.txt
├── clinicpulse/
│ ├── __init__.py
│ ├── agent.py
│ ├── config.py
│ ├── tools.py
│ ├── logging_utils.py
│ ├── agent_utils.py
│ ├── validation/
│ │ ├── __init__.py
│ │ └── checkers.py
│ └── sub_agents/
│ ├── __init__.py
│ ├── intake.py
│ ├── triage.py
│ ├── labs.py
│ └── briefing.py
├── eval/
│ ├── README.md
│ └── evaluate_briefing.py
├── tests/
│ ├── README.md
│ └── test_agent.py
└── diagrams/
└── architecture.png (placeholder)
Upcoming tasks:
- Populate
requirements.txtwith ADK + testing deps. - Implement config + tool stubs.
- Build sub-agent logic and validation loops.
- Add evaluation harness + documentation updates.
- Python 3.11+
- Access to Google ADK-compatible credentials (Vertex AI or AI Studio API key)
Install dependencies:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtCopy .env and populate the appropriate credentials:
cp .env .env.local # optionalSet GOOGLE_GENAI_USE_VERTEXAI=True with ADC or switch to AI Studio using GOOGLE_API_KEY.
- Configure credentials as above.
- Launch ADK web runner from the project root:
adk web- Interact with ClinicPulse AI through the UI or via the integration harness:
python -m tests.test_agentAfter generating a clinician briefing, point the rubric script at the Markdown file:
python -m eval.evaluate_briefing --file path/to/briefing.mdThe script outputs a JSON summary with structure, completeness, safety scores, and a total. Use it to gate submissions before sharing with clinicians.
- Logging – All tools and validation checkers log structured events through
clinicpulse.logging_utils. SetCLINICPULSE_LOG_LEVEL=DEBUG(environment variable) to increase verbosity while debugging conversations. - Long-running labs – When diagnostics are outstanding, trigger the
lab_wait_loop. It keeps the session alive but blocks progression untillab_resultsare written to state, effectively pausing the agent until the user supplies the necessary data. Thewait_for_lab_resultstool mirrors this behavior when called directly.
