v1.3.0
OpenRath v1.3.0
在 v1.2.2 的 LiteLLM 接入与运行时健壮性之上,v1.3.0 把重心放在基础层加固与 Workflow 静态编译上。持久化写入、配置/凭据分离、环境变量解析、Provider 重绑定与 Workflow.compile() 构成一条连贯的「先 inspect、再 validate、再运行」路径;OpenSandbox 适配层与 CI 也去掉了对 --reruns 的依赖,用更长超时与有针对性的重试消除 flaky。没有 intentional 破坏性改动:内联 api_key 仍可加载并在下次保存时迁移到 credentials.json,compile() 为纯 opt-in。
核心特性
持久化与布局(atomic writes + manifest + GC)
rath.persistence.atomic—atomic_write_text/atomic_write_json:临时文件 +os.replace、路径级锁、Windows sharing-violation 重试;修复 Windows 并发保存 config 时的PermissionError。- Registry 原子化 — backend 远程沙箱 registry 与 local memory adapter 的 JSON 写入改为 atomic(此前为裸
write_text)。 rath.persistence.manifest— 根目录.openrath/manifest.json记录 layout 与各 plane 的 schema version;加载时拒绝比当前代码更新的 layout。rath.persistence.gc(older_than=..., dry_run=True)— 跨 sessions、sandboxes、memory stores 与 memory commits archive 的统一 retention/GC(此前 commits archive 无界增长)。
配置与环境(credentials 分离 + EnvSpec registry)
- Secrets 分离 —
config.json保留路由/presets;api_key等 secret 外置到 0600 的credentials.json;内联 key 仍可加载,保存时自动迁移。 backend配置段 — 新增backendsection,OpenSandbox 的 domain/flag 经 env → config →~/.sandbox.toml解析。rath.config.envEnvSpec registry — sync/async LLM、embedding、VLM、OpenSandbox 统一经 central registry 解析,替代散落的os.environ.get;embedding/VLM 补齐 config fallback。env_reference_markdown()— 从 registry 生成 env 变量参考表(API + 测试覆盖)。
Provider 作为可 .to() 切换的组件
AgentParam.to()/Session.to()/Workflow.to()— type-dispatched 重绑定 Provider;Session.to("local")等 bare string 仍表示 sandbox backend 名。- Loop provider 回退 —
run_session_loop/run_session_compress/select_session在agent_provider=None时回退到 session-bound provider;Agent 上的 provider 优先;bound provider 永不序列化。 chat_client_for缓存 — 按 provider HTTP identity 缓存已构造的 chat client(explicit-key only)。
Workflow.compile()(静态 manifest + 离线 validate + 生命周期)
Workflow.compile()→CompiledWorkflow— 静态遍历 module tree(嵌套Workflow/Agent像torch.nn.Module一样注册),构建ResourceManifest;Selector记为 dynamic 节点。CompiledWorkflow.validate()— 离线 pre-flight,不发起模型请求。with wf.compile() as cw:— 按 manifest acquire bound memory stores,exit 时逆序 release。example/12_compile.py— 无需 API key 的可运行示例;example ladder README 与 smoke tests 已同步。
修复
- OpenSandbox 冷启动 create 超时 — 120s API 预算 + 最多 3 次 transient 重试;默认 code-interpreter 镜像升至 v1.1.0(v1.0.2 已退役)。
- OpenSandbox stdout/exit_code 竞态 — 仅对含
print(的探针命令在空 stdout 时重跑一次,避免 mutating 命令被重复执行。 code.run挂死 — 默认 90s 超时 + 超时重试一次。- OpenSandbox CI flaky — 去掉
--reruns 2;动态预拉_DEFAULT_IMAGE+ warm-up script;42 passed / 4 skipped,无 RRF。
其他改进
- 依赖 —
opensandbox/openvikingextras 升级到最新兼容版本。 - 示例 — 新增
12_compile.py;offline smoke tests 覆盖 examples 02/06/12。 - CI — Lint、Test Fast、Build、OpenSandbox、OpenViking 全部通过。
安装
pip install --upgrade openrath
# 可选:多供应商接入
pip install --upgrade "openrath[litellm]"
# 可选 memory backend
pip install --upgrade "openrath[openviking]"
# 可选 sandbox backend
pip install --upgrade "openrath[opensandbox]"兼容性
- 向后兼容:内联
api_key仍可加载;compile()、credentials.json、manifest/GC 均为增量能力;Session.to("backend")语义不变。 - OpenSandbox 默认镜像 v1.0.2 → v1.1.0:若本地/CI 仍 pin 旧镜像需手动更新。
- 支持 Python 3.10 – 3.13。
完整变更: v1.2.2...v1.3.0
OpenRath v1.3.0
Building on v1.2.2's LiteLLM reach and runtime hardening, v1.3.0 focuses on foundation-layer hardening and Workflow static compilation. Atomic persistence, config/credential split, centralized env resolution, Provider rebinding via .to(), and Workflow.compile() form a coherent inspect → validate → run path; the OpenSandbox adapter and CI no longer rely on --reruns, using longer timeouts and targeted retries instead. No intentional breaking changes: inline api_key values still load and migrate to credentials.json on the next save; compile() is purely opt-in.
Major Features
Persistence & layout (atomic writes + manifest + GC)
rath.persistence.atomic—atomic_write_text/atomic_write_json: temp file +os.replace, path-keyed lock, Windows sharing-violation retry; fixes concurrent config savePermissionErroron Windows.- Atomic registries — backend remote-sandbox registry and local memory adapter JSON writes now go through atomic helpers (previously bare
write_text). rath.persistence.manifest— root.openrath/manifest.jsonrecords layout and per-plane schema versions; refuses a layout newer than the running code on load.rath.persistence.gc(older_than=..., dry_run=True)— unified retention/GC across sessions, sandboxes, memory stores, and the previously unbounded memory commits archive.
Config & environment (credential split + EnvSpec registry)
- Secret split —
config.jsonkeeps routing/presets; secrets such asapi_keymove to a 0600credentials.json; inline keys still load and migrate on save. backendconfig section — newbackendsection; OpenSandbox domain/flag resolves env → config →~/.sandbox.toml.rath.config.envEnvSpec registry — sync/async LLM, embedding, VLM, and OpenSandbox all resolve through one central registry instead of scatteredos.environ.get; embedding/VLM gain config fallback.env_reference_markdown()— generates an env-var reference table from the registry (API + test coverage).
Provider as a .to()-switchable component
AgentParam.to()/Session.to()/Workflow.to()— type-dispatched Provider rebinding; bare strings onSession.to("local")still mean sandbox backend names.- Loop provider fallback —
run_session_loop/run_session_compress/select_sessionfall back to a session-bound provider whenagent_provider=None; an Agent's provider always wins; bound providers are never serialized. chat_client_forcache — caches constructed chat clients by provider HTTP identity (explicit-key only).
Workflow.compile() (static manifest + offline validate + lifecycle)
Workflow.compile()→CompiledWorkflow— static pass over the module tree (nestedWorkflow/Agentregister liketorch.nn.Module) building aResourceManifest;Selectoris recorded as a dynamic node.CompiledWorkflow.validate()— offline pre-flight with no model calls.with wf.compile() as cw:— acquires bound memory stores from the manifest and releases in reverse order on exit.example/12_compile.py— runnable demo with no API key; example ladder README and smoke tests updated.
Fixes
- OpenSandbox cold-start create timeout — 120s API budget + up to 3 transient retries; default code-interpreter image bumped to v1.1.0 (v1.0.2 retired).
- OpenSandbox stdout/exit_code race — retries empty stdout only for
print(probe commands, avoiding double execution of mutating commands. code.runhang — default 90s timeout + one retry on timeout.- OpenSandbox CI flakiness — removed
--reruns 2; dynamic pre-pull of_DEFAULT_IMAGE+ warm-up script; 42 passed / 4 skipped, no RRF.
Other Improvements
- Dependencies —
opensandbox/openvikingextras upgraded to latest compatible releases. - Examples — new
12_compile.py; offline smoke tests for examples 02/06/12. - CI — Lint, Test Fast, Build, OpenSandbox, and OpenViking all pass.
Install
pip install --upgrade openrath
# optional: multi-provider reach
pip install --upgrade "openrath[litellm]"
# optional memory backend
pip install --upgrade "openrath[openviking]"
# optional sandbox backend
pip install --upgrade "openrath[opensandbox]"Compatibility
- Backward compatible: inline
api_keystill loads;compile(),credentials.json, manifest/GC are all additive;Session.to("backend")semantics unchanged. - OpenSandbox default image v1.0.2 → v1.1.0: update local/CI pins if you still target the old image.
- Python 3.10 – 3.13 supported.
Full changelog: v1.2.2...v1.3.0