For the complete documentation index, see llms.txt. This page is also available as Markdown.

Quickstart

Common Platform SDK operations: agents, services, simulations, analytics, streaming, and entities.

This guide walks through common Platform SDK operations: listing agents, inspecting services, running voice simulations, pulling analytics, streaming conversation turns, opening a text-session WebSocket, and looking up entities.

Prerequisites

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 the first page of agents in your workspace:

List responses are paginated: they carry items, has_more, and a continuation_token. Use client.agents.listAutoPaging() to iterate across pages automatically.

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 call metrics for the last 7 days:

client.analytics.getDashboard({ days: 7 }) returns a composite dashboard object with top KPIs and period-over-period deltas; its shape is not statically typed, so inspect the JSON before wiring it into typed code. Other analytics helpers include getCallQuality, getEmotionTrends, getLatency, getToolPerformance, and getUsage.

Example 5: Stream a Text Conversation Turn

Send a turn to a text conversation and render the agent's response token by token. streamTurn targets the always-SSE turns endpoint (POST /turns/stream) and yields typed events from the TurnStreamEvent discriminated union (token, thinking, tool_call_started, tool_call_completed, message, done, error).

If you need the raw bytes instead, client.conversations.createTurnStream() returns the underlying ReadableStream<Uint8Array> of SSE frames. Turns are persisted on the conversation either way; fetch them later with client.conversations.get(conversation.id).

Example 6: Open a Public Text-Session WebSocket

For interactive UIs, connect a bidirectional WebSocket to the workspace-scoped session endpoint. The SDK provides the auth subprotocol helper, so the API key is delivered in Sec-WebSocket-Protocol rather than the URL.

Wait for each turn's done or error event before sending the next user_text. The endpoint reconnects by the workspace, service, and entity combination; a conversation_id in the WebSocket URL is ignored. See Sessions for all query parameters, frame shapes, timeouts, and close codes.

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 that combines the agent-list, service-inspection, and analytics examples:

Next Steps

Last updated

Was this helpful?