Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:A9T9 RPA Macro Playback Engine

From Leeroopedia
Knowledge Sources
Domains Browser_Automation, Playback_Engine
Last Updated 2026-10-22 00:00 GMT

Overview

Mechanism for iterating a command table with a state-machine playback engine that supports play, pause, resume, stop, loops, and breakpoints.

Description

A Macro Playback Engine is a reusable state machine that drives the execution of a sequence of commands. It decouples the what (the command table) from the how (the execution callbacks), allowing the same engine to be used for different command types (web, desktop, script).

The engine manages:

  • Lifecycle states: PLAYING, PAUSED, STOPPED, ERROR
  • Iteration: advancing through the command list by index, with start/end bounds
  • Looping: repeating a range of commands N times
  • Breakpoints: pausing before a specific command index
  • Result handling: invoking a callback after each command completes
  • Event emission: START, PREPARED, TO_PLAY, PLAYED_LIST, PAUSED, RESUMED, END, ERROR

The engine does not execute commands itself — it delegates to a `run` callback provided at construction. This separation allows the same engine to drive classic table macros, JS script macros, and AI-driven macro execution.

Usage

Use this principle when designing any macro/automation playback system that needs pause/resume control, looping, and per-command result handling.

Theoretical Basis

The playback engine is a finite state machine:

State∈{PLAYING,PAUSED,STOPPED,ERROR}

Pseudo-code Logic:

# Abstract playback algorithm (NOT real implementation)
def play(commands, start, end, mode, loops=None):
    state = PLAYING
    for i in range(start, end + 1):
        if state == STOPPED: return
        if i in breakpoints: pause_until_resumed()
        result = run(commands[i])  # delegate to caller
        handle_result(result)
        if result.error:
            state = ERROR
            return

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment