Installation
Install the ScaleAI React SDK from AWS CodeArtifact and configure your package manager.
The ScaleAI React SDK is published as @scalereal/sr-voice-engine-react-sdk in a private AWS CodeArtifact npm repository. Ask your ScaleAI administrator for the CodeArtifact domain, repository, AWS account ID, and region, and for AWS credentials with read access to the repository.
Requirements
- React 18 or 19 in a client-rendered web application. In Next.js, the SDK must render inside a Client Component.
- The AWS CLI v2, configured with an AWS identity that can read from the CodeArtifact repository and obtain an authorization token. With npm 10 or later, AWS CLI 2.9.5 or later is required by
aws codeartifact login. - The CodeArtifact domain, repository, AWS account ID, and region provided by your ScaleAI administrator. Omit
--domain-ownerif your AWS identity belongs to the domain-owning account. - A ScaleAI project ID and SecretKey — you'll need these in the Quick Start.
Authenticate with CodeArtifact
Sign in to AWS using your organization's approved method (for example, an AWS CLI profile or SSO session). Then run the CodeArtifact login command, replacing the placeholders with the values provided by your administrator:
aws codeartifact login \
--tool npm \
--domain <domain> \
--domain-owner <aws-account-id> \
--repository <repository> \
--region <region>This obtains a short-lived authorization token and configures your user-level npm settings. The token is valid for 12 hours by default; run the login command again when it expires. Avoid committing generated credentials or tokens to your project.
The login command configures the default npm registry. If your project needs the public npm registry for other packages, configure CodeArtifact as a scope registry in .npmrc instead, using the repository endpoint and a token obtained through your approved AWS authentication flow. The CodeArtifact endpoint must end with /.
For Yarn Berry (v2+), use the CodeArtifact endpoint and a refreshed authorization token in .yarnrc.yml according to AWS's Yarn configuration. Yarn Classic can use the npm configuration written by aws codeartifact login.
In CI/CD, authenticate the job to AWS with your organization's approved role or federated identity, then run aws codeartifact login before installing dependencies. Do not store a CodeArtifact authorization token as a long-lived secret; it expires and must be refreshed.
Install the package
After authenticating, run the install command for your package manager:
pnpm add @scalereal/sr-voice-engine-react-sdkImport the stylesheet
When using any SDK UI component, import the stylesheet once from your application's entry point:
import "@scalereal/sr-voice-engine-react-sdk/css";Headless hooks do not require the stylesheet. The SDK CSS is scoped to its own components and will not bleed into your application's styles. See Components and styling for theming and class overrides.
Package entry points
Choose the most specific entry point for your use case to keep your bundle lean.
| Import | Use when |
|---|---|
@scalereal/sr-voice-engine-react-sdk | Core entry point — CallingAgentProvider, useCallingAgent, CallingAgentError, config, typed models, custom-attribute filters, and CSV/PDF/formatting helpers. No stylesheet. |
@scalereal/sr-voice-engine-react-sdk/ui | Apps that render SDK components. Import the /css stylesheet once alongside it. |
@scalereal/sr-voice-engine-react-sdk/hooks | Headless integration — data, realtime, and behavior hooks plus query keys. No stylesheet and no audio player. |
@scalereal/sr-voice-engine-react-sdk/types | Type-only domain models with zero runtime code. |
@scalereal/sr-voice-engine-react-sdk/css | Stylesheet import. Must be imported in your entry file, not inside a component. |
Troubleshooting
401 Unauthorized during install
A 401 error means the registry could not authenticate your AWS identity. Check the following:
- Your AWS CLI session or profile is active and uses the expected account and region.
- Your AWS identity has permission to read from the CodeArtifact repository and obtain an authorization token.
- The authorization token has not expired. Run
aws codeartifact loginagain to refresh it. - The login command uses the correct CodeArtifact domain, repository, domain owner, and region.
Package not found
Confirm that the SDK package has been published to the repository you authenticated against and that the repository is configured to serve the @scalereal namespace. Ask your ScaleAI administrator to verify the package and your repository read permissions.
Next steps
Continue with the Quick Start to render a call history list in Vite or Next.js.