Skip to content
Beeuni
English
Esc
↑↓navigate↵open⌘Jpreview
On this page

SDK

Use Beeuni Computer as your product’s agent backend.

Use @beeuni/sdk to manage projects, run agent sessions, and connect your tools.

Install

npm install @beeuni/sdk

Create a client

Create an API key in Settings → API keys. Store it on your server, outside browser code.

import { createBeeuni } from '@beeuni/sdk';

const beeuni = createBeeuni({
  backendUrl: 'https://api.beeuni.ai/v1',
  getToken: async () => process.env.BEEUNI_API_KEY ?? null,
});

const projects = await beeuni.projects.list();

The SDK calls getToken for every request. Your application stores and refreshes tokens; see Authentication.

Call a connector

Find the tools available to your project, then inspect a tool’s input schema. Credentials stay with Beeuni.

Set BEEUNI_PROJECT_ID to an existing project that your API key can access.

const projectId = process.env.BEEUNI_PROJECT_ID!;
const connectors = beeuni.project(projectId).connectors;

console.log(await connectors.catalog());
console.log(await connectors.search('search email'));

Replace toolName with a tool returned by search, and fill args using its input schema. Calls require an authorized connection and permission to use that tool.

const toolName = 'your_connector.your_action';
console.log(await connectors.describe(toolName));

const args = {};
const result = await connectors.call(toolName, args);
console.log(result);

Start your first session

const created = await beeuni.project(projectId).sessions.create({
  name: 'My first SDK session',
});
const session = beeuni.session(projectId, created.session_id);

await session.ensureReady();
await session.send('Describe your capabilities in one paragraph.');

ensureReady() starts or resumes the session and waits until it is ready. send() uses the project’s configured model and agent unless you provide overrides. Session usage consumes credits.

To receive events and read the reply, continue with Full example. For a React interface, use React hooks.

Guides

Was this page helpful?