Skip to main content

Ruvon edge agent for offline-first fintech devices (POS, ATM, kiosks)

Project description

ruvon-edge

Offline-resilient workflow agent for edge devices.

ruvon-edge is the device-side runtime for the Ruvon workflow engine. It runs full workflow orchestration on POS terminals, ATMs, mobile readers, kiosks, and industrial controllers — with or without network connectivity.


What It Does

Store-and-Forward (SAF)

Transactions queue locally in SQLite when the network is unavailable. When connectivity returns, the sync manager batches and forwards records to the cloud control plane with automatic retry and idempotency.

ETag Config Push

The edge agent polls the cloud server using If-None-Match. Fraud rules, floor limits, and workflow definitions are hot-deployed without firmware updates or device restarts.

Cryptographic Device Identity

NKey-based signing for every heartbeat and SAF batch. Tamper-evident audit trails at the device level.

WASM Step Execution

Run sandboxed business logic modules compiled to WebAssembly. Supports both legacy WASI (stdin/stdout) and the Component Model typed interface. Modules are distributed by the cloud control plane and verified by NKey signature before execution.

Gossip Mesh Coordination

Peer-to-peer coordination between edge devices on the same network segment. Includes capability scoring, local master election, and vector-based relay advisory — no central broker required for intra-fleet communication.

Platform Adapters

The same Python code targets three runtimes:

  • Native CPython — POS terminals, ATMs, Raspberry Pi
  • Pyodide — Browser via WebAssembly (offline-capable web kiosks)
  • WASI 0.3 — Constrained embedded targets

Installation

# Standard edge device (native CPython)
pip install 'ruvon-edge[edge]'

# With NATS JetStream mesh transport
pip install 'ruvon-edge[edge,nats]'

# Browser target (Pyodide — install inside micropip)
import micropip
await micropip.install('ruvon-edge')

# With Component Model WASM support
pip install 'ruvon-edge[native]'   # includes wasmtime

Requires: ruvon-sdk>=0.1.0


Quick Start

from ruvon_edge.agent import RuvonEdgeAgent

agent = RuvonEdgeAgent(
    device_id="pos-terminal-001",
    cloud_url="https://your-ruvon-server.example.com",
    api_key="your-api-key",
    db_path="edge.db",
)

await agent.start()
# Agent connects, polls for config, starts workflow execution loop
# Queues transactions locally if cloud is unreachable

Register a Command Handler

async def handle_update_workflow(command_data: dict):
    print(f"Received workflow update: {command_data['workflow_type']}")
    return True

agent.register_command_handler("update_workflow", handle_update_workflow)

Run a Workflow on Device

from ruvon_edge.agent import RuvonEdgeAgent
from ruvon.builder import WorkflowBuilder

# Workflows run on the device using SQLite persistence
workflow = builder.create_workflow("PaymentFlow", {"amount": 49.99})
workflow.start()
print(workflow.status)   # COMPLETED (local execution, no network needed)

Architecture

┌────────────────────────────────────┐
│          RuvonEdgeAgent            │
│  ┌─────────────┐  ┌─────────────┐ │
│  │ SyncManager │  │ConfigManager│ │
│  │  (SAF/sync) │  │ (ETag poll) │ │
│  └──────┬──────┘  └──────┬──────┘ │
│         │                │        │
│  ┌──────▼────────────────▼──────┐ │
│  │   SQLite (WAL mode)          │ │
│  │   workflow_executions        │ │
│  │   saf_pending_transactions   │ │
│  │   edge_workflow_cache        │ │
│  │   device_config_cache        │ │
│  └──────────────────────────────┘ │
└────────────┬───────────────────────┘
             │ HTTPS / NATS (when online)
┌────────────▼───────────────────────┐
│       Ruvon Cloud Control Plane    │
│  POST /api/v1/devices/{id}/sync    │
│  GET  /api/v1/devices/{id}/config  │
│  GET  /api/v1/devices/{id}/commands│
└────────────────────────────────────┘

Edge-Specific Environment Variables

Variable Default Description
RUVON_DEVICE_ID Unique device identifier
RUVON_CLOUD_URL Cloud control plane base URL
RUVON_API_KEY Device authentication key
RUVON_DB_PATH edge.db SQLite database path
RUVON_SYNC_INTERVAL 30 SAF sync interval (seconds)
RUVON_LOG_LEVEL INFO Logging level
RUVON_ENCRYPTION_KEY Fernet key for state encryption
RUVON_NATS_URL NATS broker URL (enables mesh transport)

Offline Capabilities

Scenario Behaviour
No network at startup Agent starts with cached config; queues all transactions
Network lost mid-session Seamless fallback to local queue; no data loss
Network restored Automatic batch sync; idempotent retry on failure
Config update pushed Hot-reload without restart
WASM module updated Verified, patched, and applied at next execution

Related Packages

Package Purpose
ruvon-sdk Core workflow engine (required dependency)
ruvon-server Cloud control plane for fleet management

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ruvon_edge-0.1.0.tar.gz (9.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ruvon_edge-0.1.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file ruvon_edge-0.1.0.tar.gz.

File metadata

  • Download URL: ruvon_edge-0.1.0.tar.gz
  • Upload date:
  • Size: 9.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for ruvon_edge-0.1.0.tar.gz
Algorithm Hash digest
SHA256 39705fa105fc79ee9d9793f80d0e455609a9091e2dd3955d9a588e675bbc4471
MD5 dbb20b8beec8442794da3fe1ad33183d
BLAKE2b-256 2ea040526866d5c15775fb8852c9c3cb0d1b594862a32c957b57a0b223d29663

See more details on using hashes here.

File details

Details for the file ruvon_edge-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ruvon_edge-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for ruvon_edge-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d74a14db296e0b859f4f5d275ff4a1c60d4ceb7573e88c6f453e47b5c2240a9
MD5 4e317a4b877eb19da0852e2086435174
BLAKE2b-256 56d786f0b2248826484b460b8896418041055286bff8acf621f8ba99bd383632

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page