Skip to content

@egain/ai-agent-sdk API Reference - v0.2.3-beta.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:327


message

message: AgentEvent<"message">

Emitted when a message is received

Defined in

core/AiAgent.ts:332


agentMessage

agentMessage: AgentEvent<"agentMessage">

Emitted when an agent message is received

Defined in

core/AiAgent.ts:337


contextValidation

contextValidation: AgentEvent<"contextValidation">

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

Defined in

core/AiAgent.ts:342


errorMessage

errorMessage: AgentEvent<"errorMessage">

Emitted when an error message is received

Defined in

core/AiAgent.ts:347


error

error: AgentEvent<"error">

Emitted when an error occurs

Defined in

core/AiAgent.ts:352


closed

closed: AgentEvent<"closed">

Emitted when connection is closed

Defined in

core/AiAgent.ts:357


stateChanged

stateChanged: AgentEvent<"stateChanged">

Emitted when connection state changes

Defined in

core/AiAgent.ts:362


queueFlushed

queueFlushed: AgentEvent<"queueFlushed">

Emitted when queue is flushed

Defined in

core/AiAgent.ts:367


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


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


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


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


callerInfoUpdate

callerInfoUpdate: AgentEvent<"callerInfoUpdate">

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

Defined in

core/AiAgent.ts:397


conversationIdUpdate

conversationIdUpdate: AgentEvent<"conversationIdUpdate">

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

Defined in

core/AiAgent.ts:403


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


filterTagsUpdate

filterTagsUpdate: AgentEvent<"filterTagsUpdate">

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

Defined in

core/AiAgent.ts:415


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


portalsAvailable

portalsAvailable: AgentEvent<"portalsAvailable">

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

Defined in

core/AiAgent.ts:429


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


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

Released under the MIT License.