v1.2.0
OpenRath v1.2.0
在 v1.1.0 的 Session 运行时、沙箱后端与持久化基础上,v1.2.0 引入完整的 Memory 平面 与 内部 Async 运行时,并统一 Session / Sandbox 生命周期。OpenRath 从「多 Session 编排框架」进一步走向 Multi-Agent × Multi-Session × 可持久记忆 的运行时。
核心特性
Memory 平面
新增与 rath.backend 对称的 rath.memory 模块,Agent 记忆成为一等公民:
- 默认 Local Memory Backend —
pip install openrath即可使用,零额外依赖;支持memory://URI、BM25 词法检索、可选 embedding 排序、Resource ingest,以及 Commit 时的 LLM 记忆提取。 - OpenViking Backend(可选) —
pip install "openrath[openviking]"接入 OpenViking;公开 API 统一为memory://,adapter 边界自动与viking://互转。 - Agent 记忆 API —
flow.Agent(memory="local")绑定 store,提供remember_memory()/recall_memory()/commit_memory();forward时可自动 recall 注入,并可选commit_on_forward。 - 配置驱动 —
~/.openrath/config.json新增memorysection,可命名多个 local store preset。
快速上手:python example/09_memory.py(remember / recall 无需 API key)。
内部 Async 运行时
引入 PyTorch 风格的私有 rath._async 运行时。对外 API 保持完全同步,async 能力在内部透明生效:
- Lazy Session —
run_session_loop()立即返回 Session;读取chunk_table/cumulative_usage时隐式同步,lineage 属性仍 eager 可读。 - 并行工具调度 — 按
resource_key分组并行执行(如不同文件的 fs:write),同 key 内串行(如 shell exec),兼顾吞吐与安全。 - WAL 持久化 — Session JSONL 写入
.__partial__,crash 可检测;异步 writer 不阻塞 runtime loop。 - Benchmark / Stress — 新增
tests/bench/与scripts/stress.py用于并发压测。
重要优化
Session 与 Sandbox 生命周期统一
BackendSandboxacquire/release 加锁保护;refcount 归零时在锁外 close,消除竞态。backend.get(name)返回进程级单例,refcount 与 per-backend 缓存在跨 Session 间保持一致。Session.create()合并 leaf-user / leaf-system / empty 构造路径,lineage stamping 统一。Session.merge语义明确 — 始终保留self.sandbox;跨 sandbox merge 不再 raise。- Loop 性能 — 每轮 assistant+tools 只 sync 一次
chunk_table,修复 O(n²) 增长。 - OpenSandbox resume —
PersistedSession.to_resumable_pair走 reattach 而非新开容器。
其他改进
- Anthropic 流式 —
RathAnthropicChatClient.complete_stream()与run_session_loop(on_event=...)打通。 - Embedding / VLM Provider — 新增
EmbeddingProvider、VLMProvider及对应 OpenAI-compatible client;config 新增llm.embedding_provider/llm.vlm_provider。 - 稳定性 — 流式 TOCTOU 修复、OpenSandbox double-close 竞态修复、ConfigStore 按
(mtime_ns, size)缓存、session loop incremental tail rendering、类型安全收紧(社区 PR #10–#14)。 - 示例重构 —
example/重建为 01–10 编号学习阶梯;新增 memory local / openviking demo。 - README — 重写为 Multi-Agent Multi-Session 定位,补充 PyTorch 概念对照表。
- CI / 测试 — pytest-xdist 并行、pytest-timeout / pytest-rerunfailures;PR 与 main 分支 Python 矩阵拆分;OpenViking 独立 workflow。
安装
pip install --upgrade openrath
# 可选 memory backend
pip install --upgrade "openrath[openviking]"
# 可选 sandbox backend
pip install --upgrade "openrath[opensandbox]"兼容性
Session.merge沙箱语义变更:始终保留self.sandbox。- Lazy Session:读取 transcript / usage 时会阻塞同步。
- Memory 公开 URI 为
memory://;OpenViking 内部viking://由 adapter 转换。 - Python 3.10 – 3.13 支持。
完整变更: v1.1.0...v1.2.0
OpenRath v1.2.0
Building on v1.1.0's session runtime, sandbox backends, and durability layer, v1.2.0 introduces a full Memory plane, an internal async runtime, and a unified Session / Sandbox lifecycle. OpenRath moves from a multi-session orchestration framework toward a multi-agent × multi-session × durable memory runtime.
Major Features
Memory Plane
A new rath.memory module mirrors rath.backend — agent memory is now a first-class concept:
- Local Memory Backend (default) — ships with
pip install openrath, zero extra dependencies; supportsmemory://URIs, BM25 lexical search, optional embedding ranking, resource ingest, and LLM memo extraction on commit. - OpenViking Backend (optional) —
pip install "openrath[openviking]"for OpenViking integration; public API usesmemory://, with automaticviking://translation at the adapter boundary. - Agent Memory API —
flow.Agent(memory="local")binds a store and exposesremember_memory()/recall_memory()/commit_memory(); forward can auto-inject recalled context and optionally commit withcommit_on_forward. - Config-driven —
~/.openrath/config.jsongains amemorysection with named local store presets.
Quick start: python example/09_memory.py (remember / recall work without an API key).
Internal Async Runtime
A PyTorch-style private rath._async runtime. The public API stays fully synchronous — async behavior is transparent internally:
- Lazy Session —
run_session_loop()returns a Session immediately; readingchunk_table/cumulative_usageimplicitly synchronizes; lineage attributes remain eager. - Parallel tool scheduling — tool calls grouped by
resource_keyrun in parallel across keys (e.g. distinctfs:writepaths) and serially within a key (e.g. shellexec). - WAL persistence — session JSONL writes to
.__partial__for crash detection; async writer keeps the runtime loop unblocked. - Benchmark / stress — new
tests/bench/suite andscripts/stress.pyfor concurrency soak testing.
Major Optimization
Unified Session & Sandbox Lifecycle
- Lock-guarded
BackendSandboxacquire/release; close-on-zero runs outside the lock to eliminate races. backend.get(name)returns a per-process singleton so refcounts and per-backend caches stay coherent across sessions.Session.create()consolidates leaf-user / leaf-system / empty constructors with consistent lineage stamping.Session.mergesemantics clarified — always keepsself.sandbox; cross-sandbox merge no longer raises.- Loop performance — one
chunk_tablesync per assistant+tools turn instead of per row (fixes O(n²) growth). - OpenSandbox resume —
PersistedSession.to_resumable_pairreattaches existing handles instead of opening fresh containers.
Other Improvements
- Anthropic streaming —
RathAnthropicChatClient.complete_stream()wired intorun_session_loop(on_event=...). - Embedding / VLM providers — new
EmbeddingProvider,VLMProvider, and OpenAI-compatible clients; config addsllm.embedding_provider/llm.vlm_provider. - Stability — streaming TOCTOU fixes, OpenSandbox double-close race fix, ConfigStore cached by
(mtime_ns, size), incremental session-loop tail rendering, type-safety tightening (community PRs #10–#14). - Examples —
example/rebuilt as a numbered 01–10 learning ladder; new local / OpenViking memory demos. - README — rewritten around multi-agent multi-session positioning with a PyTorch concept mapping table.
- CI / testing — pytest-xdist parallelism, pytest-timeout / pytest-rerunfailures; split Python matrix for PR vs main; dedicated OpenViking workflow.
Install
pip install --upgrade openrath
# optional memory backend
pip install --upgrade "openrath[openviking]"
# optional sandbox backend
pip install --upgrade "openrath[opensandbox]"Compatibility
Session.mergesandbox semantics changed: always keepsself.sandbox.- Lazy Session: reading transcript / usage blocks until synchronized.
- Public memory URIs use
memory://; OpenViking's internalviking://is translated by the adapter. - Python 3.10 – 3.13 supported.
Full changelog: v1.1.0...v1.2.0