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;
}