@oberik/sdk
v0.79.0
Published
TypeScript client for Oberik — chat with citations, tools, sandboxed compute and scheduling over your own data.
Maintainers
Readme
@oberik/sdk
TypeScript client for Oberik — give your product AI over your customers' own data: retrieval with citations, your own tools, sandboxed compute, files and media, scheduling.
npm install @oberik/sdkQuick start
Your backend mints a short-lived token for one end-user; the SDK asks for a new one when it expires, so an expiry never surfaces at a call site.
import { createClient } from "@oberik/sdk";
const ai = createClient({
// baseUrl defaults to the hosted API; set it for a self-hosted deployment.
getToken: async ({ expired }) => fetchTokenFromYourBackend({ force: expired }),
});
const res = await ai.chat.send({ message: "How did Q3 revenue trend?", tags: ["finance"] });
res.content; // grounded answer
res.citations; // document · page · quoteStreaming, which is what you want in a UI:
const handle = ai.chat.stream(
{ message: input },
{
onToken: (_delta, full) => render(full),
onReasoning: (_delta, full) => showThinking(full), // reasoning models
onToolStart: (name) => setStatus(`Running ${name}…`),
onCitations: (cs) => showSources(cs),
onAttachments: (files) => offerDownloads(files),
},
);
const done = await handle.done;A dropped connection resumes the same run rather than restarting it, so a closed laptop lid mid-answer doesn't lose the answer or pay for it twice.
What's in the box
- Chat — blocking or streaming, with citations, unified source pills, guardrail flags
and
finish_reason. - Your own tools — register a handler and
chat.run/chat.streamdispatch it and resume for you; or drive the pause/resume loop yourself. - Documents — resumable presigned multipart upload straight to storage, ranged resumable download, retrieval, chunk inspection, ACLs.
- Sandboxed compute — start, pause, resume and reattach a workspace; push and pull files.
- Scheduling, connected sources, audit — the rest of the API, typed.
Zero dependencies, works in Node 18+ and in the browser, ESM and CommonJS.
Docs
Full documentation, including how to mint tokens and which capabilities gate what: https://oberik.com/docs
Development
The client is a single file kept at client/agent-framework.ts in the Oberik repository;
src/index.ts here is a symlink to it, so the published package, the dashboard's own
playground and the docs all use one source. Building emits ESM, CommonJS and types:
npm run build # dist/esm, dist/cjs, .d.ts
npm run check # asserts the tarball is actually usable before publishingnpm publish runs both automatically via prepublishOnly.
