Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.medera.info/llms.txt

Use this file to discover all available pages before exploring further.

The Care Orchestrator lives in AI Services (src/care_orchestrator/, 27 files) and exposes a REST surface under /api/care-orchestrator. It coordinates voice agents, workflow agents, an event bus, and a workflow state machine.

Voice agents (4)

AgentTypeNameVoice IDPurpose
INTAKEGraceElevenLabs 21m00Tcm4TlvDq8ikWAM (Rachel)Patient intake calls
CARE_COORDINATORAlexElevenLabs pNInz6obpgDQGcFmaJgB (Adam)Ongoing care, follow-ups
REFERRAL_SPECIALISTJordanElevenLabs EXAVITQu4vr4xnSDxMaL (Bella)Referral management
PA_SPECIALISTTaylorElevenLabs yoZ06aMxZJJ28mfd3POQ (Sam)Prior authorization
All voice agents use Deepgram nova-2-medical transcription, OpenAI gpt-4-turbo LLM (temperature 0.3, max 500 tokens), and ElevenLabs eleven_turbo_v2 synthesis. Default call settings: 15-minute max duration, 10 s silence timeout, recording enabled.

Workflow agents (6)

AgentType.PRIOR_AUTH, REFERRAL, PRESCRIPTION, LAB, CARE_PLAN, ESCALATION — these are backend agents that drive multi-step workflows without voice.

Endpoints

MethodPathPurpose
GET/api/care-orchestrator/healthHealth
GET/api/care-orchestrator/workflowsList workflows (filters: org, type, status, patient)
POST/api/care-orchestrator/workflowsCreate workflow
GET/api/care-orchestrator/workflows/{id}Get workflow
POST/api/care-orchestrator/workflows/{id}/transitionTrigger state transition
POST/api/care-orchestrator/workflows/{id}/cancelCancel workflow
GET/api/care-orchestrator/agentsList agents
GET/api/care-orchestrator/agents/{agent_type}Get agent
GET/api/care-orchestrator/agents/{agent_type}/statsAgent stats
POST/api/care-orchestrator/tasks/routeRoute task to agent
GET/api/care-orchestrator/tasksList tasks
GET/api/care-orchestrator/voice/agentsList voice agents
POST/api/care-orchestrator/voice/callsInitiate voice call
GET/api/care-orchestrator/voice/calls/{call_id}Call status
POST/api/care-orchestrator/voice/calls/{call_id}/transferTransfer call
POST/api/care-orchestrator/voice/calls/{call_id}/endEnd call
GET/api/care-orchestrator/voice/calls/{call_id}/transcriptGet transcript
GET/api/care-orchestrator/eventsList events
POST/api/care-orchestrator/eventsPublish event
GET/api/care-orchestrator/patients/{id}/eventsPatient events
GET/api/care-orchestrator/patients/{id}/workflowsPatient workflows
GET/api/care-orchestrator/analytics/summaryAnalytics

Workflow state machine

The state machine in src/care_orchestrator/workflow/state_machine.py defines 30+ states across Referral (18 states), Prescription (14 states), Lab (15 states), and Care Plan (10 states), plus generic states: DRAFT, INITIATED, PENDING, IN_PROGRESS, WAITING, COMPLETED, FAILED, CANCELLED, EXPIRED. Transitions carry from_state, to_state, event, optional guard function, optional action function, timeout, escalation_state, and priority.

Event bus

Categories and selected event types from src/care_orchestrator/events/event_types.py:
CategorySample events
IntakeINTAKE_INITIATED, INTAKE_CALL_STARTED, INTAKE_IDENTITY_VERIFIED, INTAKE_RED_FLAG_DETECTED, INTAKE_BEHAVIORAL_HEALTH_DETECTED, INTAKE_COMPLETED
PAPA_INITIATED, PA_CRITERIA_EVALUATED, PA_DOCUMENTS_GENERATED, PA_SUBMITTED, PA_APPROVED, PA_DENIED, PA_APPEAL_INITIATED, PA_P2P_SCHEDULED, PA_UNITS_EXPIRING
ReferralREFERRAL_INITIATED, REFERRAL_SPECIALTY_IDENTIFIED, REFERRAL_PA_REQUIRED, REFERRAL_SUBMITTED, REFERRAL_APPOINTMENT_SCHEDULED, REFERRAL_CLOSED
PrescriptionPRESCRIPTION_INITIATED, PRESCRIPTION_INTERACTION_WARNING, PRESCRIPTION_PA_REQUIRED, PRESCRIPTION_APPROVED, PRESCRIPTION_DISPENSED
LabLAB_ORDER_INITIATED, LAB_SPECIMEN_COLLECTED, LAB_RESULTS_AVAILABLE, LAB_ABNORMAL_REVIEW, LAB_CRITICAL_ALERT