| Quick Integration | Real-Time Experience | Reliability by Default |
|---|---|---|
| Simple API surface with minimal integration friction | sendChatStream(...) for SSE chunk handling |
Timeout + retry controls for production reliability |
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]
<?php
use EGroupAI\AiSandboxSdk\AiSandboxClient;
$client = new AiSandboxClient(
baseUrl: getenv("AI_SANDBOX_BASE_URL") ?: "https://www.egroupai.com",
apiKey: getenv("AI_SANDBOX_API_KEY") ?: ""
);
$agent = $client->createAgent([
"agentDisplayName" => "Support Agent",
"agentDescription" => "Handles customer inquiries",
]);
$agentId = (int)($agent["payload"]["agentId"] ?? 0);
$channel = $client->createChatChannel($agentId, [
"title" => "Web Chat",
"visitorId" => "visitor-001",
]);
$channelId = (string)($channel["payload"]["channelId"] ?? "");
$chunks = $client->sendChatStream($agentId, [
"channelId" => $channelId,
"message" => "What is the return policy?",
"stream" => true,
]);
foreach ($chunks as $chunk) {
echo $chunk . PHP_EOL;
}composer require egroupai/ai-sandbox-sdk-php- Keep
AI_SANDBOX_API_KEYin secure runtime configuration. - Confirm
AI_SANDBOX_BASE_URLpoints to the intended environment. - Verify
[DONE]handling in stream consumers before release.
| 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 |
- Official System Integration Docs
- Public Capability Showcase
- 30-Day Optimization Plan
- Integration Guide
- Quickstart Example
- Repository
This SDK is released under the Apache-2.0 license.