@easynet-run/react
v0.36.9
Published
EasyNet Axon React SDK hooks for URI-first ability invocation.
Readme
What is this?
This is the React surface for Axon, a protocol-level control plane that treats agent capabilities as first-class network objects. Axon collapses tenant isolation, rate limiting, policy, node selection, concurrency admission, and circuit breaking into a single atomic decision — no race window between policy check and routing.
The React SDK provides hooks that bind to Axon abilities declaratively, with loading/error state management built in. The native Dendrite bridge handles all protocol-level work; the browser delegates to a Node.js/BFF backend for native library loading.
Install
npm install @easynet-run/reactQuick Start
Invoke an ability
import { useAbility } from "@easynet-run/react";
function QuoteWidget() {
const quote = useAbility(
"easynet:///r/org/reg/agent.quote-bot/abilities/order.quote@1?tenant_id=tenant-test",
{ tenant: "tenant-test" }
);
const handleClick = async () => {
const result = await quote.call({ sku: "A1", qty: 2 });
console.log(result);
};
return <button onClick={handleClick}>Get Quote</button>;
}Bridge LLM tools to abilities
import { useAbilityTools } from "@easynet-run/react";
const tools = useAbilityTools([
"easynet:///r/org/reg/agent.search/abilities/web.search@1?tenant_id=t",
"easynet:///r/org/reg/agent.calc/abilities/math.eval@1?tenant_id=t",
]);Capabilities
useAbility(uri, options)— declarative ability binding with loading/error state.useAbilityTools(uris)— register abilities as LLM-compatible tool definitions.- Subject binding — optional
principalfor subject-scoped invocation with automatic URI visibility mapping. - Context-aware — transport, tenant, and principal binding through React context.
Architecture note
The browser cannot load the native Dendrite bridge directly. Production deployments require a Node.js or BFF process as the bridge host. For SSR, tests, or dev scripts that need a local runtime, use startServer from @easynet-run/node — it supports the same federation options (hub, hubTenant, hubLabel) for NAT-friendly operation.
License
Apache-2.0 — see LICENSE.
