Skip to main content
The WASM runtime compiles the full Meerkat agent stack to wasm32 for browser deployment. It routes through the same AgentFactory::build_agent() pipeline as all other surfaces.

Build the WASM bundle

Build a web bundle from a .mobpack artifact:
rkat mob web build ./dist/my-mob.mobpack -o ./dist/web-bundle

Initialize runtime

import init, { init_runtime } from './runtime.js';

await init();

init_runtime(
  mobpackBytes,
  JSON.stringify({
    api_key: "sk-ant-...",
    model: "claude-sonnet-4-5",
  })
);

Create session and run turn

const handle = create_session(mobpackBytes, JSON.stringify({
  api_key: "sk-ant-...",
  model: "claude-sonnet-4-5",
}));

const result = JSON.parse(await start_turn(handle, "Hello", "{}"));
console.log(result.text);

Poll events

const events = JSON.parse(poll_events(handle));

for (const event of events) {
  if (event.type === "text_delta") {
    document.body.innerText += event.delta;
  }
}

Mob lifecycle in browser

// Create mob from definition
const mobId = await mob_create(JSON.stringify({
  id: "research-team",
  orchestrator: "lead",
  profiles: { lead: { model: "claude-sonnet-4-5" } },
}));

// Spawn members
await mob_spawn(mobId, JSON.stringify([
  { profile: "lead", meerkat_id: "lead-1" },
  { profile: "worker", meerkat_id: "worker-1" },
]));

// Wire peers
await mob_wire(mobId, "lead-1", "worker-1");

// Run a flow
const runId = await mob_run_flow(mobId, "review", "{}");
const status = JSON.parse(await mob_flow_status(mobId, runId));

Subscribe to member events

const sub = await mob_member_subscribe(mobId, "lead-1");

// Poll for events (non-blocking)
const events = JSON.parse(poll_subscription(sub));
for (const event of events) {
  console.log(event.type, event);
}

// Clean up when done
close_subscription(sub);

Cross-mob comms

Wire ambassadors across mobs for inter-faction communication. The wire_cross_mob function establishes trust between members in different mobs so they can exchange messages via the comms system.
// Wire ambassadors between two mobs
await wire_cross_mob(mobIdNorth, "ambassador-north", "ambassador-south");

// Send work to a member through the canonical member path
await mob_member_send(
  mobIdNorth,
  "ambassador-north",
  JSON.stringify({
    content: "Send a message to the south faction proposing an alliance on the eastern front.",
    handling_mode: "queue"
  })
);
Direct comms_send and comms_peers functions are not yet exported as WASM bindings. Inter-agent messaging happens through member-directed turn submission and the comms tools available to agents during their turns (the send and peers tools).

What is available on wasm32

CategoryAvailableNot available
Agent loopFull agent state machine, streaming, budget
ProvidersAnthropic, OpenAI, Gemini (browser fetch)
SessionsEphemeral sessionsPersistent sessions (filesystem)
MobsFull orchestration, flows, lifecycle
CommsIn-process (inproc) transportTCP, UDS, network transports
ToolsCustom tools, tool dispatchShell tools, filesystem tools
SkillsEmbedded skills, HTTP skillsFilesystem skill sources
HooksIn-process hooksCommand hooks, filesystem hooks
CompactionContext compaction
OtherMCP client, delegated work orchestration