@egain/ai-agent-sdk API Reference - v0.1.1 / AgentEvents
Interface: AgentEvents
Agent event map
Table of contents
Properties
- connected
- message
- agentMessage
- errorMessage
- error
- closed
- stateChanged
- queueFlushed
- heartbeat
- tokenExpiring
- transcriptUpdate
- callTranscriptUpdate
- callerInfoUpdate
- conversationIdUpdate
- userContextUpdate
- filterTagsUpdate
- initialized
- portalsAvailable
- agentsAvailable
- profilesAvailable
Properties
connected
• connected: AgentEvent<"connected">
Emitted when connection is established
Defined in
message
• message: AgentEvent<"message">
Emitted when a message is received
Defined in
agentMessage
• agentMessage: AgentEvent<"agentMessage">
Emitted when an agent message is received
Defined in
errorMessage
• errorMessage: AgentEvent<"errorMessage">
Emitted when an error message is received
Defined in
error
• error: AgentEvent<"error">
Emitted when an error occurs
Defined in
closed
• closed: AgentEvent<"closed">
Emitted when connection is closed
Defined in
stateChanged
• stateChanged: AgentEvent<"stateChanged">
Emitted when connection state changes
Defined in
queueFlushed
• queueFlushed: AgentEvent<"queueFlushed">
Emitted when queue is flushed
Defined in
heartbeat
• heartbeat: AgentEvent<"heartbeat">
Emitted when a heartbeat message is received Indicates the agent is processing/typing - UI can show a loader
Defined in
tokenExpiring
• tokenExpiring: AgentEvent<"tokenExpiring">
Emitted when the access token is about to expire or needs refresh Triggered by JWT expiration detection (with 3-min buffer) or transport layer request
Defined in
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
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
callerInfoUpdate
• callerInfoUpdate: AgentEvent<"callerInfoUpdate">
Emitted when the platform connector sets caller information via HookContract.setCallerInfo().
Defined in
conversationIdUpdate
• conversationIdUpdate: AgentEvent<"conversationIdUpdate">
Emitted when the platform connector sets the conversation/interaction ID via HookContract.setConversationId().
Defined in
userContextUpdate
• userContextUpdate: AgentEvent<"userContextUpdate">
Emitted when the platform connector appends to user context via HookContract.setUserContext(). Payload contains the merged context.
Defined in
filterTagsUpdate
• filterTagsUpdate: AgentEvent<"filterTagsUpdate">
Emitted when the platform connector sets filter tags via HookContract.setUserFilterTags().
Defined in
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
portalsAvailable
• portalsAvailable: AgentEvent<"portalsAvailable">
Emitted when multiple portals are available. Consumer must call selectPortal(portal) to continue.
Defined in
agentsAvailable
• agentsAvailable: AgentEvent<"agentsAvailable">
Emitted when multiple agents are available (Flow B only). Consumer must call selectAgent(agent) to continue.
Defined in
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.