Skip to content
Rath Lab
Harness ArchOpen source

OpenRath

An open-source, PyTorch-like runtime for dynamic multi-agent and multi-session workflows.

Version
v2.0.0
License
BSD-3-Clause
Language
Python
GitHub
1.1k ★
A four-quadrant map: single-to-multi session on one axis, single-to-multi agent on the other. OpenRath sits in the multi-agent, multi-session quadrant.
One axis is session semantics, the other is the number of agents.

Most agent frameworks begin with an agent loop. OpenRath begins with Session.

In Chinese: 多数 Agent 框架从 agent loop 开始。OpenRath 从 Session 开始。
Paper

OpenRath: Session-Centered Runtime State for Agent Systems

Fukang Wen, Zhijie Wang, Ruilin Xu · cs.SE (primary) · cs.PL · 2026

arXiv:2606.19409

Core abstractions

  • Session

    The runtime value passed between agents and workflows. Branchable, inspectable, replayable.

  • Sandbox / Backend

    The execution environment for tools: local, or an optional OpenSandbox container.

  • Memory

    Persists knowledge. A local backend with built-in BM25 recall, swappable for OpenViking.

  • FlowToolCall

    A JSON schema to the model, a Python callable to the runtime. stdio MCP tools adapt.

  • Workflow / Agent

    An agent transforms sessions; a workflow composes both, nesting without limit.

  • Selector

    Picks the next workflow, so if and while stay plain Python.

  • Provider

    Routes OpenAI-compatible, Anthropic, or optional LiteLLM clients.

Sessions flow as a graph between agents: Planner, Researcher, Coder, and Reviewer each transform the same Session through fork, detach, merge, and loop.
Session is the dataflow core; agents are transformation layers over it.

A PyTorch-shaped layering

PyTorchOpenRathRole
TensorSession流动的值
DeviceBackend放置位置
ParameterMemory持久状态
FunctionFlowToolCall可调用操作
nn.ModuleWorkflow / Agent组合结构
if / whileSelector控制流
Two aligned rows: PyTorch’s Tensor, Function, and nn.Module alongside Device and Parameter; below them OpenRath’s Session, Agent, and Workflow alongside Sandbox and Memory.
The same programming intuition, expressed in agent-native runtime objects.

Install

  • pip install openrathCore package
  • pip install "openrath[opensandbox]"Containerized sandbox
  • pip install "openrath[openviking]"OpenViking memory backend
  • pip install "openrath[server,postgres]"v2 production deployment

Quickstart

The v2 public API lives under the rath.* namespace; the v1 openrath façade remains available.

v2 — a durable workflow on SQLite
from pathlib import Path
from uuid import uuid4

from rath.definition import Workflow, step, EffectClass
from rath.runtime import LocalRuntime, RunContext, SQLiteRunStore


class DurableHello(Workflow):
    @step(entry=True, effects=EffectClass.READ_ONLY)
    def greet(self, state):
        return {**state, "message": "hello from OpenRath v2"}

    def forward(self, session):
        return self.greet(session)


store = SQLiteRunStore(Path("openrath.db"))
runtime = LocalRuntime(store)

runtime.submit(DurableHello(), session_id=uuid4(),
               context=RunContext.local(revision_id=uuid4()))
runtime.work_once(worker_id="local-worker")
v1 façade — a session transformation
from openrath import Session, flow

user_session = Session.from_user_message(
    "Count the words in: OpenRath makes agent clusters traceable."
)
user_session = user_session.to("local", spec="./")

out = workflow(user_session)
v2.0.0

Durable, explicit multi-agent execution.

  • @step / @router

    Declare compilable execution and routing boundaries.

  • ExecutionPlan

    A canonical graph bound to an immutable revision.

  • Run

    Durable execution state carrying tenant, session, and plan identity.

  • Event / Checkpoint

    Ordered lifecycle evidence, plus resumable per-step state.

  • Lease / fencing token

    Prevents a stale worker from committing after ownership changes.

  • Effect ledger

    Reconciles retries and ambiguous external side effects.

  • Embedded

    Local durable execution with SQLite.

  • Agent Server

    PostgreSQL with action grants, governed adapters, and an audit sink.

The v2 execution path: @step and @router compile into an immutable ExecutionPlan, which flows through Agent Server and a worker lease into Run, Event, and Checkpoint, connecting to an Effect Ledger and Interrupt.
Three layers: define and compile, execute durably, operate in production.

BSD-3-Clause · 59 forks · Paper submitted 2026 · The Agent Server HTTP surface remains Beta