How a recipe works
A recipe pairs schema tools with a system prompt, and your application carries out what the agent asks for.- Schema tools define what the agent can emit. Each is your own tool defined by a JSON Schema (
type: object,additionalProperties: false), attached to the agent as aschema-type connector. Itstransitionfield is the agent’s exit state:input_requiredwhen the agent yields to wait on the client or clinician, orcompletewhen it is done. The framework enforces both the schema and thetransition. The connector type is defined once in Connectors, and each recipe page builds the concrete connector bodies you attach. - The system prompt shapes the flow: when the agent uses each tool, and how. The agent classifies the request, chooses the tool, fills the schema, and yields. Most of it lives in the system prompt, and each tool’s
descriptioncarries the rules for that tool. - Your application is the client. It owns state and persistence, and it runs the apply-step: fetching the EHR data the agent asks for, applying records, and placing orders. Each recipe page shows the apply-step for its flow. Nothing is saved until the clinician confirms.
The seam: the agent proposes, the client persists, and nothing is saved until the clinician confirms (the dotted green edge)
Build or adapt a recipe
To adapt a recipe, change the schema, its descriptions, and the client’s apply-step to match the EHR you integrate with. The steps use Extract and write to EHR as the running example.Scope the task
Name what starts the task, what the agent does, the result you expect, and the tools it needs. If one of the recipes under What you can build matches, start from it. For extract: a clinician states a clinical fact, the agent turns it into a coded record suggestion, and the tools are one schema tool per clinical family, starting with
extract_allergy, plus the coding-expert registry connector.Write the system prompt
The schema tools define what the agent can emit. The system prompt defines how it behaves as the clinician asks for things: which tool fits which request, when to yield, and when to answer. The
systemPrompt is yours: it depends on what your system exposes, and it moves as your flows settle. Each recipe page carries a minimal prompt that routes requests to its tools, so build the agent for one task first, then add nuance once you see where your agent actually goes wrong. For extract, the prompt routes each stated fact to its family’s tool. For more on the systemPrompt field, see Create and configure an agent.Some rules hold in every flow, because they are what the agent is for. Add them to each recipe’s minimal prompt, either together in one block or next to the routing and flow rules they govern. Either way, state them as plainly as any other instruction:- “One tool call per turn. Never two.”
- “After requested data arrives, do not request it again in that same turn.”
- “Say only what a tool returned. Never fill a gap.”
- “Nothing is saved until the clinician confirms. Never report a record as saved.”
Start from the schema
Copy the connector body from the recipe that matches your task, listed under What you can build. For extract, that is the
extract_allergy body. Build a schema tool explains each field.Map the vocabulary to your EHR
Swap enums for your system’s codes. Use your categories, note types, observation types, and code systems.
additionalProperties: false means what is not in the schema cannot be emitted, so the schema is the complete menu of what the agent may produce.Tune the description
The tool’s rules, when to use it, the confirmation seam, and one-action-per-call live in prose in the
description, not in code. The LLM reads that string. Edit it to match how your clinicians speak and which domains your EHR exposes.Attach it to your agent
Include the object inline in the agent’s
connectors array at creation time, as shown in Create and configure an agent, or POST it to the connector sub-resource, as shown in Manage connectors. Attach any coding or knowledge registry connectors the recipe needs in the same array: the extract recipe uses coding-expert for coded concepts (allergy, diagnosis, observation, …), documented in Medical Coding.Own the apply-step on the client
The agent emits. The client persists. For extract, the client completes the confirmed record and sends it to your write API. For retrieve, it resolves the request against your EHR’s read API and returns the records as a new message on the same
contextId, carrying a data part (see Send a message to an agent). A task in input_required is not finished: the new message resumes it, as described in Task lifecycle. For order, it resolves the catalog search and places the confirmed order through your order system. For form-fill, it merges the patch into your local form state. Nothing is saved until the clinician confirms.What you can build
Each schema-tool recipe builds a task and adds schema syntax that the recipes before it did not need. The recipes are not the only schema tools you can build: any tool your agent needs is defined the same way.Based on FHIR R4
The schema tools use resource names, field names, and codes from FHIR R4, a widely used standard for health records. The agent fills the clinical content. Your application adds the rest of the record, such as the patient reference, before it saves anything.Combine agents
The composition: an orchestrator agent coordinates sub-agents through structured output contracts, and the output is pending clinician confirmation (the dotted green edge)
- Differential diagnosis: one agent takes the history, one proposes hypotheses, and one weighs them against the literature with the
pubmed-expertregistry connector. The clinician confirms the working diagnosis. - Triage: one agent rates urgency, one codes the presenting complaint with
coding-expert, and the clinician approves before the case is routed. - Medication review: one agent gathers the current medications from the EHR, one checks interactions and dosing with
drugbank-expertorposos-expert, and one drafts recommendations for the clinician. - Pre-visit intake: one agent interviews the patient with
interviewing-expert, one fills the intake form with the form-fill tool, and one codes the reason for the visit.
Registry connectors
Recipes compose with registry connectors: pre-built integrations for coding, knowledge, and intake. The extract recipe attaches thecoding-expert registry connector alongside its schema connector to resolve concepts to codes, documented in Medical Coding. Browse the full catalog at Registry connectors.
What changes, what doesn’t
Changes per system:- The schema’s enums and field vocabulary.
- The
descriptionprose. - The client’s apply-step, and the read and write API calls behind each data part.
- The set of available domains and note types.
- The connector body shape.
- The shape of the agent’s
systemPrompt: the rules every flow shares and the per-flow minimums stay, the wording is yours. - The
additionalProperties: falsecontract. - The transitions.
- The seam: the agent proposes, and nothing is saved until the clinician confirms.
- The connector model.