Browse this section
API reference

SDKs & CLI

Official Python and TypeScript SDKs, and the bmc command-line tool.

Python

pip install brewmycode
from brewmycode import Client

bmc = Client()  # reads BMC_API_KEY

kb = bmc.knowledge_bases.create(name="ops-eu")
bmc.documents.create(kb.id, title="SOP", content="# …", permissions={"users": ["*"]})

res = bmc.queries.create(knowledge_base="ops-eu", query="…", as_user="marja@example.com")

agent = bmc.agents.create_from_yaml("agent.yaml")
run = bmc.agents.run(agent.id, input={"document_url": "…"}, mode="test")
run = bmc.runs.wait(run.id, timeout=300)
print(run.status, run.output)

Async client: from brewmycode import AsyncClient. Python 3.9+.

TypeScript

npm install @brewmycode/sdk
import { BrewMyCode } from "@brewmycode/sdk";
const bmc = new BrewMyCode(); // reads BMC_API_KEY

const res = await bmc.queries.create({ knowledgeBase: "ops-eu", query: "…", asUser: "marja@example.com" });
const run = await bmc.agents.run("agt_…", { input: { documentUrl: "…" }, mode: "test" });
const done = await bmc.runs.wait(run.id, { timeoutMs: 300_000 });

Node 18+, Deno and Bun. Types are generated from the API schema.

CLI

Ships with the Python package.

bmc login                          # stores the key in the OS keychain
bmc kb list
bmc agents push agent.yaml         # create a new version
bmc agents evaluate invoice-processor --version 8
bmc agents promote invoice-processor --version 8
bmc runs tail invoice-processor    # stream runs and traces
bmc stop --all                     # emergency stop

OpenAPI

The full OpenAPI 3.1 description is available at https://api.brewmycode.com/v1/openapi.json for generating clients in other languages.