@librefang/sdk
v2026.3.2123-rc1
Published
Official JavaScript/TypeScript client for the LibreFang Agent OS REST API
Maintainers
Readme
@librefang/sdk
Official JavaScript/TypeScript client for the LibreFang Agent OS REST API.
Installation
npm install @librefang/sdkUsage
const { LibreFang } = require("@librefang/sdk");
const client = new LibreFang("http://localhost:4545");Create an Agent
const agent = await client.agents.create({ template: "assistant" });
console.log("Agent created:", agent.id);Send a Message
const reply = await client.agents.message(agent.id, "Hello!");
console.log(reply);Streaming Response
for await (const event of client.agents.stream(agent.id, "Tell me a story")) {
if (event.type === "text_delta") {
process.stdout.write(event.delta);
}
}List Agents
const agents = await client.agents.list();
console.log(agents);More Examples
See the examples/ directory for more examples:
basic.js- Basic usagestreaming.js- Streaming responses
API Reference
Constructor
new LibreFang(baseUrl, options)baseUrl- LibreFang server URL (e.g., "http://localhost:4545")options- Optional configurationheaders- Extra headers for every request
Resources
The client provides the following resources:
client.agents- Agent managementclient.sessions- Session managementclient.workflows- Workflow managementclient.skills- Skill managementclient.channels- Channel managementclient.tools- Tool listingclient.models- Model managementclient.providers- Provider managementclient.memory- Memory/KV storageclient.triggers- Trigger managementclient.schedules- Schedule management
Server Methods
client.health()- Basic health checkclient.healthDetail()- Detailed healthclient.status()- Server statusclient.version()- Server versionclient.metrics()- Prometheus metricsclient.usage()- Usage statisticsclient.config()- Server configuration
TypeScript
This SDK includes TypeScript definitions (index.d.ts). Simply import and use:
import { LibreFang } from "@librefang/sdk";
const client = new LibreFang("http://localhost:4545");
const agents = await client.agents.list();License
MIT
