hand-waveQuickstart

List agents, inspect a service, and run a voice simulation. Your first Platform SDK calls.

This guide walks through your first three Platform SDK calls: listing agents, fetching a service, and running a voice simulation session step by step.

Prerequisites

circle-info

Before You Begin

  1. Installed the SDK in your project.

  2. Configured your credentials with a valid API key and workspace ID.

Initialize the Client

import 'dotenv/config'
import { AmigoClient } from '@amigo-ai/platform-sdk'

const client = new AmigoClient({
  apiKey: process.env.AMIGO_API_KEY!,
  workspaceId: process.env.AMIGO_WORKSPACE_ID!,
})

Example 1: List Agents

Fetch all agents in your workspace:

Retrieve a specific agent's version to see its full configuration:

Example 2: Inspect a Service

List services and inspect the voice configuration of the first one:

Example 3: Run a Voice Simulation

Simulate a caller conversation to test your service behavior without making a real call:

Example 4: Pull Analytics

Check dashboard metrics for the last 7 days:

Example 5: Stream a Text Conversation Turn

Send a turn to a text conversation and render the agent's response token by token. The SDK negotiates Accept: text/event-stream on the REST turns endpoint and returns a ReadableStream<Uint8Array> that you parse with eventsource-parser. Every event is typed under the TurnStreamEvent discriminated union.

If the client disconnects mid-stream, the server still finishes the turn and persists the partial agent response. Resuming with client.conversations.get(conversation.id) returns the completed turn.

Example 6: Open a Public Text-Session WebSocket

For interactive UIs, connect a bidirectional WebSocket to the workspace-scoped session-connect endpoint. The SDK builds the URL and provides the auth subprotocol; the API key is delivered via the Sec-WebSocket-Protocol header so it never appears in URLs or proxy logs.

Available since @amigo-ai/[email protected]. Earlier versions expose only the legacy textStreamUrl() helper that targets /agent/text-stream with the same wire protocol.

Example 7: Look Up an Entity

Retrieve a patient or caller entity from the world model:

Full Quickstart Script

Here is a complete runnable script combining all examples above:

Next Steps

Last updated

Was this helpful?