Bahini
Open app

Developer docs

Bahini SDK

A tiny, dependency-free TypeScript client for the Bahini REST API. Kick off governed agent and swarm runs from your own code, manage agents and their capability scope as code, publish dashboard data, and stream results — all over the same /api/v1 your console uses.

 
bash
npm install @bahini/sdk
 
ts
import { BahiniClient } from "@bahini/sdk";

const bahini = new BahiniClient({ apiKey: process.env.BAHINI_API_KEY! });

const done = await bahini.runAgentAndWait("agent_123", {
  prompt: "Summarize last month's sales by division.",
});

console.log(done.run.status); // "COMPLETED"
console.log(done.run.output); // the agent's answer
The SDK is a thin wrapper over the REST API — every method maps to one/api/v1 endpoint. Anything you can do in the console, you can do from code, under the same capability bounds, audit trail, and quotas.

What you can build#

Run agents & swarms

Fire a one-shot agent or a coordinator-planned swarm, then poll, stream, or wait for the verdict.

Agents as code

Create agents, set tools, capability scope, approval policy, budget, and golden-suite evals from CI.

Govern & audit

Bound HTTP domains, deny tools, set org egress, and read the hash-chained audit log programmatically.

Publish data

Push rows into named datasets, define dashboards as code, and set threshold alerts on your metrics.

Wire integrations

Register MCP servers and custom HTTP tools, then grant them to agents — no console round-trip.

Manage secrets

Store org credentials in the vault and grant them to agents; the model never sees the raw value.

Runtimes#

Built on the platform fetch — no axios, no codegen. Runs on Node 18+, browsers, Deno, and edge runtimes. On a runtime without a global fetch, inject one via options.fetch.

Next steps#

Head to the Quickstart to run your first agent in under a minute, or jump to the full API reference.