Guava Typescript SDK
This library allows you to build Guava voice agents using TypeScript or Javascript. Currently only NodeJS is officially supported as a runtime for the main SDK. The WebRTC portion of the SDK can be used from the browser.
Documentation
Full documentation for the TypeScript SDK can be found at https://goguava.ai/docs/. SDK examples can be found under ./examples/.
Authentication
Log in using the Guava CLI:
guava login
Alternatively, provide an API key through an environment variable.
$ export GUAVA_API_KEY="..." # Your API key for authentication.
$ export GUAVA_AGENT_NUMBER="..." # A phone number for your agent to use.
Try an Example
Run an outbound phone call example using npx. Replace the phone number with your own and your agent will call you.
$ npx @guava-ai/guava-sdk@latest scheduling-outbound phone +15556667777 # Your agent will call this number.
Installation
Install the SDK using your preferred package manager.
$ npm install @guava-ai/guava-sdk
$ yarn add @guava-ai/guava-sdk
$ pnpm add @guava-ai/guava-sdk
The SDK can be used with Javascript, but TypeScript is highly recommended.
Using WebRTC from the Browser
To call your agent from the browser with a bundler, install the SDK as above and import from @guava-ai/guava-sdk/webrtc.
import * as Guava from "@guava-ai/guava-sdk/webrtc";
const call = new Guava.Call({ webrtcCode: "..." });
await call.start();
You can also load a prebuilt bundle from a CDN.
<script
src="https://cdn.jsdelivr.net/npm/@guava-ai/[email protected]/dist/guava-webrtc.min.js"
integrity="sha384-CqOmyWgWQBezum+sb7uPDUvYIN4/0eKmWbgs/LEjsn+KmW8PoP9zwB1FVQR7v3c3"
crossorigin="anonymous"
></script>
<script>
const call = new Guava.Call({ webrtcCode: "..." });
call.start();
</script>
Or as an ES module:
<script type="importmap">
{
"integrity": {
"https://cdn.jsdelivr.net/npm/@guava-ai/[email protected]/dist/guava-webrtc.esm.min.js": "sha384-Lf/SBkHjXX4aPSR9S2XcqQXaI21CnugMUu7ROfHLJGnvtPMS0lFNuYTnUal6eAZ8"
}
}
</script>
<script type="module">
import * as Guava from "https://cdn.jsdelivr.net/npm/@guava-ai/[email protected]/dist/guava-webrtc.esm.min.js";
const call = new Guava.Call({ webrtcCode: "..." });
await call.start();
</script>
See the WebRTC calling guide for more details on how to create WebRTC agents with Guava.