mcc-agrasya-sdk
v1.0.7
Published
A simple, secure SDK for integrated smart farming assistant with real-time Voice AI.
Downloads
1,140
Readme
# Agrasya Voice SDK (mcc-agrasya-sdk)
A simple, secure SDK for integrated smart farming assistant with real-time Voice AI.
Installation
npm install mcc-agrasya-sdkUsage
import { AgrasyaVoiceSDK } from "mcc-agrasya-sdk";
// Initialize the SDK
const sdk = new AgrasyaVoiceSDK({
apiKey: "your-api-key",
baseUrl: "https://api.agrasya.com",
language: "en",
debug: false,
});
// Start a voice session
await sdk.startVoiceSession("en");
// Handle events
const events = {
onStatusChange: (status) => console.log("Status:", status),
onTranscript: (data) => console.log("Transcript:", data.text),
};
const sdkWithEvents = new AgrasyaVoiceSDK({ apiKey: "your-api-key" }, events);
await sdkWithEvents.startVoiceSession("en");Methods
startVoiceSession(language: string)
Starts a voice session by establishing a connection with the backend and initializing WebRTC components.
async startVoiceSession(language: string): Promise<void>stopVoiceSession()
Stops the voice session, closes the WebRTC connection, and cleans up resources.
async stopVoiceSession(): Promise<void>fetchMinutesUsage()
Fetches the remaining minutes available for the current API key.
async fetchMinutesUsage(): Promise<number>Development
# Install dependencies
npm install
# Build the SDK
npm run build
# Watch mode
npm run dev
# Run tests
npm testPublishing
See PUBLISHING.md for instructions on publishing to npm.
License
© 2026 MacroCosmos Creations. All rights reserved.
