mirror of
https://github.com/RightNow-AI/openfang.git
synced 2026-07-29 22:22:35 +00:00
Open-source Agent OS built in Rust. - 14 crates, 1,767+ tests, zero clippy warnings - 7 autonomous Hands (Clip, Lead, Collector, Predictor, Researcher, Twitter, Browser) - 16 security systems (WASM sandbox, Merkle audit trail, taint tracking, Ed25519 signing, SSRF protection, secret zeroization, HMAC-SHA256 mutual auth, and more) - 30 pre-built agents across 4 performance tiers - 40 channel adapters (Telegram, Discord, Slack, WhatsApp, Teams, and 35 more) - 38 built-in tools + MCP client/server + A2A protocol - 26 LLM providers with intelligent routing and cost tracking - 60+ bundled skills with FangHub marketplace - Tauri 2.0 native desktop app - 140+ REST/WS/SSE API endpoints with Alpine.js dashboard - OpenAI-compatible /v1/chat/completions endpoint - One-command install, production-ready
35 lines
885 B
JavaScript
35 lines
885 B
JavaScript
/**
|
|
* Basic example — create an agent and chat with it.
|
|
*
|
|
* Usage:
|
|
* node basic.js
|
|
*/
|
|
|
|
const { OpenFang } = require("../index");
|
|
|
|
async function main() {
|
|
const client = new OpenFang("http://localhost:3000");
|
|
|
|
// Check server health
|
|
const health = await client.health();
|
|
console.log("Server:", health);
|
|
|
|
// List existing agents
|
|
const agents = await client.agents.list();
|
|
console.log("Agents:", agents.length);
|
|
|
|
// Create a new agent from the "assistant" template
|
|
const agent = await client.agents.create({ template: "assistant" });
|
|
console.log("Created agent:", agent.id);
|
|
|
|
// Send a message and get the full response
|
|
const reply = await client.agents.message(agent.id, "What can you help me with?");
|
|
console.log("Reply:", reply);
|
|
|
|
// Clean up
|
|
await client.agents.delete(agent.id);
|
|
console.log("Agent deleted.");
|
|
}
|
|
|
|
main().catch(console.error);
|