Skip to content

@egain/ai-agent-sdk API Reference - v0.3.2 / AgentEvents

Interface: AgentEvents ​

Agent event map

Table of contents ​

Properties ​

Properties ​

connected ​

• connected: AgentEvent<"connected">

Emitted when connection is established

Defined in ​

core/AiAgent.ts:322


message ​

• message: AgentEvent<"message">

Emitted when a message is received

Defined in ​

core/AiAgent.ts:327


agentMessage ​

• agentMessage: AgentEvent<"agentMessage">

Emitted when an agent message is received

Defined in ​

core/AiAgent.ts:332


contextValidation ​

• contextValidation: AgentEvent<"contextValidation">

Emitted when some context attributes were rejected without terminating the session.

Defined in ​

core/AiAgent.ts:337


errorMessage ​

• errorMessage: AgentEvent<"errorMessage">

Emitted when an error message is received

Defined in ​

core/AiAgent.ts:342


error ​

• error: AgentEvent<"error">

Emitted when an error occurs

Defined in ​

core/AiAgent.ts:347


closed ​

• closed: AgentEvent<"closed">

Emitted when connection is closed

Defined in ​

core/AiAgent.ts:352


stateChanged ​

• stateChanged: AgentEvent<"stateChanged">

Emitted when connection state changes

Defined in ​

core/AiAgent.ts:357


queueFlushed ​

• queueFlushed: AgentEvent<"queueFlushed">

Emitted when queue is flushed

Defined in ​

core/AiAgent.ts:362


heartbeat ​

• heartbeat: AgentEvent<"heartbeat">

Emitted when a heartbeat message is received Indicates the agent is processing/typing - UI can show a loader

Defined in ​

core/AiAgent.ts:368


tokenExpiring ​

• tokenExpiring: AgentEvent<"tokenExpiring">

Emitted when the access token is about to expire or needs refresh Triggered by JWT expiration detection (with 5-min buffer) or transport layer request

Defined in ​

core/AiAgent.ts:374


transcriptUpdate ​

• transcriptUpdate: AgentEvent<"transcriptUpdate">

Emitted when the transcript is updated (message sent or received) Contains the new transcript entry with message and direction

Defined in ​

core/AiAgent.ts:380


callTranscriptUpdate ​

• callTranscriptUpdate: AgentEvent<"callTranscriptUpdate">

Emitted when the platform connector pushes a call transcript entry via HookContract.addToTranscript(). Entries arrive incrementally during a call.

Defined in ​

core/AiAgent.ts:386


callerInfoUpdate ​

• callerInfoUpdate: AgentEvent<"callerInfoUpdate">

Emitted when the platform connector sets caller information via HookContract.setCallerInfo().

Defined in ​

core/AiAgent.ts:392


conversationIdUpdate ​

• conversationIdUpdate: AgentEvent<"conversationIdUpdate">

Emitted when the platform connector sets the conversation/interaction ID via HookContract.setConversationId().

Defined in ​

core/AiAgent.ts:398


userContextUpdate ​

• userContextUpdate: AgentEvent<"userContextUpdate">

Emitted when the platform connector appends to user context via HookContract.setUserContext(). Payload contains the merged context.

Defined in ​

core/AiAgent.ts:404


filterTagsUpdate ​

• filterTagsUpdate: AgentEvent<"filterTagsUpdate">

Emitted when the platform connector sets filter tags via HookContract.setUserFilterTags().

Defined in ​

core/AiAgent.ts:410


initialized ​

• initialized: AgentEvent<"initialized">

Emitted when the pipeline (or direct flow) is fully complete. Safe to call connect(). Consumer is responsible for calling connect() after this. Payload is never empty in practice: always at least agent (agentId, name). When the CC pipeline completed, also includes portal, optional portalDetails, optional agent, profile, availableProfiles, availablePortals.

Defined in ​

core/AiAgent.ts:418


portalsAvailable ​

• portalsAvailable: AgentEvent<"portalsAvailable">

Emitted when multiple portals are available. Consumer must call selectPortal(portal) to continue.

Defined in ​

core/AiAgent.ts:424


agentsAvailable ​

• agentsAvailable: AgentEvent<"agentsAvailable">

Emitted when multiple agents are available (Flow B only). Consumer must call selectAgent(agent) to continue.

Defined in ​

core/AiAgent.ts:430


profilesAvailable ​

• profilesAvailable: AgentEvent<"profilesAvailable">

Emitted when multiple user profiles exist and neither last-used nor default profile is found. Payload includes profiles and selectedPortal. Consumer must call selectUserProfile(profile) to continue.

Defined in ​

core/AiAgent.ts:436

Released under the MIT License.