Skip to content

eGroupAI/ai-sandbox-sdk-csharp

Repository files navigation

AI Sandbox SDK for CSharp (.NET)

Motion headline

GA APIs Streaming CSharp

UX-First Value Cards

Quick Integration Real-Time Experience Reliability by Default
Async-first API surface for modern .NET apps IAsyncEnumerable<string> SSE streaming Configurable retries and timeout for resilience

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

using EGroupAI.AiSandbox.Sdk;

var client = new AiSandboxClient(
    Environment.GetEnvironmentVariable("AI_SANDBOX_BASE_URL") ?? "https://www.egroupai.com",
    Environment.GetEnvironmentVariable("AI_SANDBOX_API_KEY") ?? string.Empty
);

var agent = await client.CreateAgentAsync(new
{
    agentDisplayName = "Support Agent",
    agentDescription = "Handles customer inquiries"
});
var agentId = agent.RootElement.GetProperty("payload").GetProperty("agentId").GetInt32();

var channel = await client.CreateChatChannelAsync(agentId, new
{
    title = "Web Chat",
    visitorId = "visitor-001"
});
var channelId = channel.RootElement.GetProperty("payload").GetProperty("channelId").GetString();

await foreach (var chunk in client.SendChatStreamAsync(agentId, new
{
    channelId,
    message = "What is the return policy?",
    stream = true
}))
{
    Console.WriteLine(chunk);
}

Installation

dotnet add package EGroupAI.AiSandbox.Sdk

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 ApiException with statusCode/responseBody/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 C# SDK for AI Sandbox v1 integration

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages