Is Client a singleton?
Yes. Client.create() uses a global singleton pattern — calling it multiple times returns the same instance. To reinitialize, call close() first to destroy the current instance.
How do I release Client resources?
The SDK provides two methods for resource cleanup:
|
Method |
Behavior |
Use case |
|
|
Permanently destroys the instance and releases all internal resources. The instance cannot be reused. |
Page unload or application exit. |
|
|
Clears session state but keeps the instance reusable. |
Switching accounts after a user signs out. |
What is the difference between SingleAgentManager and AgentManager?
|
Aspect |
AgentManager |
SingleAgentManager |
|
Scope |
Multiple agents and sessions |
Single agent and session |
|
Session routing |
Requires an explicit agentID or sessionID for each operation |
Automatically bound — no manual specification needed |
|
Best for |
Applications that manage multiple agents or concurrent sessions |
Simple scenarios with a single agent |
Does the ASP streaming session support Node.js?
No. AspManager relies on the browser DOM to render streaming frames, so it is only available in browser environments. In Node.js, you can use all other managers except AspManager.
Which errors are retryable?
The following error types are retryable:
|
Error type |
Description |
|
NetworkError |
Network connectivity failure. |
|
TimeoutError |
Request timed out. |
|
RateLimitError |
Too many requests — rate limit exceeded. |
|
ServerError |
Server-side error (5xx). |
Use the isRetryable(error) helper to check whether an error can be safely retried:
import { isRetryable } from './wuying-sdk.mjs';
try {
await agentMgr.sendTextMessage({}, { sessionID: 'xxx', content: 'Hello' });
} catch (err) {
if (isRetryable(err)) {
// Safe to retry
}
}
How do I check the online status of an agent?
Call listAgents() — each returned agent object includes an onlineStatus field with a value of online or offline. Example:
const agentList = await agentMgr.listAgents({});
for (const agent of agentList.agents) {
console.log(`${agent.name}: ${agent.onlineStatus}`);
// Example output: "MyAgent: online"
}