Skip to main content
The WASM surface compiles the Meerkat agent stack to wasm32 for browser deployment. Direct sessions and mob members share MeerkatMachine, which prepares SessionOwned bindings before SessionService calls AgentFactory::build_agent(). Input admission, keep-alive, comms drain, cancellation, and terminal outcomes follow the canonical runtime path. Browser storage is in memory, so page reload discards session and mob state.
This page is intentionally browser/WASM-specific rather than a cross-surface tabbed page. Use Examples: Mobpack first if you want the packaging/deployment path that usually leads into browser delivery.

Build the WASM bundle

Assemble a self-contained browser bootstrap from a .mobpack artifact. The command does not compile wasm32; it copies the required prebuilt meerkat-web-runtime from the generated wasm-pack --target web output directory named by --wasm:
Then serve and open it: python3 -m http.server -d ./dist/web-bundle. The generated page trust-verifies the pack and initializes the runtime. A host application must still create the mob, spawn members, and provide its own prompt/transcript UI.

Initialize runtime

Use init-time credentials and provider base URLs to seed the browser runtime’s realm config. The @rkat/web RuntimeConfig is provider-specific: anthropicApiKey, openaiApiKey, geminiApiKey, and the matching provider base URL fields (anthropicBaseUrl, openaiBaseUrl, geminiBaseUrl). The old generic apiKey/baseUrl compatibility fields are deleted, and SessionConfig does not accept per-session apiKey or baseUrl.
Mobpack ingress is fail-closed. The default is strict trust with an empty signer store, which rejects unsigned packs and unknown signers. Supply trusted signers for deployed packs. For a locally generated unsigned demo only, opt in explicitly with mobpackTrust: { policy: "permissive" }. initFromMobpack() verifies the archive and makes its skills available to direct sessions. It does not create a mob or expose the complete packed definition. A host that wants the declared topology must separately load a MobDefinition, call createMob(), and spawn its members as shown below. For proxy deployments, pass a provider-specific dummy key and base URL. The proxy injects the real server-side credential.

Create session and run turn

Creation, state reads, interruption, and teardown await the runtime owner. Use await session.interrupt() to cancel active work, and await runtime.destroy() to shut down the runtime. A direct session can set keepAlive: true with a commsName to accept runtime-admitted peer work between turns. Keep-alive lasts while the page and runtime remain alive. Install trust between direct sessions through the same runtime peer authority used by mobs. Each call installs trust in one direction:
session.turn(prompt, { transientTurnContext: "Current host facts" }) attaches request-only context to the runtime input. It is visible to that turn’s model requests and does not become transcript history. Select embedded skills with their canonical structured identities:
External skill sources return CAPABILITY_UNAVAILABLE with capability runtime_skills and clearing action use_skill_runtime before turn admission.
Stock MeerkatRuntime.init() and initFromMobpack() only synthesize InlineSecret bindings in the in-memory global realm from provider keys and URLs. They do not accept realm/binding configuration or load native realm files. Registering an external resolver does not create a realm or convert those bindings. Use the key/proxy examples above for stock browser sessions; OAuth or cloud credential handling can stay in the server-side proxy.
External auth is a custom Rust/WASM composition seam. A custom bootstrap must install a binding with credential source CredentialSourceSpec::ExternalResolver { handle: "wasm_host" } before that binding can use the callback. The following fragment only shows registration; it is not an external-binding bootstrap for the stock npm bundle:
Register before building the externally bound session. First runtime installation preserves a registration made after binary initialization; reinitializing an existing runtime clears it, so register again afterward. withAuthBinding(authBinding, config) only sets a structural selector for an already-configured binding; it cannot install one.

Poll events

Mob lifecycle in browser

Subscribe to member events

Cross-mob comms

Wire ambassadors across mobs for inter-faction communication. Resolve each member’s opaque peer target through its owning mob, then install trust in both directions. This keeps address and Ed25519 identity construction inside the runtime rather than hand-authoring an external target.
Direct comms_send and comms_peers are reserved low-level placeholders rather than current wasm-bindgen exports or public @rkat/web wrapper methods. Inter-agent messaging happens through member-directed turn submission and the comms tools available to agents during their turns (send_message, send_request, send_response, and peers).

What is available on wasm32

Excluded requests fail with CAPABILITY_UNAVAILABLE. The error’s data contains the profile, capability, and a typed clearing_action, such as use_host_process_runtime or use_local_member_placement. These decisions come from the shared capability profile and apply to direct and mob builds. File-backed mob skills use the runtime_skills refusal. Flow schemas that name a file use file_schema_resolution with use_inline_schema; provide a JSON schema object encoded in expected_schema_ref to run that flow in the browser.

Next step

  • Examples: Mobpack - the packaging/deployment path that often comes before browser delivery
  • Examples: Mobs - the multi-agent runtime model behind many WASM demos