Quick Start
Quick start guide on setting up the ScaleAI React SDK on your project.
In this guide, you'll connect a React app to your ScaleAI project and set up the provider that powers SDK hooks and components. You'll also render a ready-to-use component to confirm the integration is working; from there, use the SDK to build calling-agent workflows with typed data hooks and realtime updates.
Before you start, complete Installation and have your ScaleAI project ID and SecretKey ready.
Vite
1. Add your project credentials
Create .env.local in your Vite project root (git-ignored by default):
VITE_CA_PROJECT_ID=your-project-id
VITE_CA_SECRET_KEY=your-secret-keyRestart the dev server after editing .env.local — Vite does not hot-reload environment variables.
2. Import the SDK stylesheet
Add the SDK stylesheet to src/main.tsx before your own global styles so your styles can override SDK defaults:
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "@scalereal/sr-voice-engine-react-sdk/css";
import "./index.css";
import App from "./App.tsx";
createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>,
);3. Wrap your UI with the provider and render the list
CallingAgentProvider authenticates SDK requests and gives SDK hooks and components access to the SDK's built-in query client. You can use the SDK without configuring TanStack Query yourself. Replace src/App.tsx:
import { CallingAgentProvider } from "@scalereal/sr-voice-engine-react-sdk";
import { CallHistoryList } from "@scalereal/sr-voice-engine-react-sdk/ui";
export default function App() {
return (
<CallingAgentProvider
projectId={import.meta.env.VITE_CA_PROJECT_ID}
secretKey={import.meta.env.VITE_CA_SECRET_KEY}
>
<main>
<h1>Call history</h1>
<CallHistoryList />
</main>
</CallingAgentProvider>
);
}Start the dev server:
pnpm devNext.js
The SDK uses React hooks and browser APIs, so it must live inside a Client Component. Your App Router pages and layouts can remain Server Components.
1. Add your project credentials
Add these values to .env.local in your Next.js project root. The NEXT_PUBLIC_ prefix makes them available in Client Components:
NEXT_PUBLIC_CA_PROJECT_ID=your-project-id
NEXT_PUBLIC_CA_SECRET_KEY=your-secret-keyRestart the dev server after editing .env.local.
2. Import the SDK stylesheet
Import the SDK stylesheet from your root layout alongside your global stylesheet:
import "@scalereal/sr-voice-engine-react-sdk/css";
import "./globals.css";
import type { ReactNode } from "react";
export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}3. Create a Client Component
Create app/call-history.tsx. The "use client" directive marks this file as the Client Component boundary — everything it renders (including the SDK) runs in the browser:
"use client";
import { CallingAgentProvider } from "@scalereal/sr-voice-engine-react-sdk";
import { CallHistoryList } from "@scalereal/sr-voice-engine-react-sdk/ui";
export default function CallHistory() {
return (
<CallingAgentProvider
projectId={process.env.NEXT_PUBLIC_CA_PROJECT_ID!}
secretKey={process.env.NEXT_PUBLIC_CA_SECRET_KEY!}
>
<main>
<h1>Call history</h1>
<CallHistoryList />
</main>
</CallingAgentProvider>
);
}4. Render the component from your page
import CallHistory from "./call-history";
export default function Page() {
return <CallHistory />;
}Start the dev server:
pnpm devVerify the result
Open your app in a browser. You should see a paginated call history list with:
- Search — full-text filter across call records
- Status, direction, and date filters — refine results without page reloads
- Sortable columns — click any column header to sort ascending or descending
- Pagination — navigate large result sets
- CSV export — download the current filtered view
If the list is empty, confirm that the project ID and SecretKey match a project that has recorded calls.
If the provider cannot authenticate, it throws a CallingAgentError with code missing-config (empty credentials) or unauthorized (rejected SecretKey). Open the browser console for the error detail. See Provider for the full error reference.
Next steps
You're up and running. Here's where to go next:
- Provider — Understand
CallingAgentProviderprops, share a QueryClient with the rest of your app, and handle SDK errors. - Components — Customize SDK UI components and override styles.
- Call history hooks — Build a fully custom call history UI using the underlying data hooks.
- Installation — Review package entry points, CI/CD setup, and troubleshooting.