Skip to main content

Quickstart Guide

Get up and running with the Moss SDK in just a few minutes. This guide will walk you through the essential steps to install the SDK and render the assistant in your application.

1. Install the SDK

Choose your preferred installation method:
<!-- Replace YOUR_APP_ID with your actual Application ID -->
<script src="https://cdn.moss.ai/moss-sdk@latest?applicationId=YOUR_APP_ID"></script>
See the CDN Installation Guide for complete setup instructions.

Option B: NPM Installation (For React Apps)

npm install @principles-first/moss-sdk
This package is hosted privately on GitHub. See the NPM Installation Guide for authentication setup.

2. Setup (NPM Installation Only)

If you used CDN installation, skip this step. The SDK is automatically configured and ready to use.
The AgentProvider is the heart of the SDK. It manages state, provides context to all other components, and renders the assistant UI. Wrap it around your application at a high level.
/src/App.tsx
import React from 'react';
import { AgentProvider, MossSDKConfig } from '@principles-first/moss-sdk';

// Define your SDK configuration
const sdkConfig: MossSDKConfig = {
  apiUrl: 'YOUR_BACKEND_API_URL',
  applicationName: 'YOUR_APP_NAME',
  userId: 'CURRENT_USER_ID',
};

function App() {
  return (
    // Wrap your application with AgentProvider
    <AgentProvider config={sdkConfig}>
      {/* Your application components */}
      <h1>My Application</h1>
      <p>Welcome! The Moss assistant is now available.</p>
    </AgentProvider>
  );
}

export default App;

3. Configuration

You must provide the apiUrl, applicationName, and userId in the config prop.
  • apiUrl: The URL of your Moss backend service.
  • applicationName: The unique name you registered for your application.
  • userId: A unique identifier for the current user.
That’s it! With these steps, the Moss SDK is now integrated. The floating action button will appear automatically, and users can begin interacting with the AI assistant. For more advanced customization and features, refer to the full SDK Reference.