Skip to main content
@eka-care/medassist-core is the foundation the embed and React widgets are built on. It manages the session, real-time connection, message transport, tool calls, and audio — and leaves the entire UI to you. Reach for it when you want a fully bespoke chat experience.
If you want a ready-made UI, use the React SDK or embed widget instead. The core SDK is for building your own.

Install

npm install @eka-care/medassist-core

The lifecycle

1

Instantiate

Create a SynapseSDK with your agentId and options.
2

Start a session

startSession() connects and returns the session info (including any initial message).
3

Listen for events

Subscribe with on() to receive streamed message chunks, tool calls, and errors.
4

Send messages

Call sendMessage() to send text, files, audio, or tool results.
5

End the session

endSession() closes the connection and cleans up.

End-to-end example

import { SynapseSDK, SYNAPSE_REALTIME_EVENTS } from "@eka-care/medassist-core";

// 1. Instantiate
const sdk = new SynapseSDK({
  agentId: "YOUR_AGENT_ID",
  environment: "production",
  context: {
    profile: { name: "John Doe", age: 30, gender: "M" },
  },
  callbacks: {
    onError: (error) => console.error("SDK error:", error),
    onSessionRefreshed: (session) => console.log("refreshed:", session.session_id),
  },
});

// 2. Start the session
const session = await sdk.startSession();
console.log("connected:", session.session_id);

// 3. Listen for events
sdk.on(SYNAPSE_REALTIME_EVENTS.MESSAGE_CHUNK, (evt) => {
  process.stdout.write(evt.data.text ?? "");
});
sdk.on(SYNAPSE_REALTIME_EVENTS.END_OF_STREAM, () => console.log("\n--- done ---"));
sdk.on(SYNAPSE_REALTIME_EVENTS.ERROR, (err) => console.error("stream error:", err));

// 4. Send a message
await sdk.sendMessage({ message: "I have chest pain" });

// 5. End when finished
// sdk.endSession();

Constructor options

new SynapseSDK(config) accepts:
agentId
string
required
Your MedAssist agent identifier.
environment
"development" | "staging" | "production"
default:"production"
Which backend to connect to.
userId
string
Optional user identifier.
connectionType
ConnectionType
default:"ConnectionType.SSE"
ConnectionType.SSE or ConnectionType.SOCKET.
context
TContext
User context — profile, intent, user_location, referer, and any custom keys. See the API reference.
overrides
SynapseSDKOverrides
UI/behavior overrides — prompt, firstMessage, language, primaryColor.
callbacks
SynapseSDKCallbacks
onSessionRefreshed and onError callbacks.
auth
string
Optional auth header.
authToken
string
Optional auth token.
serverUrl
string
Optional custom server URL.

Next steps

Events

Subscribe to streamed messages, tips, and lifecycle events.

Tool calls & elicitation

Render the inputs the agent asks for and reply with results.

Voice & audio

Record audio and run voice-mode conversations.

API reference

Every method, type, and enum.