bma-sdk
GitHub ↗対象: プラットフォーム API を呼ぶアプリ向け。
- エージェント、セッション、SSE イベントストリーム
- ファイル、成果物、コンピューター、デスクトップ、ターミナル
- 再開可能な SSE · 冪等キー · 型付きエラー
$
npm install @beeos-ai/bma-sdkimport { BmaClient } from "@beeos-ai/bma-sdk";
const client = new BmaClient({ apiKey: process.env.BMA_API_KEY!, baseURL: process.env.BMA_BASE_URL! });
const session = await client.beta.sessions.create({ agent: agentId, environment_id: environmentId });
// Open the stream first, then send: an interrupted stream resumes with Last-Event-ID.
const stream = await client.beta.sessions.events.stream(session.id);
await client.beta.sessions.events.send(session.id, {
events: [{ type: "user.message", content: [{ type: "text", text: "Plan my week." }] }],
});
for await (const ev of stream) {
if (ev.type === "agent.message") console.log(ev.content);
if (ev.type === "session.status_idle") break;
}