@aui.io/aui-client@^3) is a ground-up rewrite of v2 (^1.2.x):
tasks became threads, the single client split in two, and the agent now rides
your key. This page is the exact before/after for every call and response —
10 methods mapped, 2 removed, 1 changed meaning.
What changed at a glance
Two substitutions do most of the work: everytask_id becomes a thread_id,
and every client.controllerApi.X moves onto one of two new clients.
| Area | v2 | v3 |
|---|---|---|
| Core model | One Task holds the whole conversation | Thread → Interaction → Message |
| Client | One ApolloClient | ApolloMessagingClient + ApolloManagementClient |
| Surface | Everything under controllerApi.* | messaging, channels, threads, projects, agents, agentVersions |
| Auth | One networkApiKey | Publishable key (browser) + org API key (server) |
| Agent | Passed per call | Encoded in the key (REST); explicit on WebSocket |
| Environment | azure/gcp × v2/v3 URL matrix | Production default; optional baseUrl |
| Typing | Loose — as unknown as T | Fully typed Apollo.* responses |
Connecting & authentication
The single client was split by who may hold the credential. The messaging client is browser-safe; the management client is server-side only.v2 — one client, one key
v3 — two scoped clients
The publishable key authenticates for you. It is exchanged for a
short-lived bearer token automatically — you no longer set
x-network-api-key headers anywhere, including on the WebSocket. The
organization key is sent as x-organization-api-key and must never reach a
browser.What went away
Theazure/gcp × v2/v3 URL matrix is gone — both clients default to
production. Pass baseUrl only to target a different host. Per-call
timeoutInSeconds and retries moved from the constructor into each method’s
requestOptions (last argument); set a generous timeout on the aggregating
list endpoints, which can be slow.
Method map
Below,messaging is an ApolloMessagingClient and management is an
ApolloManagementClient. Messaging methods hang off the .messaging
sub-resource.
| v2 call | v3 call | Client |
|---|---|---|
createTask() | removed — threads auto-create | — |
listUserTasks() | threads.listThreads() | Management |
getTaskMessages() | threads.getThreadMessages() · messaging.listMessages() | Both |
sendMessage() | messaging.sendMessage() | Messaging |
startTextConversation() | channels.initiateThread() | Messaging |
getAgentContext() | meaning changed → see below | — |
getDirectFollowupSuggestions() | messaging.generateFollowupSuggestions() | Messaging |
getTraceInfo() | threads.getThreadTrace() · getInteractionTrace() | Both |
getProductMetadata() | removed — no replacement | — |
apolloWsSession.connect() | messaging.connect() | Messaging |
Method by method
Create Task — removed
There is no createTask. A thread is created the first time you talk to the
agent without a thread_id — capture it from the response.
v2
v3
List User Tasks — threads · management
The user filter moved into filters, and pagination is now cursor-based
(page[size] / page[after]) instead of page/size.
v2
v3
Get Task Messages — both clients
Same data, two entry points depending on which key you hold. Both return
Apollo.Message[].
v2
v3
Send Message (REST) — signature changed
user_id is now required. task_id → optional thread_id.
is_external_api and agent_id are gone (the agent rides the key). The
reply is now nested under .message.
v2
v3
Start Text Conversation — channels · messaging
channel is now positional, fields are snake_case, and message splits by
channel: SMS uses text; WhatsApp uses templates via agent_display_name.
v2
v3
Get Agent Context — meaning changed
v2 — agent config for a task
v3 — key scope (different!)
Follow-up Suggestions — signature changed
No longer keyed by a task id — you pass a context object. Returns an
object, not a bare string[]. (Threads and messages also carry
followup_suggestions inline, so you often need no separate call.)
v2
v3
Get Trace Info — both clients
Split into a whole-thread trace and a single-interaction trace.
interactionId is the successor to the old per-message id.
v2
v3
Get Product Metadata — removed
getProductMetadata({ link }) has no equivalent in the v3 public surface.
Remove these calls.
WebSocket
The socket was rewritten: no manual auth headers, a typed received envelope, and a renamed send method.| v2 | v3 | |
|---|---|---|
| Open | apolloWsSession.connect({ headers }) | messaging.connect() — no headers |
| Ready | on('open') | await socket.waitForOpen() |
| Send | sendUserMessage({ task_id, text }) | sendMessage({ type: 'message', agent_id, … }) |
| Received | channel-shaped object | { type, data, seq } |
v2
v3
Response shapes
Responses are fully typed now — delete the v2-eraas unknown as T casts.
The Message object below is what you read from sendMessage,
listMessages, getThreadMessages, and the WS terminal frame.
New in v3, no v2 equivalent: the Management APIs (
projects, agents,
agentVersions), SSE streaming via messaging.streamMessage(),
messaging.rerun(), messaging.getWelcomeMessage(), and
threads.updateThread().Migration checklist
Work top to bottom.- Bump the dependency to
@aui.io/aui-client@^3. - Replace
new ApolloClient()withApolloMessagingClient(browser) and/orApolloManagementClient(server). - Swap the single
networkApiKeyfor a publishable key and/or org API key — never ship the org key to a browser. - Delete the environment/URL matrix; rely on the production default (or set
baseUrlto override). - Rename every
task_id→thread_id; stop callingcreateTaskand capturethread_idfrom the first response. - Update
sendMessage: add requireduser_id, dropis_external_api/agent_id, read the reply fromres.message. - Move
startTextConversation→channels.initiateThread(channel, { phone_number, text? }). - Re-point
listUserTasks→threads.listThreads({ filters: { user_id } })and readresults(cursor pagination). - Replace
getTraceInfowithgetThreadTrace/getInteractionTrace. - Audit
getAgentContext—getContext()is not the same thing. - Remove
getProductMetadatacalls (no replacement). - Rewrite the WebSocket:
messaging.connect(), no auth headers, branch onenv.type, send withsendMessage({ type: 'message', agent_id }). - Move per-call
timeoutInSecondsintorequestOptions; set a generous timeout on list endpoints. - Drop
as unknown ascasts — responses are typed.