nemo-flow-wasm
v0.2.0
Published
WebAssembly bindings for the NeMo Flow agent runtime.
Maintainers
Readme
NeMo Flow
nemo-flow-wasm is the NeMo Flow WebAssembly package for JavaScript
environments that load the runtime through WebAssembly. It exposes the same execution
scope, middleware, plugin, lifecycle event, and observability concepts as the
Rust runtime.
The Rust crate in this directory is build machinery for the generated npm package. JavaScript users should install the npm package rather than depend on the Rust crate directly.
This surface is experimental and source-first. Use the repository source tree and WebAssembly tests when validating behavior, and prefer Rust, Python, or Node.js for primary documented application integrations.
Observability support is also experimental. The WebAssembly target does not
support grpc OTLP transport, and file-backed observability plugin sinks
require a host runtime with filesystem access.
Why Use It?
- 🌐 Bring NeMo Flow to WebAssembly: Use the shared runtime model from JavaScript environments that load the package through WebAssembly.
- 🧭 Keep execution context visible: Group scope, tool, LLM, middleware, and subscriber behavior into the same runtime event tree.
- 🛡️ Register JavaScript policy callbacks: Apply guardrails and intercepts around managed tool and LLM execution.
- 📦 Consume it as npm: Install the generated package instead of depending on the Rust crate directly.
What You Get
- ✅ WebAssembly runtime bindings: Access to NeMo Flow scope, tool, LLM, middleware, subscriber, plugin, typed, and adaptive APIs.
- ✅ Managed tool and LLM execution: Helpers that emit lifecycle events for JavaScript-managed callbacks.
- ✅ Middleware registration: Guardrail and intercept APIs for JavaScript callbacks.
- ✅ Additional entry points:
nemo-flow-wasm/typed,nemo-flow-wasm/plugin,nemo-flow-wasm/adaptive, andnemo-flow-wasm/observability. - ✅ Generated npm package: A
wasm-packbuild prepared for JavaScript package consumption.
Installation
Install the npm package in a JavaScript project:
npm install nemo-flow-wasmFor local source validation from the repository root:
npm run build:pkg --workspace=nemo-flow-wasm
npm run test:pkg --workspace=nemo-flow-wasmGetting Started
Register a subscriber and emit a mark inside a scope:
const {
ScopeType,
deregisterSubscriber,
event,
registerSubscriber,
withScope,
} = require("nemo-flow-wasm");
async function main() {
registerSubscriber("printer", (runtimeEvent) => {
console.log(`${runtimeEvent.kind} ${runtimeEvent.name}`);
});
await withScope("demo-agent", ScopeType.Agent, async (handle) => {
event("initialized", handle, { binding: "wasm" }, null);
});
deregisterSubscriber("printer");
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});The main runtime API is exported from nemo-flow-wasm. Additional entry points
are available at nemo-flow-wasm/typed, nemo-flow-wasm/plugin,
nemo-flow-wasm/adaptive, and nemo-flow-wasm/observability.
Documentation
NeMo Flow Documentation: https://nvidia.github.io/NeMo-Flow
