How Webhooks Work
When you submit a request to the Helios API:- You receive an immediate response with a
runId - Analysis runs in the background (5-8 minutes for Light Agent, 10-13 minutes for Deep Agent, 3-6 minutes for Lab Results Agent)
- Results are delivered to your
webhookUrlvia HTTP POST - Your endpoint should return
200 OKto acknowledge receipt
Webhook Headers
Every webhook includes these headers for security and tracking:| Header | Description | Example |
|---|---|---|
X-Helios-Signature | HMAC-SHA256 signature | sha256=a1b2c3... |
X-Helios-Timestamp | Unix timestamp (seconds) | 1705320000 |
X-Helios-Run-ID | Unique run identifier | 550e8400-e29b-... |
Content-Type | Always JSON | application/json |
Webhook Payloads
Success Payload (Light Agent)
When Light Agent analysis completes successfully:Success Payload (Deep Agent)
Deep Agent responses include additional research task information:Success Payload (Lab Results Agent)
Lab Results Agent responses include the analyzed labs and metadata:Lab Results Agent does not include
selectedElements since all provided labs are analyzed directly. Instead, it includes labResults (the labs that were analyzed) and metadata with processing statistics.Error Payload
When analysis fails:Status Update Payload
During processing, you receive status updates at each step:sequenceNumber field is a monotonically increasing number that allows you to order webhooks correctly. Webhooks may arrive out of order due to network conditions, but you can sort them by sequenceNumber to reconstruct the correct sequence. The timestamp field can also be used as a fallback for ordering.
Processing Steps
The following steps are sent during processing: Light Agent Steps:| Step | Name |
|---|---|
| 1 | Processing started |
| 2 | Analyzing health data |
| 3 | Selecting relevant elements |
| 4 | Researching medical literature |
| 5 | Generating patient response |
| 6 | Generating clinician response |
| 7 | Finalizing results |
| 8 | Delivering final results |
| Step | Name | Description |
|---|---|---|
| 1 | Processing started | Request received and validated |
| 2 | Analyzing health data | Extracting insights from EHR data |
| 3 | Selecting relevant elements | AI selecting important health elements |
| 4 | Routing to Deep Agent | Handing off to research agent |
| 5 | Starting research tasks | Beginning parallel literature research |
| 6 | Research complete | All research tasks finished |
| 7 | Generating responses | Creating clinician and patient reports |
| 8 | Finalizing results | Preparing final output |
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.
| Step | Name |
|---|---|
| 1 | Processing started |
| 2 | Analyzing lab results |
| 3 | Prioritizing findings |
| 4 | Generating search queries |
| 5 | Searching medical literature |
| 6 | Processing search results |
| 7 | Generating responses |
| 8 | Final webhook delivered |
Error Codes
| Code | Description |
|---|---|
VALIDATION_ERROR | Invalid request data |
AUTH_ERROR | Authentication failed |
RATE_LIMIT_ERROR | Too many requests |
CONCURRENCY_LIMIT_ERROR | Too many concurrent requests |
VERTEX_AI_ERROR | AI service error |
LITSENSE_ERROR | Literature search error |
EXA_ERROR | Research search error |
FIREBASE_ERROR | Deep Agent processing error |
ELEMENT_SELECTION_ERROR | Failed to select relevant health elements |
CLINICIAN_RESPONSE_ERROR | Failed to generate clinician response |
PATIENT_RESPONSE_ERROR | Failed to generate patient response |
TIMEOUT_ERROR | Analysis timed out |
INTERNAL_ERROR | Server error |
NO_DATA | Insufficient health data provided |
Signature Verification
Verification Steps
- Get the raw request body - Use the raw body string, not parsed JSON
- Check the timestamp - Reject webhooks older than 5 minutes
- Compute the expected signature -
sha256=HMAC-SHA256(webhook_secret, raw_body) - Compare signatures - Use timing-safe comparison
Implementation Examples
Retry Policy
Helios retries failed webhook deliveries with exponential backoff:| Attempt | Delay | Total Time |
|---|---|---|
| 1 | Immediate | 0s |
| 2 | 5 seconds | 5s |
| 3 | 15 seconds | 20s |
Best Practices
Return 200 quickly
Return 200 quickly
Process webhooks asynchronously. Return
200 OK immediately, then handle the data in a background job.Handle duplicates
Handle duplicates
In rare cases, you may receive the same webhook twice. Use the
runId to deduplicate:Order webhooks correctly
Order webhooks correctly
Webhooks may arrive out of order due to network conditions. Use the The
sequenceNumber field to sort them correctly:sequenceNumber starts at 1 and increments for each webhook sent during a run. The final completed or error webhook will have the highest sequenceNumber.Log webhook events
Log webhook events
Log all incoming webhooks for debugging and audit purposes. Store the
runId, status, and timestamp.Use HTTPS
Use HTTPS
Your webhook endpoint must use HTTPS in production. Self-signed certificates are not supported.
Getting Your Webhook Secret
Your webhook secret is used to verify webhook signatures and ensure requests are authentic. To generate your webhook secret:- Log in to your Helios Dashboard
- Go to Settings (API Keys page)
- In the Webhook Secret section, click Generate Secret
- Copy and securely store the secret—it will only be shown once