sdk of kweaver for agents
概览
Part of the KWeaver ecosystem — an open-source platform for building, managing, and querying knowledge networks. Give AI agents (Claude Code, GPT, custom agents, etc.) access to KWeaver knowledge networks and Decision Agents via the kweaver CLI. Also provides Python and TypeScript SDKs for programmatic integration. Requires Node.js 22+. After installation, use the kweaver command. Requires Python >= 3.10. After installation, use the same kweaver command. Both CLIs share the same command structure (kweaver auth, kweaver bkn, kweaver agent, kweaver skill, kweaver context-loader, …) and credentials stored in ~/.kweaver/. Or use environment variables: KWEAVER_BASE_URL, KWEAVER_BUSINESS_DOMAIN, KWEAVER_TOKEN, or the CLI flags kweaver --base-url --token … (stateless mode; see TypeScript README). With saved ~/.kweaver/ sessions from OAuth2 browser login, when the access token expires (no extra flags).
README
以下为原文 README 节选,完整内容请查看原文。
KWeaver SDK
Part of the KWeaver ecosystem — an open-source platform for building, managing, and querying knowledge networks.
Give AI agents (Claude Code, GPT, custom agents, etc.) access to KWeaver knowledge networks and Decision Agents via the kweaver CLI. Also provides Python and TypeScript SDKs for programmatic integration.
Installation
TypeScript CLI (recommended — includes interactive agent chat TUI)
npm install -g @kweaver-ai/kweaver-sdk
Requires Node.js 22+. After installation, use the kweaver command.
TypeScript SDK (programmatic)
npm install @kweaver-ai/kweaver-sdk
import { KWeaverClient } from "@kweaver-ai/kweaver-sdk";
// Zero-config: reads credentials saved by `kweaver auth login`
const client = new KWeaverClient();
// Or pass credentials explicitly
const client = new KWeaverClient({
baseUrl: "https://your-kweaver.com",
accessToken: "your-token",
});
const kns = await client.knowledgeNetworks.list();
const reply = await client.agents.chat("agent-id", "Hello");
console.log(reply.text);
Python CLI (alternative — for testing or Node-free environments)
pip install kweaver-sdk[cli]
Requires Python >= 3.10. After installation, use the same kweaver command.
Python SDK (programmatic)
pip install kweaver-sdk
import kweaver
kweaver.configure(config=True, bkn_id="your-bkn-id", agent_id="your-agent-id")
results = kweaver.search("What risks exist in the supply chain?")
reply = kweaver.chat("Summarise the top 3 risks")
print(reply.content)
Overview
| Entry point | Install | Purpose |
|---|---|---|
| TS CLI | npm install -g @kweaver-ai/kweaver-sdk |
Primary CLI with Ink TUI and streaming agent chat |
| TS SDK | npm install @kweaver-ai/kweaver-sdk |
Programmatic API — import { KWeaverClient } from "@kweaver-ai/kweaver-sdk" |
| Python CLI | pip install kweaver-sdk[cli] |
Alternative CLI, feature-parity with TS CLI |
| Python SDK | pip install kweaver-sdk |
Programmatic API — from kweaver import KWeaverClient |
Both CLIs share the same command structure (kweaver auth, kweaver bkn, kweaver agent, kweaver skill, kweaver context-loader, …) and credentials stored in ~/.kweaver/.
Authentication
kweaver auth login https://your-kweaver-instance.com
kweaver auth login https://your-kweaver-instance.com --alias prod
推荐工具
换一个关键词,或者移除筛选条件。
安装
npx skillfish add hhthxt/kweaver-sdk