Skip to main content
Prescribing takes four calls, and each one’s output feeds the next. All four accept an optional debug object (see Errors and tracing).

rx_intake

Finds or adds the patient, and records what’s known about them. Call it before drafting, and call it again with the patientId whenever something safety-relevant comes up, such as a new allergy. The call returns patientResolution.status: It also returns the patientRecord as saved, with its allergies and medications. Finds what to prescribe. It doesn’t need a patient. It searches your organization’s templates first, then catalog medications, then the wider drug database. Each item in options[] has:
  • title and summary to show the clinician
  • treatment, a draft-ready object with treatmentId and any sig and dispense fields the template fills in. Pass it to rx_draft unchanged.
  • draftRequirements, which says whether the option can be drafted as is (complete) or needs_provider_details, and lists the missingFields

rx_draft

Drafts one unsigned prescription and screens it. Nothing is sent. dispenseUnit is one of Tablet, Capsule, Milliliter, Gram, Each, Patch, Pen Needle, Kit and others. The tool schema lists all of them, and matching ignores case. The response has: Show the prescriber the review fields, alerts and coverage. To send it from Prescribe instead, hand over the patientId and prescriptionId. See Agent-drafted orders.

rx_send

Sends reviewed drafts as one order, after the prescriber explicitly confirms. It needs a prescriber’s token. A machine token, or a patient’s, can’t send.
Photon checks that the digest and fields match what was drafted, so the prescriber sends exactly what they reviewed. It rejects blocked drafts and drafts already sent. The response has the orderId, the order’s state, and a status of sent or failed for each prescription. The agent only acts for the prescriber and is never the prescriber of record.

Errors and tracing

A tool that can’t do what was asked returns an error instead of guessing:
Follow userAction: it tells the agent what to ask or send next. Every response includes debug.correlationId. Pass it back in debug.correlationId on later calls in the same conversation, so Photon can trace the session. It’s for tracing only, and it never stands in for a patientId. debug also takes source, model, client and requestId.