Skip to main content
The EHR Agent analyzes comprehensive electronic health records — labs, conditions, medications, imaging, genetics, and vital signs — to deliver evidence-based insights for both patients and clinicians.

When to Use

EHR Agent

Best for:
  • Comprehensive health analysis
  • Multi-system assessment
  • Complex cases with imaging/genetics
  • Pre-visit preparation
Input: Full EHR data bundle

Lab Results Agent

Best for:
  • Lab result interpretation
  • Post-visit lab review
  • Routine monitoring analysis
  • Direct lab-to-patient communication
Input: Lab results + optional patient context

Endpoint

POST https://api.heliosai.health/api/v1/agent

Agent Modes

The EHR Agent supports two modes:
ModeProcessing TimeCostBest For
Light5-8 minutes$0.65Routine health summaries, standard cases
Deep10-13 minutes$3.50Complex cases, multi-step literature research
Deep Agent runs include researchTasks in the response — an array of the specific research queries executed during the multi-step literature review. Light Agent responses do not include this field.

Request Format

{
  "webhookUrl": "https://your-server.com/webhook/helios",
  "agentType": "light",
  "data": {
    "patientInfo": {
      "age": 45,
      "gender": "male"
    },
    "recentAbnormalLabs": [
      {
        "date": "2025-01-15",
        "display": "Hemoglobin A1c",
        "value": "7.2",
        "unit": "%",
        "referenceRange": "4.0-5.6",
        "interpretation": "High"
      }
    ],
    "recentNormalLabs": [
      {
        "date": "2025-01-15",
        "display": "Sodium",
        "value": "140",
        "unit": "mEq/L",
        "referenceRange": "136-145"
      }
    ],
    "pastMedicalHistory": [
      {
        "display": "Type 2 Diabetes Mellitus",
        "clinicalStatus": "active",
        "onsetDate": "2020-03-15"
      }
    ],
    "medications": [
      {
        "medication": "Metformin 500mg",
        "status": "active",
        "dosage": "500mg",
        "frequency": "twice daily"
      }
    ],
    "vitalSigns": [
      {
        "display": "Blood Pressure",
        "value": "138/88",
        "unit": "mmHg",
        "date": "2025-01-15"
      }
    ]
  }
}

Required Fields

FieldTypeDescription
webhookUrlstringHTTPS URL to receive results
agentTypestring"light" or "deep"
dataobjectHealth data to analyze

Health Data Fields

All fields in data are optional, but you should provide at least some health information for meaningful analysis:
FieldTypeDescription
patientInfoobjectAge, gender (no PHI — see below)
recentAbnormalLabsarrayAbnormal lab results
recentNormalLabsarrayNormal lab results
labTrendsarrayHistorical lab values over time
pastMedicalHistoryarrayConditions and diagnoses
medicationsarrayCurrent and recent medications
familyHistoryarrayFamily medical history
imagingStudiesarrayImaging reports and findings
geneticDataarrayGenetic test results
vitalSignsarrayRecent vital sign measurements
additionalContextstringFree-text clinical notes
userInstructionsstringCustom instructions for the analysis

Patient Info

FieldTypeDescription
agenumberPatient age (de-identified, no DOB)
genderstring"male", "female", "other", or "unknown"
No PHI allowed in patientInfo. Do not include name, date of birth, address, or any other personally identifiable information. Only de-identified demographic data (age, gender) is accepted.

Lab Result Fields

Used for both recentAbnormalLabs and recentNormalLabs:
FieldTypeRequiredDescription
displaystringYesLab test name (e.g., “Hemoglobin A1c”)
valuestringYesResult value (e.g., “7.2”)
unitstringYesUnit of measurement (e.g., ”%”, “mg/dL”)
datestringNoDate of test (ISO 8601). Strongly recommended
referenceRangestringNoNormal range (e.g., “4.0-5.6”)
interpretationstringNoAbnormality flag (e.g., “High”, “Low”, “Normal”)
idstringNoUnique identifier
codestringNoLOINC or other standard code
Track how a lab value has changed over time:
FieldTypeRequiredDescription
codestringYesStandard code for the lab test
displaystringYesLab test name
valuesarrayYesArray of historical values
values[].datestringYesDate of measurement
values[].valuestringYesResult value
values[].unitstringYesUnit of measurement
values[].interpretationstringNoAbnormality flag

Condition Fields

FieldTypeRequiredDescription
displaystringYesCondition name (e.g., “Type 2 Diabetes Mellitus”)
clinicalStatusstringYes"active", "inactive", "resolved", etc.
onsetDatestringNoWhen the condition started
recordedDatestringNoWhen the condition was recorded
verificationStatusstringNo"confirmed", "provisional", etc.
idstringNoUnique identifier
codestringNoICD-10 or SNOMED code

Medication Fields

FieldTypeRequiredDescription
medicationstringYesMedication name and strength
statusstringYes"active", "completed", "stopped"
dosagestringNoDosage amount
frequencystringNoHow often taken
startDatestringNoWhen the medication was started
endDatestringNoWhen the medication was stopped
sourcestringNo"statement" or "request"
idstringNoUnique identifier

Family History Fields

FieldTypeRequiredDescription
relationshipstringYesRelationship (e.g., “Father”, “Mother”)
conditionstringYesCondition name
onsetAgestringNoAge at onset
idstringNoUnique identifier

Imaging Study Fields

FieldTypeRequiredDescription
typestringYesStudy type (e.g., “CT Scan”, “MRI”)
descriptionstringYesDescription of the study
datestringNoDate of study. Strongly recommended
modalitystringNoImaging modality
findingsstringNoRadiology findings
conclusionstringNoRadiologist’s conclusion
reportTextstringNoFull report text
idstringNoUnique identifier

Genetic Data Fields

FieldTypeRequiredDescription
geneCodestringYesGene code (e.g., “BRCA1”)
geneDisplaystringYesGene display name
interpretationstringYesResult interpretation
valuestringNoRaw value
methodstringNoTesting method
datestringNoDate of test
idstringNoUnique identifier

Vital Sign Fields

FieldTypeRequiredDescription
displaystringYesVital sign name (e.g., “Blood Pressure”, “Heart Rate”)
valuestringYesMeasurement value
unitstringYesUnit (e.g., “mmHg”, “bpm”)
datestringNoDate of measurement
referenceRangestringNoNormal range
interpretationstringNoAbnormality flag
idstringNoUnique identifier

Element Limits & Sorting

To ensure optimal analysis quality and prevent context overflow, the API applies limits to each data category. Elements are sorted by date (most recent first) before limits are applied.
CategoryMax ElementsDate FieldDate Importance
Abnormal Labs50dateExpected — labs almost always have dates
Normal Labs15dateExpected — labs almost always have dates
Conditions100onsetDate or recordedDateRecommended
Medications30startDateRecommended
Family History15N/AN/A (no dates)
Imaging Studies15dateExpected — imaging always has dates
Genetic DataNo limitdateRecommended
Vital SignsNo limitdateRecommended
Dates are critical for accurate analysis. The API sorts data by recency to prioritize the most recent findings. Without dates:
  • Lab results may be analyzed in the wrong order, potentially missing critical recent changes
  • Older, less relevant data may be included instead of recent findings
  • Trend analysis and temporal reasoning will be impaired
While dates are technically optional (per FHIR), lab results and imaging studies should always include dates in practice. Data without dates will be deprioritized during element limiting.

Error Responses

400 Bad Request — Validation Error

{
  "error": "Validation error",
  "details": [
    { "path": "webhookUrl", "message": "Invalid URL format" }
  ]
}

401 Unauthorized

{
  "error": "Unauthorized",
  "message": "Invalid or missing API key"
}

429 Too Many Requests

Returned when your company has reached its concurrent request limit. Includes a Retry-After header.
{
  "error": "Too many concurrent requests",
  "message": "You have 7 active light agent requests. Maximum is 7.",
  "activeCount": 7,
  "limit": 7
}

500 Internal Server Error

{
  "error": "Internal server error",
  "message": "An unexpected error occurred"
}

Response Format

Immediate Response (200 OK)

{
  "runId": "550e8400-e29b-41d4-a716-446655440000",
  "status": "accepted",
  "message": "Request accepted. Results will be delivered to your webhook."
}

Response Headers

HeaderDescriptionExample
X-Concurrent-LimitMaximum concurrent requests for this agent type7
X-Concurrent-ActiveActive requests (including this one)3
X-Concurrent-RemainingAvailable slots4

Webhook Delivery

Results are delivered to your webhook URL (5-8 min for Light, 10-13 min for Deep): Light Agent response:
{
  "runId": "550e8400-e29b-41d4-a716-446655440000",
  "status": "completed",
  "agent": "light",
  "timestamp": "2025-01-15T12:01:30.000Z",
  "sequenceNumber": 7,
  "result": {
    "selectedElements": [
      {
        "item": "Hemoglobin A1c",
        "category": "Laboratory Value",
        "patient_value": "7.2%",
        "matching_reason": "Elevated HbA1c indicates suboptimal glycemic control"
      }
    ],
    "patientResponse": "Your recent lab results show that your HbA1c level is 7.2%...",
    "clinicianResponse": "The patient presents with elevated HbA1c (7.2%) indicating suboptimal glycemic control...",
    "citations": {
      "patient": {
        "1": {
          "url": "https://pubmed.ncbi.nlm.nih.gov/12345678/",
          "title": "Glycemic Control in Type 2 Diabetes",
          "metadata": { "type": "pubmed" }
        }
      },
      "clinician": {
        "1": {
          "url": "https://pubmed.ncbi.nlm.nih.gov/87654321/",
          "title": "ADA Standards of Care 2025",
          "metadata": { "type": "pubmed" }
        }
      }
    }
  }
}
Deep Agent response (includes researchTasks):
{
  "runId": "550e8400-e29b-41d4-a716-446655440000",
  "status": "completed",
  "agent": "deep",
  "timestamp": "2025-01-15T12:15:30.000Z",
  "sequenceNumber": 9,
  "result": {
    "selectedElements": [ ... ],
    "patientResponse": "Your recent lab results show...",
    "clinicianResponse": "The patient presents with...",
    "researchTasks": [
      "Research current ADA guidelines for glycemic control in Type 2 Diabetes",
      "Investigate SGLT2 inhibitor cardiovascular benefits in patients with CKD",
      "Analyze optimal statin therapy for diabetic patients with elevated LDL"
    ],
    "citations": {
      "patient": { "1": { "url": "...", "title": "...", "metadata": { "type": "pubmed" } } },
      "clinician": { "1": { "url": "...", "title": "...", "metadata": { "type": "pubmed" } } }
    }
  }
}

Result Fields

FieldDescription
selectedElementsHealth elements selected for analysis (see below)
patientResponsePatient-friendly summary in Markdown
clinicianResponseClinical report with citations in Markdown
citationsCitation metadata for both responses
researchTasksResearch queries executed (Deep Agent only)

Selected Elements

The selectedElements array contains the health data elements that the AI identified as most clinically relevant:
FieldDescription
ehr_element_idUnique ID (e.g., “Lab 1”, “Condition 3”)
ehr_element_descriptionHuman-readable description
categoryElement category (Laboratory Value, Diagnosed Disease, etc.)
patient_valueThe patient’s actual value or status
relevanceWhy this element was selected
matching_reasonWhy this element is clinically interesting

Processing Steps

Status update webhooks are sent during processing: Light Agent Steps:
StepName
1Processing started
2Analyzing health data
3Selecting relevant elements
4Researching medical literature
5Generating patient response
6Generating clinician response
7Finalizing results
8Delivering final results
Deep Agent Steps:
StepNameDescription
1Processing startedRequest received and validated
2Analyzing health dataExtracting insights from EHR data
3Selecting relevant elementsAI selecting important health elements
4Routing to Deep AgentHanding off to research agent
5Starting research tasksBeginning parallel literature research
6Research completeAll research tasks finished
7Generating responsesCreating clinician and patient reports
8Finalizing resultsPreparing final output
For Deep Agent, steps 1-4 are sent by the initial API server. Steps 5-8 and the final result are sent by the Deep Agent research processor. This architecture allows the Deep Agent to run for up to 16 minutes without timeout constraints.

Example Requests

curl -X POST https://api.heliosai.health/api/v1/agent \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "webhookUrl": "https://your-server.com/webhook/helios",
    "agentType": "light",
    "data": {
      "patientInfo": {
        "age": 45,
        "gender": "male"
      },
      "recentAbnormalLabs": [
        {
          "date": "2025-01-15",
          "display": "Hemoglobin A1c",
          "value": "7.2",
          "unit": "%",
          "referenceRange": "4.0-5.6",
          "interpretation": "High"
        }
      ],
      "pastMedicalHistory": [
        {
          "display": "Type 2 Diabetes Mellitus",
          "clinicalStatus": "active",
          "onsetDate": "2020-03-15"
        }
      ],
      "medications": [
        {
          "medication": "Metformin 500mg",
          "status": "active",
          "dosage": "500mg",
          "frequency": "twice daily"
        }
      ],
      "vitalSigns": [
        {
          "display": "Blood Pressure",
          "value": "138/88",
          "unit": "mmHg",
          "date": "2025-01-15"
        }
      ]
    }
  }'

Pricing

ModeCost
Light$0.65 per request
Deep$3.50 per request

Next Steps