@frigade/assist-api
Frigade Assist API: add product answers and live, on-page guidance to your own AI agent.
Install
npm install @frigade/assist-api
Requires react and react-dom 18-19 as peer dependencies.
Usage
import * as FrigadeAssistAPI from '@frigade/assist-api';
FrigadeAssistAPI.init({
apiKey: 'YOUR_FRIGADE_PUBLIC_API_KEY',
apiUrl: 'https://api.frigade.ai',
userId: 'user-123',
});
Call it once, in the browser, after your app loads. Then launch a guide from your agent:
const result = await FrigadeAssistAPI.query({
intent: 'Invite a teammate',
});
Or pass a Vercel AI SDK tool call straight through (returns null if the tool call isn't Frigade's):
const result = await FrigadeAssistAPI.handleToolCall(toolCall);
result.status is one of started, answer, needs_clarification, cancelled, unavailable, or error. Calls made before init resolve unavailable with reason not-initialized; calls made while init is still loading wait for it.
Dismiss the running guide:
FrigadeAssistAPI.close();
A query() still in flight resolves cancelled, as it does when the user closes the guide card. Before init, or with no guide running, close() does nothing.
Events
const unsubscribe = FrigadeAssistAPI.on('complete', () => {
console.log('Guide completed');
});
unsubscribe();
Handlers can be registered before or after init. off(event, handler) also removes a handler. See the EventType type for all events.
Options
| Option | Type | Description |
|---|---|---|
apiKey | string | Required. Your Frigade public API key. |
apiUrl | string | Required. Frigade API URL. |
userId | string | ID of the signed-in user. |
userProperties | Record<string, unknown> | Extra properties about the user. |
assistantId | string | Scope requests to a specific assistant. |
locale | string | Force the UI language (e.g. 'es-MX'). Defaults to browser. |
See the FrigadeAssistAPIConfig type for the full list.
License
See LICENSE.