SDK reference.
The Raven SDK is a thin, typed wrapper over our HTTP API. It is available for TypeScript and Python today, with Go in private beta.
Installation
npm install @raven/sdk
pnpm add @raven/sdk
yarn add @raven/sdkpip install raven-sdkCreating a client
Every operation goes through a typed client scoped to a workspace. The client is safe to share across requests in long-running services.
import { Raven } from "@raven/sdk";
const raven = new Raven({
token: process.env.RAVEN_TOKEN!,
workspace: process.env.RAVEN_WORKSPACE!,
// optional
region: "eu-west",
timeoutMs: 30_000,
});Muninn
raven.muninn.search
Run a hybrid (vector + structured) query across observations in your workspace.
const results = await raven.muninn.search({
query: "supplier exposure in southeast asia",
since: "7d",
limit: 50,
filter: { sector: "industrial" },
});raven.muninn.ingest
Push a batch of observations into Muninn. Each observation must include a source identifier; ingestion without provenance is rejected.
await raven.muninn.ingest({
records: [
{
subject: "asset:pump-31a",
observation: { temp: 78.4, vibration: 0.31 },
source: { uri: "scada://plant-2/loop-31", at: new Date() },
},
],
});Huginn
raven.huginn.cases.open
Start a new investigation case. Cases are the unit of accountable reasoning in Huginn.
const caseRef = await raven.huginn.cases.open({
title: "Q2 supplier concentration review",
hypothesis: "Tier-1 supplier mix exceeds policy ceiling for region X",
owner: "alex@acme.example",
});raven.huginn.cases.attach
Attach evidence — observations, documents, prior cases — to a case.
Sleipnir
raven.field.workflows.run
Execute a published workflow. Inputs are validated against the workflow's typed schema; policy is enforced before execution begins.
const run = await raven.field.workflows.run({
workflow: "supplier-concentration-alert",
inputs: { region: "APAC", threshold: 0.35 },
approver: "ops@acme.example",
});Error handling
The SDK throws typed errors. The most common are:
AuthError— invalid or expired token.PolicyError— the call violates an active policy.ProvenanceError— record submitted without source.RateLimitError— workspace quota exceeded.