Skip to content

v1.2.0

Choose a tag to compare

@Tokisakix Tokisakix released this 25 May 08:28
· 4 commits to main since this release

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 Backendpip install openrath 即可使用,零额外依赖;支持 memory:// URI、BM25 词法检索、可选 embedding 排序、Resource ingest,以及 Commit 时的 LLM 记忆提取。
  • OpenViking Backend(可选)pip install "openrath[openviking]" 接入 OpenViking;公开 API 统一为 memory://,adapter 边界自动与 viking:// 互转。
  • Agent 记忆 APIflow.Agent(memory="local") 绑定 store,提供 remember_memory() / recall_memory() / commit_memory()forward 时可自动 recall 注入,并可选 commit_on_forward
  • 配置驱动~/.openrath/config.json 新增 memory section,可命名多个 local store preset。

快速上手:python example/09_memory.py(remember / recall 无需 API key)。

内部 Async 运行时

引入 PyTorch 风格的私有 rath._async 运行时。对外 API 保持完全同步,async 能力在内部透明生效:

  • Lazy Sessionrun_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 生命周期统一

  • BackendSandbox acquire/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 — 新增 EmbeddingProviderVLMProvider 及对应 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; supports memory:// 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 uses memory://, with automatic viking:// translation at the adapter boundary.
  • Agent Memory APIflow.Agent(memory="local") binds a store and exposes remember_memory() / recall_memory() / commit_memory(); forward can auto-inject recalled context and optionally commit with commit_on_forward.
  • Config-driven~/.openrath/config.json gains a memory section 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 Sessionrun_session_loop() returns a Session immediately; reading chunk_table / cumulative_usage implicitly synchronizes; lineage attributes remain eager.
  • Parallel tool scheduling — tool calls grouped by resource_key run in parallel across keys (e.g. distinct fs:write paths) and serially within a key (e.g. shell exec).
  • WAL persistence — session JSONL writes to .__partial__ for crash detection; async writer keeps the runtime loop unblocked.
  • Benchmark / stress — new tests/bench/ suite and scripts/stress.py for concurrency soak testing.

Major Optimization

Unified Session & Sandbox Lifecycle

  • Lock-guarded BackendSandbox acquire/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.merge semantics clarified — always keeps self.sandbox; cross-sandbox merge no longer raises.
  • Loop performance — one chunk_table sync per assistant+tools turn instead of per row (fixes O(n²) growth).
  • OpenSandbox resume — PersistedSession.to_resumable_pair reattaches existing handles instead of opening fresh containers.

Other Improvements

  • Anthropic streamingRathAnthropicChatClient.complete_stream() wired into run_session_loop(on_event=...).
  • Embedding / VLM providers — new EmbeddingProvider, VLMProvider, and OpenAI-compatible clients; config adds llm.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).
  • Examplesexample/ 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.merge sandbox semantics changed: always keeps self.sandbox.
  • Lazy Session: reading transcript / usage blocks until synchronized.
  • Public memory URIs use memory://; OpenViking's internal viking:// is translated by the adapter.
  • Python 3.10 – 3.13 supported.

Full changelog: v1.1.0...v1.2.0