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.
For a complete runnable project with explicit setup, result verification, failure handling, and cleanup, start with First Verified Conversation. The examples below are an operation catalog.
Prerequisites
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!,
baseUrl: process.env.AMIGO_BASE_URL!,
})Set AMIGO_BASE_URL=https://platform.api-us.concurrence.com for US production, or use your assigned regional Platform origin. Configure identity token helpers separately as described in SDK Configuration.
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
Choose a configured test service explicitly. Later examples use this service for simulations and conversations, so inspect its data and integration permissions before continuing:
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
The following example is for a trusted Node.js client connecting to the workspace-scoped session endpoint. The SDK helper supplies the authentication subprotocol rather than putting the key in the URL. For a browser application, follow Serve an Agent From a Web App and its scoped access flow; keep the workspace key in your backend.
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
Error Handling. Handle errors and edge cases.
Agents. Deep dive into agent management.
Simulation Coverage. Full simulation coverage reference.
Analytics & Observability. Call analytics and quality metrics.
Last updated
Was this helpful?

