Skip to content

@egain/ai-agent-sdk API Reference - v0.1.1 / 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:306


message

message: AgentEvent<"message">

Emitted when a message is received

Defined in

core/AiAgent.ts:311


agentMessage

agentMessage: AgentEvent<"agentMessage">

Emitted when an agent message is received

Defined in

core/AiAgent.ts:316


errorMessage

errorMessage: AgentEvent<"errorMessage">

Emitted when an error message is received

Defined in

core/AiAgent.ts:321


error

error: AgentEvent<"error">

Emitted when an error occurs

Defined in

core/AiAgent.ts:326


closed

closed: AgentEvent<"closed">

Emitted when connection is closed

Defined in

core/AiAgent.ts:331


stateChanged

stateChanged: AgentEvent<"stateChanged">

Emitted when connection state changes

Defined in

core/AiAgent.ts:336


queueFlushed

queueFlushed: AgentEvent<"queueFlushed">

Emitted when queue is flushed

Defined in

core/AiAgent.ts:341


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:347


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

core/AiAgent.ts:353


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:359


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:365


callerInfoUpdate

callerInfoUpdate: AgentEvent<"callerInfoUpdate">

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

Defined in

core/AiAgent.ts:371


conversationIdUpdate

conversationIdUpdate: AgentEvent<"conversationIdUpdate">

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

Defined in

core/AiAgent.ts:377


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:383


filterTagsUpdate

filterTagsUpdate: AgentEvent<"filterTagsUpdate">

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

Defined in

core/AiAgent.ts:389


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:397


portalsAvailable

portalsAvailable: AgentEvent<"portalsAvailable">

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

Defined in

core/AiAgent.ts:403


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:409


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:415

Released under the MIT License.