Skip to Content
Overview

Loops docs

Run durable health agents and workflows with loops.

New here? Sign up  and have a branded health agent live in minutes. Getting started walks through it.

Durable workflows

Workflows that run for minutes or months and pick up where they left off. Each step.do is saved once it finishes, so a crash, deploy, or network blip never repeats work that already succeeded. Reach for a workflow loop when you need to:

  • Wait on people — send a scan link, then pause until the patient completes it, with a timeout if they don’t.
  • Call flaky systems safely — failed steps retry on their own, and completed steps are never re-run.
  • Chain many steps — scans, summaries, notifications, and API calls in one ordered, inspectable run.
  • See what happened — every step and log line is recorded for each run.

Durable workflows can be triggered by other workflows and agents.

A POST starts the run with a patient id and phone number. The run saves a scan link, pauses until the patient finishes or 30 minutes pass, then says the results are ready. A crash resumes at the next step. The event log records the scan and the notification.

Durable AI agents

Agents that stay in one conversation for days, weeks, or months. Each message runs one turn: the model sees the thread so far, may call tools, and the reply stays on the conversation. Reach for an agent loop when you need to:

  • Keep a thread — a concierge or intake chat that continues when the person comes back.
  • Call tools mid-conversation — a tool the model picks on that turn, such as booking a visit or starting a scan workflow.
  • Ask a specialist — a workflow can ask another agent in the project and get a typed answer back.
  • Continue after a crash — the conversation is stored, and a retried message gets the answer it already had instead of asking the model twice.
The patient says they have had chest pain since this morning. The agent wakes, reads that message, and spawns a subagent. The subagent says to get checked today. The reply says a scan link is on the way.

A health ecosystem

The agent keeps the conversation. The workflow does the work that has to wait. When the person needs that work, the agent starts the workflow from a tool, and the two run as one health ecosystem.

  • Talk to the agent — “I’ve had chest pain since this morning.” The agent wakes and answers in the thread.
  • Start the scan — the agent’s tool triggers the scan workflow with the patient id and phone number.
  • Let the workflow wait — it sends the scan link, pauses until the patient finishes or 30 minutes pass, then says the results are ready.
  • Stay in the thread — the same conversation is there when the person comes back.
The patient says they have had chest pain since this morning. The agent answers in the thread and starts the scan workflow with the patient id and phone number. The scan workflow sends a link, waits until the patient finishes or 30 minutes pass, then says the results are ready. The thread is still there when they return.
Last updated on