TypeScript / Node SDK
The TypeScript / Node SDK wraps the Context API for use in any Node agent or backend.
Install
Section titled “Install”npm install @wexa/sdkQuickstart
Section titled “Quickstart”import { Wexa } from "@wexa/sdk";
const wexa = new Wexa({ apiKey: process.env.WEXA_API_KEY });
const context = await wexa.context.query({ workspace: "ws_<your_project>", query: "top accounts at churn risk",});console.log(context.entities);apiKey— a project-scopedfab_sk_…key. Generate one in Simple Mode. Read it from the environment (WEXA_API_KEY) rather than hardcoding it.workspace— your workspace ID (ws_<your_project>); it pins the call’s scope.
What you get back
Section titled “What you get back”context.query(...) resolves to the ranked entities, relationships, and facts that ground
the query, plus a lifecycle_id for tracing and audit — the same result the
MCP query-context tool returns.
Configuration
Section titled “Configuration”| Option | Purpose |
|---|---|
apiKey |
Project-scoped credential (fab_sk_…). |
| Base URL | Defaults to the managed cloud; set it to your deployment’s apiBaseUrl (from connection-info) for on-prem / air-gapped. |
