Run your first actor in five minutes

Install one package and run one program. An order actor fills its cart, charges the card and retries on its own when the payment service is down.

npm install @tinyactors/node

@tinyactors/node 0.4.0, 19 November 2026What changedNode.js and Bun guide

Write a chart and run it

The packages need Node.js 22.3 or Bun, Python 3.13 or newer, or a C compiler. Save the chart as order.scxml and the program beside it, then run the program; the tabs follow the package you picked above.

import { readFileSync } from 'node:fs';
import { compileCharts, Host } from '@tinyactors/node';

let charges = 0;
const payments = {
  receive(send) {                   // the chart's <send type="payments">
    console.log('charge', JSON.stringify(send.data));
    if (++charges === 1) send.fail(); // down for the first charge: the order gets error.communication
    else send.answer('charged');    // an event back to the order
  },
};
const compiled = compileCharts([{ name: 'order.scxml', text: readFileSync('order.scxml', 'utf8') }]);
const host = new Host(compiled, {
  system: 'shop',
  ioProcessors: { payments },
  log: (entry) => console.log('log', entry.text),
});
compiled.close();

const order = host.spawn('order');
order.send('add', { item: 'notebook', price: 30 });
order.send('add', { item: 'pen', price: 12 });
order.send('checkout');
console.log('paid', await order.done); // the order retried on its own
host.close();
output
charge {"amount":42,"items":["notebook","pen"]}
log payment service unreachable, attempt 1: retrying in 1 s
charge {"amount":42,"items":["notebook","pen"]}
paid 42

The first charge fails, so the chart waits a second and charges again. Your program never wrote that retry: it lives in the chart's retrying state.

Every package prints these same lines. The chart's expressions are JavaScript in every package, Python's included.

The chart decides, your program acts

  • The hostruns the actors inside your process, so there is no server to start. Its system id, shop, names it in actors' addresses, such as tinyactors://shop/@order-17.
  • The chartholds every state the order can be in and the events that move it. Press the buttons under the diagram to drive it yourself.
  • The I/O processoris the payments object your program gives the host. The chart sends it charge and never calls a network itself, so a test can answer instead of a real service. The payment retry test lets three attempts time out by stepping the clock past each wait.
  • A crashstops the actors in the process, the order waiting for its retry included. Journal and replay and snapshots bring them back.

Let your coding agent read the docs

Add the tinyactors support server to your agent, and it can search these docs, load the skill for building with tinyactors and report what got in its way. In Claude Code:

shell
claude mcp add --transport http tinyactors-support https://mcp.tinyactors.dev/mcp

Build with a coding agent covers the other agents and what the server offers.

Go further