> ## Documentation Index
> Fetch the complete documentation index at: https://developer.eka.care/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Build a custom MedAssist UI on the raw Synapse core SDK

`@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.

> [!NOTE]
>
> If you want a ready-made UI, use the [React SDK](https://developer.eka.care/docs/agents/synapse/react/installation.md) or [embed widget](https://developer.eka.care/docs/agents/synapse/embed/quickstart.md) instead. The core SDK is for building your own.

## Install

```bash theme={null}
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

```ts theme={null}
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](https://developer.eka.care/docs/agents/synapse/core/api-reference.md#tcontext).

**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](https://developer.eka.care/docs/agents/synapse/core/events.md)**
>
> Subscribe to streamed messages, tips, and lifecycle events.

> **[Tool calls & elicitation](https://developer.eka.care/docs/agents/synapse/core/tool-calls.md)**
>
> Render the inputs the agent asks for and reply with results.

> **[Voice & audio](https://developer.eka.care/docs/agents/synapse/core/voice.md)**
>
> Record audio and run voice-mode conversations.

> **[API reference](https://developer.eka.care/docs/agents/synapse/core/api-reference.md)**
>
> Every method, type, and enum.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.