@weaver/sdk (0.5.0-alpha.1)

Published 2026-07-21 11:21:24 +00:00 by weaver-admin

Installation

@weaver:registry=
npm install @weaver/sdk@0.5.0-alpha.1
"@weaver/sdk": "0.5.0-alpha.1"

About this package

@weaver/sdk

TypeScript SDK for the Weaver platform. v0.4-alpha.1 — client-mode only.

For the full-featured Python version (framework Agent class + integrations

Client mode

Same clients as the Python SDK, same behaviour. No Agent framework yet — wire your own loop.

import { loadFromEnv, LLMClient, NATSBus, MCPRegistry } from "@weaver/sdk";

const cfg  = loadFromEnv();
const llm  = new LLMClient(cfg.llmUrl, cfg.llmDefaultModel);
const bus  = new NATSBus(cfg.natsUrl, cfg.tenant, cfg.agentName, cfg.natsToken);
const mcps = MCPRegistry.fromEnv();

await bus.connect();

await bus.subscribeMessage("review", async (env) => {
  const req = env.payload as { text: string };
  const r = await llm.chat(
    [{ role: "user", content: req.text }],
    { model: "gpt-4.1" },
  );
  return { answer: r.choices[0].message.content };
});

// Talk to another agent:
const answer = await bus.request("worker-a", { task: "hi" }, { topic: "run" });

// Talk to an MCP:
const kb = await mcps.get("knowledge-base");
const docs = await kb.callTool("search", { query: "AI Act" });

Environment contract

Same as Python. See ../spec/env-vars.md.

Roadmap

Version Adds
v0.4-alpha.1current LLMClient, NATSBus, Envelope, MCPClient, MCPRegistry, loadFromEnv.
v0.5 Agent framework class with lifecycle + decorators (via TypeScript @ decorators).
v0.6 PlatformClient, Triggers façade.
v1.0 Parity with Python SDK, npm registry.

Install (during alpha)

cd typescript
npm install
npm run build

Not published yet — link locally: npm link then in your agent npm link @weaver/sdk.

Dependencies

Dependencies

ID Version
nats ^2.28.0

Development Dependencies

ID Version
@types/node ^22
typescript ^5.5
vitest ^2.0
Details
npm
2026-07-21 11:21:24 +00:00
2
alpha
10 KiB
Assets (1)
Versions (1) View all
0.5.0-alpha.1 2026-07-21