Skip to content

Commit b679ac1

Browse files
shanshan
authored andcommitted
release: cut v0.8.2
Ship the v0.8.2 release with runtime modularization, public API updates, and aligned docs/tests. Made-with: Cursor
1 parent 4e49c77 commit b679ac1

109 files changed

Lines changed: 5160 additions & 6427 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Changelog
22

3+
## [0.8.2] - 2026-04-30
4+
5+
### Public User API 收口与 runtime 架构拆分
6+
7+
`0.8.2` 把用户 API 和架构 API 明确分层:普通应用代码使用直觉命名的用户入口,runtime 机制对象留在 `loom.runtime`
8+
9+
- Public User API:新增并导出 `Instructions``Files``Web``Shell``MCP``Skill``Knowledge``Gateway``Cron`
10+
- Agent 构造:支持 `skills=``gateways=``harness=``quality=``governance=``delegation=``feedback=`,并归一到既有 runtime contract
11+
- Capabilities:`Files` / `Web` / `Shell` / `MCP` 作为 `capabilities=[...]` 的用户入口;`Skill` 作为 `skills=[...]` 的用户入口
12+
- 架构 API:`Capability``CapabilitySpec``CapabilitySource``CapabilityRegistry``RuntimeCapabilityProvider` 不再从顶层 `loom` 导出,保留在 `loom.runtime`
13+
- Runtime 拆分:`AgentEngine` 执行细节收敛到 `ContextRuntime``MemoryRuntime``SignalRuntime``ToolRuntime``ProviderRuntime``LoopRunner``HarnessRunner``RunLifecycle` 等内部组件
14+
- Capability compiler:显式编译 `tools + capabilities`,并检测重复 tool name
15+
- Provider 配置:`Model.*(..., api_key=..., timeout=..., max_retries=...)` 继续由 `Model` 作为 provider 配置入口,并传递到 OpenAI、Anthropic、OpenAI-compatible 和 Ollama provider
16+
- 兼容层:移除 `loom.compat.v0` 和旧兼容导出路径,降低后续 API 迭代成本
17+
- 文档:README、wiki、cookbook 和 API reference 改为 `Agent + Model + Runtime``Files/Web/Shell/MCP/Skill` 用户路径
18+
19+
### Validation
20+
21+
- `poetry run ruff check .`
22+
- `poetry run pytest -q`
23+
- 当前回归结果:`588 passed`
24+
25+
---
26+
327
## [0.8.1] - 2026-04-28
428

529
### 子系统补齐与 API 语义收口
@@ -93,10 +117,9 @@ agent = Agent(
93117

94118
### Compatibility Policy
95119

96-
- `0.8.x` 保留 legacy public API compatibility surface
97-
- `loom.compat.v0` 支持到 `0.8.x`
98-
- `0.9.0` 计划移除旧兼容层
99-
- 新文档和示例以 `from loom import Agent, Model, Runtime, Capability` 为主路径
120+
- `0.8.0` 发布时保留 legacy public API compatibility surface
121+
- `loom.compat.v0``0.8.0` / `0.8.1` 中作为过渡层存在
122+
- `0.8.2` 已移除旧兼容层,并把新文档和示例收敛到 `Agent + Model + Runtime``Files/Web/Shell/MCP/Skill` 用户路径
100123

101124
### Validation
102125

README.md

Lines changed: 83 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@
2222
Loom is an embeddable Agent SDK that helps developers build agent platform capabilities similar to [Hermes](https://github.com/nousresearch/hermes-agent) and [OpenClaw](https://github.com/openclaw/openclaw) with less overhead. It is not a gateway product, cron service, dashboard, or skill marketplace. The kernel gives application developers a stable language for building agent runtimes:
2323

2424
```text
25-
Agent + Runtime + Capability
25+
Agent + Model + Runtime
26+
+ capabilities=[Files/Web/Shell/MCP]
27+
+ skills=[Skill]
2628
-> Run / Session
2729
-> RuntimeTask / RuntimeSignal
2830
-> Context / Continuity / Harness / Quality / Governance / Feedback
2931
```
3032

31-
The `0.8.0` line stabilizes this runtime kernel. The `0.8.1` line completes the subsystem shortcuts for orchestration, knowledge, cron, and the new `MemorySource` API. Legacy 0.x compatibility imports remain available through `0.8.x` and are scheduled for removal in `0.9.0`.
33+
The `0.8.x` line centers the public SDK on this runtime kernel and its subsystem shortcuts for orchestration, knowledge, cron, and `MemorySource`.
3234

3335
## Search Keywords
3436

@@ -70,23 +72,36 @@ Teams that need an embeddable Python agent SDK with modular orchestration, memor
7072

7173
## Runtime Kernel And Subsystems
7274

73-
The runtime kernel is the shared execution boundary for Loom subsystems. Each subsystem is configured from the user-side `Agent(...)` API, normalized into `Runtime` and `Capability` objects, and then executed through the same run/session loop:
75+
The runtime kernel is the shared execution boundary for Loom subsystems. Loom keeps a strict three-layer shape:
7476

7577
```text
76-
Agent API
77-
-> RuntimeConfig + CapabilitySpec + Source configs
78+
Public SDK Layer
79+
Agent / Session / Run / RuntimeTask / RuntimeSignal
80+
81+
Assembly Layer
82+
config normalization / provider resolution / tool compilation / ecosystem activation
83+
84+
Runtime Kernel
85+
AgentEngine / Context / L* loop / governed tools / policies / state
86+
```
87+
88+
Each subsystem is configured from the user-side `Agent(...)` API, normalized into `Runtime`, `Capability`, and source objects, and then executed through the same run/session loop:
89+
90+
```text
91+
Agent(...)
92+
-> RuntimeConfig + CapabilitySpec + source configs
7893
-> AgentEngine
79-
-> Context partitions + RuntimeSignal + governed tools
94+
-> Context partitions + RuntimeSignal + governed capability path
8095
-> Harness / Quality / Continuity / Feedback
8196
```
8297

83-
The seven user-facing subsystems depend on the kernel in different ways:
98+
The user-facing subsystems depend on the kernel in different ways:
8499

85100
| Subsystem | Kernel dependency | Capability provided |
86101
|---|---|---|
87102
| Tool Use | `Capability`, tool registry, `GovernancePolicy` | Exposes Python tools, shell, files, web, MCP, and builtin tools behind permission, read-only, rate-limit, and veto checks. |
88-
| Memory | `ContextProtocol`, memory partition, session restore, `MemorySource` lifecycle | Recalls durable application memory at run start and writes extracted memories at run end, separate from session history. |
89-
| Skills | `Capability.skill(...)`, ecosystem loader, tool registry | Loads task-specific instructions and tools progressively without making every skill part of the base prompt. |
103+
| Memory | `ContextPolicy`, memory partition, session restore, `MemorySource` lifecycle | Recalls durable application memory at run start and writes extracted memories at run end, separate from session history. |
104+
| Skills | `Skill`, ecosystem loader, tool registry | Loads task-specific instructions and tools progressively without making every skill part of the base prompt. |
90105
| Harness | `Runtime.harness`, `HarnessRequest`, `HarnessOutcome`, `QualityGate` | Controls how a run is attempted: single pass, generator/evaluator loops, custom candidate generation, human gates, or external workflows. |
91106
| Gateway / Orchestration | `RuntimeSignal`, `AttentionPolicy`, `DelegationPolicy`, coordinator | Normalizes external events and subtask delegation into the same signal and runtime decision path. |
92107
| Knowledge | `KnowledgeSource`, `KnowledgeResolver`, `C_working.knowledge_surface` | Injects run-scoped evidence, active questions, citations, and on-demand retrieval without polluting long-term memory. |
@@ -103,6 +118,14 @@ At run time these subsystems cooperate through the same loop:
103118

104119
This keeps integrations modular: new gateways, schedulers, retrievers, memory stores, or skills do not bypass the kernel; they adapt into the kernel contracts.
105120

121+
The governed capability path is intentionally explicit:
122+
123+
```text
124+
Tool request -> Hook -> Permission -> Veto -> Rate limit -> Execute -> Observe
125+
```
126+
127+
`tools` are precise Python function tools. `capabilities` are higher-level declarations such as files, web, shell, MCP, skills, or plugins. Both compile into the same governed tool path.
128+
106129
## Install
107130

108131
```bash
@@ -115,7 +138,7 @@ export ANTHROPIC_API_KEY=sk-ant-...
115138
```python
116139
import asyncio
117140

118-
from loom import Agent, Capability, Generation, Model, Runtime, tool
141+
from loom import Agent, Files, Generation, Model, Runtime, Web, tool
119142

120143

121144
@tool(description="Search documentation", read_only=True)
@@ -129,8 +152,8 @@ async def main():
129152
instructions="You are a concise coding assistant.",
130153
tools=[search_docs],
131154
capabilities=[
132-
Capability.files(read_only=True),
133-
Capability.web(),
155+
Files(read_only=True),
156+
Web.enabled(),
134157
],
135158
generation=Generation(max_output_tokens=512),
136159
runtime=Runtime.sdk(),
@@ -150,13 +173,19 @@ Use `from loom import ...` for normal application code:
150173
```python
151174
from loom import (
152175
Agent,
153-
Capability,
176+
Cron,
177+
Files,
178+
Gateway,
154179
Harness,
155180
HarnessCandidate,
156181
HarnessOutcome,
157182
HarnessRequest,
183+
Instructions,
184+
Knowledge,
158185
KnowledgeResolver,
159186
KnowledgeSource,
187+
MCP,
188+
Memory,
160189
MemoryConfig,
161190
MemoryExtractor,
162191
MemoryQuery,
@@ -172,8 +201,11 @@ from loom import (
172201
ScheduleConfig,
173202
ScheduledJob,
174203
SessionConfig,
204+
Shell,
175205
SignalAdapter,
206+
Skill,
176207
RunContext,
208+
Web,
177209
tool,
178210
)
179211
```
@@ -192,9 +224,11 @@ Agent(...)
192224

193225
Advanced configuration objects still live behind the same public facade or `loom.config`:
194226

195-
- `AgentConfig`, `ModelRef`, `GenerationConfig`, and `create_agent()` remain available through `0.8.x`.
196-
- New docs and examples prefer `Agent`, `Model`, `Generation`, `Runtime`, and `Capability`.
197-
- `loom.compat.v0` is the explicit legacy compatibility surface and is planned for removal in `0.9.0`.
227+
- Application code should start from `Agent(...)`.
228+
- New docs and examples use `Agent`, `Model`, `Generation`, `Runtime`, `Memory`,
229+
`Knowledge`, `Skill`, `Gateway`, `Cron`, and capability entries such as
230+
`Files`, `Web`, `Shell`, and `MCP`.
231+
- Lower-level configuration objects remain available through `loom.config`.
198232

199233
## Runtime Language
200234

@@ -222,7 +256,7 @@ Runtime policies are composed through `Runtime`:
222256

223257
```python
224258
from loom import (
225-
ContextProtocol,
259+
ContextPolicy,
226260
ContinuityPolicy,
227261
DelegationPolicy,
228262
FeedbackPolicy,
@@ -234,7 +268,7 @@ from loom import (
234268
)
235269

236270
runtime = Runtime(
237-
context=ContextProtocol.manager(max_tokens=120000),
271+
context=ContextPolicy.manager(max_tokens=120000),
238272
continuity=ContinuityPolicy.handoff(),
239273
harness=Harness.single_run(),
240274
quality=QualityGate.criteria(["tests stay green"]),
@@ -325,17 +359,20 @@ advanced = Agent(
325359

326360
## Capabilities
327361

328-
`Capability` is the user-side language for what an agent can do. Built-in capabilities compile into the same governed tool path as explicit function tools.
362+
Use direct capability entries for common ability surfaces. They compile into the
363+
same governed tool path as explicit function tools.
329364

330365
```python
331366
agent = Agent(
332367
model=Model.openai("gpt-5.1"),
333368
capabilities=[
334-
Capability.files(read_only=True),
335-
Capability.web(),
336-
Capability.shell(require_approval=True),
337-
Capability.mcp("github", command="github-mcp", connect=False),
338-
Capability.skill(
369+
Files(read_only=True),
370+
Web.enabled(),
371+
Shell.approval_required(),
372+
MCP.server("github", command="github-mcp", connect=False),
373+
],
374+
skills=[
375+
Skill.inline(
339376
"repo-review",
340377
content="# Review\nCheck diffs, risks, and test results.",
341378
when_to_use="review,diff",
@@ -347,6 +384,20 @@ agent = Agent(
347384

348385
Capability use is checked by `GovernancePolicy`, including permission, veto, rate-limit, read-only, and destructive-operation boundaries.
349386

387+
Use `tools=` when you already have a concrete Python callable to register. Use `capabilities=` when you want to grant a class of abilities that Loom compiles into tools at runtime.
388+
389+
| Input | User intent | Runtime result |
390+
|---|---|---|
391+
| `tools=[fn]` | Add one exact function tool | `ToolSpec -> ToolRegistry` |
392+
| `Files(read_only=True)` | Grant file access | Built-in file toolset |
393+
| `Web.enabled()` | Grant web research | Built-in web toolset |
394+
| `Shell.approval_required()` | Grant shell execution | Shell toolset with approval policy |
395+
| `MCP.server("github")` | Attach external MCP tools | MCP activation + scoped tools |
396+
| `Skill.inline("review", ...)` | Add task-specific behavior | Skill activation + optional tools/context |
397+
398+
`Capability` remains available from `loom.runtime` for advanced architecture-level
399+
declarations, but the documented user path uses the direct domain names above.
400+
350401
## Runtime Signals
351402

352403
Gateway events, cron jobs, heartbeat alerts, webhooks, and application callbacks should all enter the kernel as `RuntimeSignal`. The runtime does not distinguish producers; `AttentionPolicy` decides whether a signal is observed, queued for a run, or treated as an interrupt.
@@ -521,7 +572,7 @@ agent = Agent(
521572
)
522573
```
523574

524-
At run start, each `MemorySource` retrieves records and injects them into the memory partition. At run end, its extractor can produce records and write them through the store. `MemoryProvider` remains available as a legacy compatibility bridge in `0.8.x`; new code should use `MemorySource`.
575+
At run start, each `MemorySource` retrieves records and injects them into the memory partition. At run end, its extractor can produce records and write them through the store. `MemorySource` is the single public extension point for durable memory integrations.
525576

526577
## Hooks And Events
527578

@@ -629,8 +680,8 @@ result = await agent.run(
629680
## Architecture
630681

631682
```text
632-
loom/agent.py public Agent API and compatibility factory
633-
loom/config.py public config facade and 0.8 aliases
683+
loom/agent.py public Agent API
684+
loom/config.py public advanced config facade
634685
loom/runtime/ runs, sessions, engine, signals, policies
635686
loom/context/ partitions, compression, renewal, handoff
636687
loom/tools/ tool registry, execution, governance path
@@ -651,22 +702,21 @@ The kernel concepts are:
651702
| `RuntimeTask` | Structured work request |
652703
| `RuntimeSignal` | External input from gateways, cron, heartbeat, apps |
653704
| `AttentionPolicy` | Decides how signals affect execution |
654-
| `ContextProtocol` | Context partitioning, rendering, compaction, renewal |
705+
| `ContextPolicy` | Context partitioning, rendering, compaction, renewal |
655706
| `ContinuityPolicy` | Continuation after reset or compaction |
656707
| `Harness` | Long-task execution strategy |
657708
| `QualityGate` | Acceptance criteria and PASS/FAIL evaluation |
658709
| `DelegationPolicy` | Subtask and sub-agent dispatch boundary |
659-
| `Capability` | Tools, Toolsets, MCP, skills, and future ability sources |
710+
| `Files` / `Web` / `Shell` / `MCP` / `Skill` | User-facing ability and skill declarations |
660711
| `GovernancePolicy` | Permission, veto, rate limit, read-only/destructive checks |
661712
| `FeedbackPolicy` | Runtime feedback collection and evolution input |
662713

663714
## Version Policy
664715

665716
- `0.8.0` is the public API stabilization line for the SDK runtime kernel.
666717
- `0.8.1` completes the seven subsystem integration layer: Tool Use, Memory, Skills, Harness, Gateway/Orchestration, Knowledge, and Cron.
667-
- `0.8.x` keeps compatibility exports for existing applications.
668-
- `loom.compat.v0` is the explicit legacy compatibility namespace.
669-
- `0.9.0` removes the legacy compatibility surface.
718+
- `0.8.2` separates the intuitive public user API from runtime mechanism APIs and removes the old compat layer.
719+
- Public docs and examples stay centered on `Agent + Model + Runtime` with direct user-facing ability declarations.
670720

671721
## Validation
672722

@@ -678,7 +728,7 @@ poetry run mypy loom
678728
poetry run pytest -q
679729
```
680730

681-
Latest full suite during the 0.8.1 subsystem pass: `565 passed`.
731+
Latest full suite during the 0.8.2 API convergence pass: `588 passed`.
682732

683733
## License
684734

loom/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
Loom exposes one public SDK API centered on `Agent`.
44

55
```python
6-
from loom import Agent, Capability, Model, Runtime
6+
from loom import Agent, Files, Model, Runtime, Web
77

88
agent = Agent(
99
model=Model.anthropic("claude-sonnet-4"),
1010
instructions="You are a coding assistant",
1111
capabilities=[
12-
Capability.files(read_only=True),
13-
Capability.web(),
12+
Files(read_only=True),
13+
Web.enabled(),
1414
],
1515
runtime=Runtime.sdk(),
1616
)
@@ -24,21 +24,21 @@ print(result.output)
2424
Use the package in three layers:
2525

2626
- `loom`: primary application-facing entry point
27-
- `loom.config`: advanced configuration and compatibility objects
27+
- `loom.config`: advanced configuration objects
2828
- `loom.runtime`: runtime mechanism contracts and internals
2929

3030
Typical application imports stay small:
3131

3232
```python
33-
from loom import Agent, Capability, Model, Runtime, SessionConfig, RunContext, tool
33+
from loom import Agent, Files, Model, Runtime, SessionConfig, RunContext, Web, tool
3434
```
3535

36-
Compatibility imports such as `AgentConfig`, `ModelRef`, `GenerationConfig`, and `create_agent()` remain available through `0.8.x`, but new code should prefer `Agent(...)`.
36+
Application code should use `Agent(...)`; lower-level configuration objects remain under `loom.config`.
3737

3838
## Package Structure
3939

40-
- `agent.py` - public Agent API and compatibility factory
41-
- `config.py` - public config facade and 0.8 aliases
40+
- `agent.py` - public Agent API
41+
- `config.py` - public config facade
4242
- `runtime/` - sessions, runs, engine, signals, capabilities, policies
4343
- `context/` - context partitions, compression, renewal
4444
- `memory/` - session, semantic, persistent memory

0 commit comments

Comments
 (0)