$git clone https://github.com/Rath-Team/OpenRathEnglish | 简体中文
| 1 | # OpenRath |
| 2 | |
| 3 | <p align="center"> |
| 4 | <img src="assets/readme/logos/openrath-logo-white.png" alt="OpenRath logo" width="860" /> |
| 5 | </p> |
| 6 | |
| 7 | <p align="center"> |
| 8 | <a href="https://pypi.org/project/openrath/"><img src="https://img.shields.io/pypi/v/openrath.svg" alt="PyPI"></a> |
| 9 | <a href="https://pypi.org/project/openrath/"><img src="https://img.shields.io/pypi/pyversions/openrath.svg" alt="Python"></a> |
| 10 | <a href="https://github.com/Rath-Team/OpenRath/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-BSD--3--Clause-blue.svg" alt="License"></a> |
| 11 | <a href="https://docs.openrath.com"><img src="https://img.shields.io/badge/docs-openrath.com-blue" alt="Docs"></a> |
| 12 | <a href="https://arxiv.org/abs/2606.19409"><img src="https://img.shields.io/badge/arXiv-2606.19409-b31b1b.svg?logo=arxiv&logoColor=white" alt="arXiv"></a> |
| 13 | </p> |
| 14 | |
| 15 | <div align="center"> |
| 16 | |
| 17 | English | [简体中文](README_zh.md) |
| 18 | |
| 19 | </div> |
| 20 | |
| 21 | --- |
| 22 | |
| 23 | **OpenRath is a PyTorch-like multi-agent & multi-session framework.** |
| 24 | |
| 25 | It turns agent runtime state into explicit, composable Python objects: |
| 26 | |
| 27 | - **Session** carries conversation state and inter-agent collaboration lineage. |
| 28 | - **Sandbox** decides where tools actually run. |
| 29 | - **Memory** persists agent memory state across runs. |
| 30 | - **Tool** is the operator-like callable surface exposed to the model. |
| 31 | - **Agent** is a reusable, composable session transformation layer. |
| 32 | - **Workflow** composes multiple agents and workflows into larger systems. |
| 33 | - **Selector** routes between self-describing workflows at runtime, so `if` / `while` control flow stays plain Python. |
| 34 | |
| 35 | --- |
| 36 | |
| 37 | ## OpenRath in the PyTorch Lens |
| 38 | |
| 39 | <p align="center"> |
| 40 | <img src="assets/readme/diagrams/pytorch-lens.png" alt="OpenRath in the PyTorch Lens" width="860" /> |
| 41 | </p> |
| 42 | |
| 43 | | PyTorch idea | OpenRath idea | What it means | |
| 44 | | --- | --- | --- | |
| 45 | | `Tensor` | `Session` | The flowing runtime value: ordered chunks, placement, lineage, and usage. | |
| 46 | | `Device` | `Sandbox` / `Backend` | The execution environment where tools run: local process, OpenSandbox, or another backend. | |
| 47 | | `Parameter` | `Memory` | Persistent state bound to an agent or store, recalled and committed across runs. | |
| 48 | | `Function` | `Tool` | A callable operation with model-visible schema and runtime behavior. | |
| 49 | | `nn.Linear` | `Agent` | A reusable layer that maps one session to another using a prompt, provider, tools, and memory. | |
| 50 | | `nn.Module` | `Workflow` | A composable container for agents, tools, session transforms, and nested workflows. | |
| 51 | | control flow | `Selector` | An LLM-backed router that picks the next workflow at runtime, enabling dynamic `if` / `while` over agents. | |
| 52 | |
| 53 | Most agent frameworks begin with an agent loop. OpenRath begins with **Session**. That difference matters when one application needs multiple agents, multiple branches, durable memory, sandboxed execution, and traceable lineage at the same time. |
| 54 | |
| 55 | OpenRath is designed for this: many agents collaborating across many branchable sessions, while still tracing every role, workspace, memory write, and final output. |
| 56 | |
| 57 | <p align="center"> |
| 58 | <img src="assets/readme/diagrams/paradigm-map.png" alt="Multi-Agent Multi-Session Map" width="860" /> |
| 59 | </p> |
| 60 | |
| 61 | | Paradigm | Typical shape | Example | |
| 62 | | --- | --- | --- | |
| 63 | | Single agent, single session | One model over one conversation | ChatGPT-style chat | |
| 64 | | Multi-agent, single session | Several roles read and write one shared state | Sub-agent-style multi-agent collaboration | |
| 65 | | Single agent, multi-session | One agent manages many session branches | OpenClaw-style session fanout | |
| 66 | | Multi-agent, multi-session | Many agents share many sessions and collaborate or evolve through Session | **OpenRath** | |
| 67 | |
| 68 | --- |
| 69 | |
| 70 | ## Why the Multi-Agent-Multi-Session Paradigm |
| 71 | |
| 72 | An agent is a transformation layer on Session, so what really needs to be forked, merged, reused, and traced is the Session dataflow—not a separate message history maintained by each agent. |
| 73 | |
| 74 | <p align="center"> |
| 75 | <img src="assets/readme/diagrams/multi-agent-multi-session.png" alt="Why Multi-Agen |