Healthcare AI Learning
Course overview

Builder lab · Module 4 · 55 min

Build a Healthcare Agent

Compose instruction, tools, explicit state, limits and stop conditions into a bounded loop — then diagnose a runaway trace and fix it in policy rather than in prompt wording.

After this module you can

Compose an instruction, a minimal tool set, explicit state, hard limits and stop conditions into a bounded agent loop — then read its trace, diagnose a runaway loop and fix it by changing policy rather than prompt wording.

  • Say precisely what a loop adds over a single call, and what it costs.
  • Write an agent goal narrow enough to have a terminal state.
  • Choose the smallest tool set that can reach that goal.
  • Name the state an agent must carry between iterations.
  • Set step budgets, retry limits and stop conditions that make termination guaranteed.
  • Diagnose a non-terminating trace and fix it in the loop policy.

Module 3 validated one proposed call. An agent proposes many, in sequence, on the basis of what earlier calls returned. Nothing about that changes who authorises a write.

Step 1

One-shot call vs a bounded loop

Same synthetic workflow, two architectures. Only one of them can act on what it learns.

Everything here is simulated. The follow-up coordinator, its patient and every tool result are synthetic fixtures. The loop is a pure function over your configuration — the same settings always produce the same trace.

Goal + instructionPLANCALL TOOLOBSERVEDECIDESTOP
The agent loop and the controls around itA goal enters a repeating cycle of reason and decide, act, observe, and update state, which feeds back into reason and decide. Each pass ends at an exit check with three labelled outcomes: continue, escalate to a human, or stop. The cycle sits inside three nested boundaries: permissions and tools, policy, guardrails and human oversight, and an outer trace and observability layer.Trace & observability — every step recordedPolicy & guardrails · human oversightPermissions & toolsGoalReason / decideChoose the next stepActCall a permitted toolObserveRead the resultUpdate stateRecord what changedrepeats until an exitExit check ContinueConditions still met — loop a… EscalateHand to a named human StopBudget, time or policy limit …Continue → back into reason / decide
one-shot
# One call, one output
request  → LLM → structured follow-up plan (text/JSON)
result   : a proposal. Nothing is read, nothing is written.
failure  : the model guesses facts it was never given.
bounded loop
# Bounded loop, several calls
PLAN     → "I need the patient's current medicines before proposing a review date"
CALL     → get_patient_summary(SYN-004821)
OBSERVE  → { current_medicines: [...], last_consultation: "2026-09-04" }
DECIDE   → enough information? yes → propose the write
CALL     → create_follow_up_task(...)   [gated]
STOP     → goal_complete | approval_required | budget_exhausted | error

Select every true statement (3 or more, no wrong picks).

Select at least 3 true statements, with no incorrect picks.

Lab progress

0 of 7 steps complete

Sources & evidence · 4 sources

This module cites public or consensus guidance, scholarly literature, vendor documentation.

Content reviewed: September 2026. Publication dates of the individual sources are shown in each citation.

  • OpenAI — Function calling guide

    The provider-level mechanics the loop wraps: proposal, execution, result, next turn.

    Open source
  • Anthropic — Building effective agents

    Argues for the smallest viable composition of workflow and agent patterns, which is the position taken in this lab.

    Open source
  • Xinzhe Li. A Review of Prominent Paradigms for LLM-Based Agents: Tool Use, Planning (Including RAG), and Feedback Learning. Proceedings of COLING 2025, pages 9760–9779.

    Independent, peer-reviewed survey of tool-use, planning and feedback-learning paradigms — the non-vendor grounding for the agent-loop patterns described here. It does not establish that any one pattern is universally best.

    Open source
  • NIST AI Risk Management Framework — Generative AI Profile

    Human oversight and bounded autonomy for consequential actions.

    Open source