Quickstart
Get started with the Omniagent API in minutes
This guide walks you through building and deploying your first Omniagent โ a single AI agent with consistent voice, personality, and knowledge, available on any channel.
Don't have an account yet? Create a resource in the Azure Portal first โ this sets up your subscription and gives you access to the dashboard.
Before you start, you'll need an API key. You can generate one from the dashboard โ see Authentication for details.
Your API key is a secret. Keep it private and only use it on the server side โ never expose it in client-side code.
Choose a companion
Start by choosing a companion โ the identity layer that defines your agent's appearance, personality, and behavior. Browse the catalog or create a custom one.
Browse the companion catalog (API reference):
curl -X GET https://companion-api.napster.com/public/companions/napster-stock \
-H "X-Api-Key: $NAPSTER_API_KEY"Or create a custom one (API reference):
curl -X POST https://companion-api.napster.com/public/companions \
-H "X-Api-Key: $NAPSTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"firstName": "Alex",
"lastName": "Chen",
"description": "A senior tech support specialist who has been helping customers for over a decade. Warm, patient, and detail-oriented. Explains technical concepts in plain language and always walks users through solutions step by step. Keeps a professional but approachable tone, occasionally uses light humor to put frustrated users at ease.",
"pictureUrl": "https://example.com/images/alex-avatar.png"
}'You can also equip your agent with tools and knowledge to expand what it can do and what it knows.
Create your Omniagent
Bring everything together into a persistent agent. This combines the companion, voice, tools, knowledge, and model settings into a single reusable resource (API reference):
curl -X POST https://companion-api.napster.com/public/agents \
-H "X-Api-Key: $NAPSTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"companionId": "comp_abc123",
"name": "Support Agent",
"voiceId": "alloy",
"functions": ["func_abc123", "func_def456"],
"providerSettings": {
"temperature": 0.7
}
}'The response returns an agent id that you use to deploy it to any channel.
Deploy to a channel
Create a WebRTC session from your Omniagent with a single call (API reference):
curl -X POST https://companion-api.napster.com/public/agents/agent_abc123/connections \
-H "X-Api-Key: $NAPSTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"channelType": "webrtc"
}'The response returns a token and a connection object with an id. Use the token to initialize the Web SDK and embed the agent directly in your application. Store the connection id on your backend to retrieve session details later, such as transcripts or duration.
Install the Web SDK:
npm install @touchcastllc/napster-companion-api @reduxjs/toolkitThen use it in your React app:
import React, { useEffect, useRef } from "react";
import { NapsterCompanionApiSdk } from "@touchcastllc/napster-companion-api";
import type { NapsterCompanionApiInstance } from "@touchcastllc/napster-companion-api";
import "@touchcastllc/napster-companion-api/styles";
export function CompanionWidget({ token }: { token: string }) {
const containerRef = useRef<HTMLDivElement>(null);
const instanceRef = useRef<NapsterCompanionApiInstance | null>(null);
useEffect(() => {
const initSDK = async () => {
if (!containerRef.current) return;
const result = await NapsterCompanionApiSdk.init(token, {
mountContainer: containerRef.current,
position: "bottom-right",
});
instanceRef.current = result;
};
initSDK();
return () => {
instanceRef.current?.destroy();
};
}, []);
return <div ref={containerRef} style={{ width: "100%", height: "100%" }} />;
}For examples in Vue, Angular, and vanilla JavaScript, see the WebRTC page. You can also deploy the same agent to WebSockets or SIP.
Monitor your agent
Once your agent is live, track how it's performing. Review analytics, browse conversation logs, and use those insights to refine your agent over time.