Skip to content

@egain/ai-agent-sdkEnterprise AI Agent SDK

TypeScript-first SDK for eGain's AI Agent platform with WebSocket communication, automatic reconnection, and comprehensive message handling.

AI Agent SDK

Quick Start

bash
npm install @egain/ai-agent-sdk
typescript
import { AiAgent } from "@egain/ai-agent-sdk";

const agent = new AiAgent({
  id: "your-agent-id",
  endpoint: "https://your-endpoint.com",
  auth: { type: "pre-auth", accessToken: "your-access-token" },
  autoConnect: true
});

await agent.initialize();

agent.on("agentMessage", (event) => {
  console.log("Agent:", event.payload.message?.content);
});

await agent.send("Hello, agent!");

Why This SDK?

🏢 Enterprise-Ready

Built for production use with comprehensive logging, error handling, and connection management.

⚡ Developer Experience

TypeScript-first design with excellent IDE support, autocomplete, and inline documentation.

🔧 Flexible Architecture

Extensible message handlers, pluggable cache adapters, and customizable authentication strategies.

📦 Lightweight

Tree-shakable with zero framework dependencies. Use only what you need.

Released under the MIT License.