Voice agent · Custom guide
Northsun + LiveKit
LiveKit Agents has no vendor-initiated webhook: a LiveKit Agent is a worker process that connects outward to the LiveKit server, and your own code is what calls Mnemix. This guide maps that worker-initiated pattern to Mnemix's frozen caller-memory API with plain fetch; it is a custom guide, not a native or certified adapter.
- What
- Mnemix is the memory and enrichment layer for AI agents. Governed context intelligence is the differentiator.
- Who
- For teams building voice, chat, coding, and workflow agents that need persistent, inspectable context.
- Price
- Hobby is $0. Paid access is Contact sales.
- How
- Use the frozen caller REST contract for recall, durable call write-back, and read-only caller lookup. Use authenticated MCP only for the broader beta context tools enabled and proven for your tenant.
- For agents
- On an inbound call your voice agent receives the caller profile, this tenant's prior-call memory, and available Trestle and Twilio Lookup enrichment as contextual evidence before its first sentence; after hangup the call is submitted and committed durably before the response returns, visible on the very next read.
What Northsun adds to LiveKit
- A caller-memory lookup you control. Your worker code decides when to call Mnemix after ctx.waitForParticipant() — there is no webhook to configure on LiveKit's side.
- Direction-safe identity as a documented pattern. LiveKit's sip.phoneNumber attribute names the customer the same way on inbound and outbound calls; sip.trunkPhoneNumber never does.
- A proofable boundary. A successful recording proves the exact worker configuration shown; it does not establish a native LiveKit feature.
How to connect LiveKit to Northsun
- 1
Resolve the caller's phone number
Read sip.phoneNumber off the connected participant's attributes after ctx.waitForParticipant(); treat a missing or malformed value as unresolved, not as an unknown caller.
- 2
Recall before the agent's instructions are set
Call POST /v1/recall_and_enrich and use the response to shape the instructions you pass to voice.Agent.
- 3
Write back from the shutdown callback
Register ctx.addShutdownCallback() and call POST /v1/calls/end with the session's transcript and outcome after the room disconnects.
- 4
Prove the write-back
The interaction is committed durably before calls/end responds; retain the Mnemix trace ID and confirm it with a later recall.
Custom HTTP pattern
Adapt this boundary to the current vendor payload and verify it with controlled events before production.
async function callMnemix(path: string, body: unknown) {
const response = await fetch(`https://mcp.mnemix.ai${path}`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MNEMIX_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
if (!response.ok) {
throw new Error(`Mnemix request failed: ${response.status}`);
}
return response.status === 204 ? undefined : response.json();
}
// Inside your agent's entry function, after ctx.connect() + ctx.waitForParticipant():
// LiveKit's SIP participant attributes name the customer's number the same way
// in both call directions — see the LiveKit kit docs for the direction-safety detail.
const phoneNumber = participant.attributes["sip.phoneNumber"];
const packet = phoneNumber
? await callMnemix("/v1/recall_and_enrich", {
phone_number: phoneNumber,
trigger: "answered",
session_id: ctx.room.name,
})
: null;
const instructions = packet
? buildYourOwnInstructions(packet)
: "Greet the caller and ask how you can help.";
// From ctx.addShutdownCallback(), after the session ends:
await callMnemix("/v1/calls/end", {
phone_number: phoneNumber,
session_id: ctx.room.name,
duration_s: durationSeconds,
outcome: mappedOutcome,
});FAQ
- Is this a native LiveKit integration?
- No. It is a custom guide for calling Mnemix's frozen REST endpoints from your own LiveKit Agents worker code.
- Why is there no webhook step?
- LiveKit Agents has no vendor-initiated webhook for this lifecycle — a LiveKit Agent worker connects outward to LiveKit, so your own code is always what calls Mnemix.
- Does sip.phoneNumber need a direction check?
- No — unlike some platforms' From/To fields, sip.phoneNumber names the customer's number in both inbound and outbound calls. sip.trunkPhoneNumber is always your own number, in either direction.
Last updated: .