Skip to content

eGroupAI/ai-sandbox-sdk-typescript

Repository files navigation

AI Sandbox SDK for TypeScript

Motion headline

GA APIs Streaming TypeScript

UX-First Value Cards

Quick Integration Real-Time Experience Reliability by Default
60-second quick start and minimal setup friction SSE chunk streaming for responsive chat UI Timeout + retry controls for production traffic

Visual Integration Flow

flowchart LR
  A[Create Agent] --> B[Create Chat Channel]
  B --> C[Send Message]
  C --> D[SSE Stream Chunks]
  D --> E[Attach Knowledge Base]
  E --> F[Customer-Ready Experience]
Loading

60-Second Quick Start

import { AiSandboxClient } from "@egroupai/ai-sandbox-sdk-typescript";

const client = new AiSandboxClient({
  baseUrl: process.env.AI_SANDBOX_BASE_URL ?? "https://www.egroupai.com",
  apiKey: process.env.AI_SANDBOX_API_KEY ?? "",
});

const agent = await client.createAgent({
  agentDisplayName: "Support Agent",
  agentDescription: "Handles customer inquiries",
});
const agentPayload =
  agent && typeof agent === "object"
    ? (agent as { payload?: Record<string, unknown> }).payload
    : undefined;
const agentId = Number(agentPayload?.agentId ?? 0);

const channel = await client.createChatChannel(agentId, {
  title: "Web Chat",
  visitorId: "visitor-001",
});
const channelPayload =
  channel && typeof channel === "object"
    ? (channel as { payload?: Record<string, unknown> }).payload
    : undefined;
const channelId = String(channelPayload?.channelId ?? "");

for await (const chunk of client.sendChatStream(agentId, {
  channelId,
  message: "What is the return policy?",
  stream: true,
})) {
  console.log(chunk);
}

Installation

npm install @egroupai/ai-sandbox-sdk-typescript

Integration Sanity Checklist

  • Keep AI_SANDBOX_API_KEY in secure runtime configuration.
  • Confirm AI_SANDBOX_BASE_URL points to the intended environment.
  • Verify [DONE] handling in stream consumers before release.

Snapshot

Metric Value
API Coverage 11 operations (Agent / Chat / Knowledge Base)
Stream Mode text/event-stream with [DONE] handling
Retry Safety 429/5xx auto-retry for GET/HEAD + capped exponential backoff
Error Surface ApiError with status/body/traceId
Validation Production-host integration verified
Release Readiness Run draft-release-train and guards checks before merge

Links

License

This SDK is released under the Apache-2.0 license.

About

Official TypeScript SDK for AI Sandbox v1 integration

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors