Developer SDKs & Integrations
ByteEngine makes it simple for developers to interact with healthcare data, orchestrate AI agents, and automate workflows — using the tools and languages they already know.
Overview
ByteEngine provides an official JavaScript SDK, REST APIs, and integration interfaces that let you build, extend, and automate healthcare solutions — from AI-powered EHR extensions to standalone clinical assistants.
The SDK abstracts away complex FHIR and AI orchestration logic, allowing you to focus on your application logic while ByteEngine handles compliance, data, and context.
1. Available SDK
| SDK | Language | Use Cases |
|---|---|---|
| JavaScript / TypeScript | Node.js, Next.js, React, Electron | Web apps, dashboards, AI-driven clinical interfaces |
The JavaScript SDK is open source and available at github.com/byteengine/sdk.
2. Getting Started with the JavaScript SDK
Installation
npm install @boolbyte/engine
Initialize the Client
import { EngineClient } from "@boolbyte/engine";
const client = new EngineClient({
apiKey: process.env.BYTEENGINE_API_KEY,
baseUrl: "https://api.engine.boolbyte.com"
});
List Available Resources
const stores = await client.dataStore.listFhirStores();
console.log(stores);
Create a FHIR Patient Resource
await client.dataStore.initializeFhirStoreClient('your-server-id');
const fhirClient = client.dataStore.getFhirStoreClient();
await fhirClient.create({
resource: {
resourceType: "Patient",
name: [{ given: ["John"], family: "Doe" }],
gender: "male",
birthDate: "1990-04-01"
}
});
Trigger a Workflow
await client.workflow.execute('triage-intake', {
input: { patientId: "123" }
});
3. REST API Reference
If you prefer raw HTTP calls or use a language without an official SDK, ByteEngine exposes a comprehensive REST API with predictable, resource-based endpoints.
Example: List FHIR Stores
curl -X GET "https://api.engine.boolbyte.com/api/fhirserver/list" \
-H "Authorization: Bearer $BYTEENGINE_API_KEY"
Example: Create a Session (then run a task)
curl -X POST "https://api.engine.boolbyte.com/api/sessions" \
-H "Authorization: Bearer $BYTEENGINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"workerId": "triage-agent",
"metadata": {"context": "patient triage"}
}'
For full reference, see the ByteEngine REST API Docs →
4. Integrating with SMART on FHIR
ByteEngine supports SMART on FHIR for secure app authorization within EHR environments like Epic, Cerner, and OpenMRS.
App Registration Flow
- Register your SMART app in the ByteEngine console
- Configure redirect URIs and scopes (launch, patient/*.read, etc)
- Obtain a client_id and client_secret
- Use standard OAuth 2.0 + OpenID Connect flow for authentication
GET https://auth.engine.boolbyte.com/authorize?
response_type=code&
client_id=YOUR_CLIENT_ID&
redirect_uri=https://yourapp.com/callback&
scope=launch%20patient/*.read
Exchange Code for Token
curl -X POST https://auth.engine.boolbyte.com/token \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET" \
-d "grant_type=authorization_code" \
-d "code=AUTH_CODE"
Use the resulting token to call the ByteEngine FHIR APIs securely within clinical environments.
5. Webhooks & Event Integrations
You can subscribe to events from ByteEngine resources (FHIR, Workers, Workflows) using webhooks.
Example: Trigger on New Patient Creation
curl -X POST https://api.engine.boolbyte.com/api/webhooks \
-H "Authorization: Bearer $BYTEENGINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"event": "fhir.Patient.created",
"target_url": "https://my-service.health/webhooks/fhir"
}'
Example Payload
{
"event": "fhir.Patient.created",
"resource": "Patient/123",
"timestamp": "2024-01-16T21:12:00.000Z"
}
Common events:
fhir.*.created/fhir.*.updatedworkflow.completedworker.errorpipeline.ingested
6. Integration Examples
a. Connecting to an External EMR
Use pipelines to mirror patient data between your EMR and ByteEngine's FHIR store. E.g., a hospital can synchronize patient data nightly, trigger analysis, and send insights back.
// Create a pipeline to sync EMR data
const pipeline = await client.pipeline.createPipeline({
name: 'emr-sync-pipeline',
source: {
type: 'mysql',
uri: 'mysql://emr_user:password@emr-db:3306/patient_records'
},
mode: 'ai_mapping',
fhirVersion: 'R4'
});
// Schedule nightly sync
const workflow = await client.workflow.createWorkflow({
name: 'nightly-emr-sync',
trigger: {
type: 'schedule',
cron: '0 2 * * *' // 2 AM daily
},
steps: [
{
id: 'sync-data',
type: 'pipeline',
pipeline: pipeline.data.id,
action: 'sync'
}
]
});
b. Embedding AI into a Clinical Dashboard
Create a ByteEngine Worker that performs triage, then call it from a React frontend using the SDK.
// React component example
import { EngineClient } from '@boolbyte/engine';
const TriageDashboard = () => {
const client = new EngineClient({ apiKey: process.env.REACT_APP_BYTEENGINE_API_KEY });
const analyzeSymptoms = async (symptoms) => {
const session = await client.session.createSession({
workerId: 'triage-agent',
metadata: { context: 'dashboard triage' }
});
const task = await client.task.createTask(session.data.id, {
instructions: `Analyze these symptoms and provide triage recommendations: ${symptoms}`,
model: 'medgemma-27b'
});
return task.data;
};
return (
<div>
{/* Dashboard UI */}
</div>
);
};
c. Automated Lab Notifications
Subscribe to new lab results, run a pipeline that normalizes data, and trigger a workflow to alert clinicians via Slack.
# Lab notification workflow
workflow:
id: lab-notification-workflow
trigger:
type: fhir
event: "Observation.create"
filter: "category=laboratory"
steps:
- id: analyze-result
type: worker
worker: lab-analyzer
model: medgemma-27b
input: "{{trigger.resource}}"
- id: check-abnormal
type: condition
condition: "{{steps.analyze-result.output.isAbnormal}}"
if_true:
- type: notify
channel: slack
message: "Abnormal lab result for {{trigger.resource.subject}}"
- type: fhir.create
resourceType: Communication
data:
status: in-progress
subject: "{{trigger.resource.subject}}"
payload:
contentString: "Abnormal lab result requires attention"
7. Extending ByteEngine
Developers can extend ByteEngine using:
- Custom Workers: Write and deploy your own AI agents
- Custom Tools: Add domain-specific tool functions (e.g., EHR search, medication lookup)
- Plugin System (coming soon): Build reusable integrations for the Workflow Builder
Example: A hospital might deploy a "ClinicalSummarizer" worker that summarizes patient history and sends it to the attending doctor before each visit.
// Custom clinical summarizer worker
const summarizerWorker = await client.worker.createWorker({
name: 'clinical-summarizer',
description: 'Summarizes patient history for attending physicians',
defaultModelName: 'medgemma-27b',
instructions: 'You are a clinical AI assistant that creates concise, accurate summaries of patient history and current status for attending physicians.',
toolConfigs: {
tools: [
{
toolName: 'fhir_access',
config: { serverId: 'main-fhir-server' }
}
]
}
});
8. SDK Architecture Diagram
Flow: [Your App] → [ByteEngine SDK] → [API Gateway → FHIR / DICOM / Workers / Workflows / Pipelines] → [HealthDataStore + AI Engine]
9. Developer Tools
- ByteEngine CLI — for managing deployments, pipelines, and workflows
- ByteEngine Playground — web interface for testing API calls
- Postman Collection — ready-to-import for REST testing
- SDK Docs — complete language guides and code samples
10. Common Integration Patterns
| Integration | Description | Example |
|---|---|---|
| FHIR Sync | Keep EMR and ByteEngine data consistent | Sync via nightly cron + Pipelines |
| Realtime Alerts | Trigger actions on FHIR events | Subscription to Observation.created |
| AI Enhancement | Run diagnostic models on DICOM data | Worker + Model + Workflow |
| RAG Systems | Knowledge-based AI assistants | KnowledgeBase + Worker Context |
| FHIR Facades | Expose legacy DB as FHIR endpoint | Pipeline + AI Mapping |
Real-World Implementation Examples
Hospital EMR Integration
// Complete EMR integration example
const emrIntegration = {
// 1. Create FHIR server for hospital data
fhirServer: await client.dataStore.createFhirStore({
name: 'hospital-emr-fhir',
region: 'us',
fhirVersion: 'R4',
type: 'serverless'
}),
// 2. Create pipeline to sync EMR data
pipeline: await client.pipeline.createPipeline({
name: 'emr-sync-pipeline',
source: {
type: 'postgresql',
uri: process.env.EMR_DATABASE_URI
},
mode: 'ai_mapping',
fhirVersion: 'R4'
}),
// 3. Create AI worker for clinical analysis
worker: await client.worker.createWorker({
name: 'clinical-analyzer',
defaultModelName: 'medgemma-27b',
instructions: 'Analyze patient data and provide clinical insights',
toolConfigs: {
tools: [
{
toolName: 'fhir_access',
config: { serverId: 'hospital-emr-fhir' }
}
]
}
}),
// 4. Create workflow for automated analysis
workflow: await client.workflow.createWorkflow({
name: 'patient-analysis-workflow',
trigger: {
type: 'fhir',
event: 'Patient.update'
},
steps: [
{
id: 'analyze-patient',
type: 'worker',
worker: 'clinical-analyzer',
input: '{{trigger.resource}}'
}
]
})
};
Telehealth Platform Integration (JavaScript)
import { EngineClient } from '@boolbyte/engine';
const client = new EngineClient({ apiKey: 'YOUR_API_KEY' });
async function startConsultation(patientId) {
// Create session for consultation
const session = await client.session.createSession({
workerId: 'telehealth-assistant',
metadata: {
patientId,
consultationType: 'video_call'
}
});
// Initialize and read patient
await client.dataStore.initializeFhirStoreClient('your-server-id');
const fhirClient = client.dataStore.getFhirStoreClient();
const patient = await fhirClient.read({ resourceType: 'Patient', id: patientId });
return { session, patient };
}
async function analyzeSymptoms(sessionId, symptoms) {
// Run AI analysis
const task = await client.task.createTask(sessionId, {
instructions: `Analyze these symptoms and provide recommendations: ${symptoms}`,
model: 'medgemma-27b'
});
return task.data;
}
Next Steps
- View the REST API Reference - Complete API documentation
- Explore Example Projects on GitHub - Real-world implementations
- Learn to Build Custom Workers - Create specialized AI agents
- Integrate ByteEngine into Your EHR - Connect your existing systems
- Quick Start Guide - Get started with ByteEngine