nextloop 0.5.0rc1__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nextloop-0.5.0rc1/src/nextloop.egg-info → nextloop-0.6.0}/PKG-INFO +44 -14
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/README.md +42 -13
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/adr/0003-python-and-centralized-contracts.md +1 -1
- nextloop-0.6.0/docs/adr/0004-event-compatibility.md +27 -0
- nextloop-0.6.0/docs/adr/0005-pending-input.md +32 -0
- nextloop-0.6.0/docs/adr/0006-operation-id.md +24 -0
- nextloop-0.6.0/docs/adr/0007-approval.md +25 -0
- nextloop-0.6.0/docs/architecture/development-plan.md +71 -0
- nextloop-0.6.0/docs/architecture/discussion-roadmap.md +50 -0
- nextloop-0.6.0/docs/architecture/feature-worklist.md +34 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/architecture/requirements.md +4 -4
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/design/agent-loop.md +38 -28
- nextloop-0.6.0/docs/design/architecture.md +69 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/design/harness.md +19 -1
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/design/loop-interface.md +20 -8
- nextloop-0.6.0/docs/design/verification-matrix.md +109 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/examples/workers/python_worker.py +8 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/pyproject.toml +2 -1
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/__init__.py +8 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/adapters/anthropic.py +23 -2
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/adapters/memory.py +13 -3
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/adapters/observing.py +22 -3
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/adapters/openai.py +30 -5
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/adapters/sqlite.py +22 -6
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/cli.py +1 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/contracts.py +79 -5
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/driver.py +65 -39
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/events/__init__.py +2 -0
- nextloop-0.6.0/src/nextloop/events/approval.py +145 -0
- nextloop-0.6.0/src/nextloop/events/input.py +29 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/events/outcome.py +62 -21
- nextloop-0.6.0/src/nextloop/events/pending.py +25 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/events/project.py +70 -2
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/events/repair.py +55 -5
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/events/response.py +8 -2
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/events/trace.py +10 -1
- nextloop-0.6.0/src/nextloop/events/upcast.py +47 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/execute/batch.py +24 -3
- nextloop-0.6.0/src/nextloop/execute/cancellation.py +29 -0
- nextloop-0.6.0/src/nextloop/execute/cleanup.py +22 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/execute/mcp.py +41 -18
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/execute/model.py +5 -24
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/execute/result_read.py +20 -16
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/execute/stdio.py +14 -22
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/execute/stdio_transport.py +31 -6
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/execute/tools.py +10 -23
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/harness.py +15 -0
- nextloop-0.6.0/src/nextloop/loop.py +758 -0
- nextloop-0.6.0/src/nextloop/testing.py +308 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0/src/nextloop.egg-info}/PKG-INFO +44 -14
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop.egg-info/SOURCES.txt +26 -0
- nextloop-0.6.0/tests/test_approval.py +398 -0
- nextloop-0.6.0/tests/test_approval_regressions.py +304 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_cli.py +8 -1
- nextloop-0.6.0/tests/test_compaction_lineage.py +75 -0
- nextloop-0.6.0/tests/test_complexity_regressions.py +56 -0
- nextloop-0.6.0/tests/test_fault_injection.py +131 -0
- nextloop-0.6.0/tests/test_fault_matrix.py +247 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_harness.py +1 -1
- nextloop-0.6.0/tests/test_import_contract.py +207 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_mcp.py +25 -2
- nextloop-0.6.0/tests/test_mcp_hardening.py +84 -0
- nextloop-0.6.0/tests/test_observability_close_deadline.py +53 -0
- nextloop-0.6.0/tests/test_operations.py +330 -0
- nextloop-0.6.0/tests/test_pending_inputs.py +290 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_preview.py +1 -0
- nextloop-0.6.0/tests/test_projection_parity.py +17 -0
- nextloop-0.6.0/tests/test_provider_terminal.py +105 -0
- nextloop-0.6.0/tests/test_result_budget_regressions.py +51 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_result_policies.py +18 -9
- nextloop-0.6.0/tests/test_retry_regressions.py +148 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_skills.py +1 -1
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_stdio.py +12 -1
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_store_contract.py +31 -2
- nextloop-0.6.0/tests/test_upcasting.py +162 -0
- nextloop-0.5.0rc1/docs/architecture/development-plan.md +0 -47
- nextloop-0.5.0rc1/docs/architecture/discussion-roadmap.md +0 -53
- nextloop-0.5.0rc1/docs/architecture/feature-worklist.md +0 -30
- nextloop-0.5.0rc1/docs/design/verification-matrix.md +0 -93
- nextloop-0.5.0rc1/src/nextloop/execute/cleanup.py +0 -17
- nextloop-0.5.0rc1/src/nextloop/loop.py +0 -189
- nextloop-0.5.0rc1/src/nextloop/testing.py +0 -67
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/LICENSE +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/MANIFEST.in +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/adr/0001-embeddable-agent-loop.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/adr/0002-dsh-aligned-agent-loop.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/architecture/agent-loop-capability-review.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/design/context-builder.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/design/react-protocol.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/design/skills.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/research/2026-11-02-dsh-primary-sources.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/research/2026-11-02-loop-evidence-notes.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/research/2026-11-03-hermes-turn-control.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/research/2026-11-03-tool-batch-failures.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/research/2026-11-03-tool-call-validation.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/research/2026-11-03-yomi-turn-control.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/research/2026-11-06-open-source-agent-loops.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/research/2026-11-06-react-tool-event-recovery.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/docs/research/2026-11-10-nextloop-optimization-review.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/examples/basic.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/examples/harness-skills/echo/SKILL.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/examples/harness.toml +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/examples/live_smoke.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/examples/python_tools.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/examples/skills/coding/SKILL.md +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/examples/skills_demo.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/examples/workers/cpp_worker.cpp +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/examples/workers/rust_worker.rs +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/setup.cfg +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/adapters/__init__.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/adapters/_sse.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/execute/__init__.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/execute/composite.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/execute/preview.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/py.typed +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop/skills.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop.egg-info/dependency_links.txt +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop.egg-info/entry_points.txt +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop.egg-info/requires.txt +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/src/nextloop.egg-info/top_level.txt +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_aggregate_close.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_budgets.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_correctness_regressions.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_events.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_failures.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_harness_injection.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_loop.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_observability.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_providers.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_review_regressions.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_stdio_cleanup.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_stdio_frames.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_stdio_safety.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_stores.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_surface_snapshot.py +0 -0
- {nextloop-0.5.0rc1 → nextloop-0.6.0}/tests/test_worker_conformance.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nextloop
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: An embeddable AgentLoop with explicit event, tool, recovery, and delivery semantics
|
|
5
5
|
Author-email: 12bitsD <bis12@163.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -10,6 +10,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.11
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.12
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
14
|
Classifier: Typing :: Typed
|
|
14
15
|
Requires-Python: >=3.11
|
|
15
16
|
Description-Content-Type: text/markdown
|
|
@@ -30,16 +31,16 @@ Dynamic: license-file
|
|
|
30
31
|
|
|
31
32
|
**Small core. Serious runtime semantics.**
|
|
32
33
|
|
|
33
|
-
nextloop is an embeddable Python AgentLoop for developers who want to build their own agent runtime — not inherit a heavyweight framework. Deterministic
|
|
34
|
+
nextloop is an embeddable Python AgentLoop for developers who want to build their own agent runtime — not inherit a heavyweight framework. Deterministic scheduling and state folding, append-only history, explicit crash recovery, typed Tools, and committed-event observability, all in a package you can actually read.
|
|
34
35
|
|
|
35
36
|
**Your agent, your rules. No magic, no black box.**
|
|
36
37
|
|
|
37
|
-
Current version: **0.
|
|
38
|
+
Current version: **0.6.0**.
|
|
38
39
|
|
|
39
40
|
## Install
|
|
40
41
|
|
|
41
42
|
```bash
|
|
42
|
-
python -m pip install nextloop==0.
|
|
43
|
+
python -m pip install nextloop==0.6.0
|
|
43
44
|
```
|
|
44
45
|
|
|
45
46
|
For local development:
|
|
@@ -63,9 +64,9 @@ It is a library, not an HTTP service, product bot, Router, EventBus, or multi-ag
|
|
|
63
64
|
|
|
64
65
|
## Under the hood
|
|
65
66
|
|
|
66
|
-
-
|
|
67
|
-
- Append-only Trajectory
|
|
68
|
-
-
|
|
67
|
+
- Session/Turn/Step execution with 4D integer coordinates and writer fencing.
|
|
68
|
+
- Append-only Trajectory with `surface_op` watermark semantics and Turn-private surface snapshots.
|
|
69
|
+
- Log-derived Pending Input and in-memory inbox signaling for steer and final commitment.
|
|
69
70
|
- Whole-batch Tool Schema validation, bounded parallel calls, and exclusive failure barriers.
|
|
70
71
|
- Closed five-variant `ToolOutcome`: `Completed`, `Skipped`, `Cancelled`, `UncertainSettled`, `UncertainHanging`.
|
|
71
72
|
- Bounded Provider retries, protocol correction, WorkingContext, Compaction, and cancellation.
|
|
@@ -87,9 +88,29 @@ AgentLoop.run(TurnContext) -> TurnOutcome
|
|
|
87
88
|
AgentLoop.steer(session_id, content, *, input_id=None) -> bool
|
|
88
89
|
AgentLoop.cancel(session_id, cause="user_stop") -> bool
|
|
89
90
|
AgentLoop.recover(session_id, store, delivery) -> RecoveryOutcome
|
|
91
|
+
AgentLoop.pending_inputs(session_id, store) -> tuple[PendingInput, ...]
|
|
92
|
+
AgentLoop.resume(context, *, decisions=None, reject_all=False, new_input=None) -> TurnOutcome
|
|
93
|
+
AgentLoop.retry_operation(context, operation_id) -> TurnOutcome
|
|
94
|
+
AgentLoop.resource_locks(session_id, store) -> frozenset[str]
|
|
95
|
+
AgentLoop.release_resource(session_id, store, resource, *, actor, evidence) -> bool
|
|
90
96
|
```
|
|
91
97
|
|
|
92
|
-
|
|
98
|
+
Core adapter seams are `EventStore`, `ModelProvider`, `ToolRuntime`, and `DeliveryOwner`. Additional extension points include `PreviewSink`, Exporters, Skills, and stdio/MCP workers. Context projection and Compaction are built in and configured through `LoopConfig`.
|
|
99
|
+
|
|
100
|
+
## Guarantees and non-guarantees
|
|
101
|
+
|
|
102
|
+
| Area | Guarantee | Not a guarantee |
|
|
103
|
+
|---|---|---|
|
|
104
|
+
| Accepted input | Accepted inputs are projected from the log by `input_id` and can be queried with `AgentLoop.pending_inputs`. Explicit IDs are non-empty; identical retries deduplicate, conflicting content is rejected without consuming the original. | Automatic deduplication when callers retry with a different or missing ID. |
|
|
105
|
+
| Delivery | Delivery is at least once; DeliveryOwner must deduplicate by stable `final_message_id`. | Exactly-once delivery or delivery without an idempotent owner. |
|
|
106
|
+
| Tool execution | The library never automatically replays an already dispatched Tool. Explicit reconciliation is limited to READ_ONLY and IDEMPOTENT operations. | No duplicate external effect when a model reissues a call or a Tool is not idempotent. |
|
|
107
|
+
| Resource locks | Unresolved uncertain results retain declared resources; otherwise NON_IDEMPOTENT uses the Tool name. Successful reconciliation releases all locks associated with the operation. | Global idempotency across different resources or operations, or safe concurrent execution of NON_IDEMPOTENT calls. |
|
|
108
|
+
| Approval | Any approval-required item suspends the whole batch before dispatch. Resume requires explicit decisions, binds original IDs/arguments, and rechecks expiry and prior dispatch inside the Session lock. | Automatic approval, execution before a durable grant, or replay after dispatch without recovery. |
|
|
109
|
+
| Event compatibility | Schema 1.0 is upcast only during reads; original payload bytes are preserved for idempotent append. | Reading schema 1.1 with 0.5.0 or earlier, or accepting unknown future schemas. |
|
|
110
|
+
| Recovery | Recovery writes crash closers; the caller starts a new Turn with projected prior messages and Pending Input. | In-place replay of the interrupted Turn or automatic execution of uncertain calls. |
|
|
111
|
+
| Preview | Preview is transient and cannot execute partial Tool arguments. | Preview as a durable EventStore fact or a substitute for committed Delivery. |
|
|
112
|
+
| Observability | Committed Events are authoritative and can be replayed for history. | The current in-memory Exporter queue as a durable outbox. |
|
|
113
|
+
| MCP | stdio lifecycle, paginated static catalogs, operation metadata, and uncertain crash handling. | Remote MCP, OAuth, dynamic `listChanged`, or non-text content mapping. |
|
|
93
114
|
|
|
94
115
|
`Harness.load("harness.toml")` assembles those adapters without changing the Loop. Use `await harness.check()` for offline validation and `await harness.run("input")` for a model-backed Turn. See [Harness and extension interface](docs/design/harness.md) for the strict TOML schema, stdio protocol, lifecycle rules, and CLI.
|
|
95
116
|
|
|
@@ -188,33 +209,41 @@ src/nextloop/
|
|
|
188
209
|
events/ # pure projection, response/outcome folds, crash repair
|
|
189
210
|
execute/ # model retries, Tool registration, batch scheduling
|
|
190
211
|
adapters/ # SQLite, memory, OpenAI, Anthropic
|
|
212
|
+
testing.py # Store conformance and deterministic fault injection
|
|
191
213
|
```
|
|
192
214
|
|
|
193
215
|
`events/` performs no I/O. `execute/` owns side effects and classified failures. `driver.py` only composes them.
|
|
194
216
|
|
|
195
217
|
## Verification
|
|
196
218
|
|
|
197
|
-
The release
|
|
219
|
+
The release checks cover:
|
|
198
220
|
|
|
199
221
|
- text, Tool, multi-Step, mixed, empty, truncated, and malformed responses;
|
|
200
222
|
- whole-batch rejection and parallel/exclusive scheduling with deterministic gates;
|
|
201
223
|
- steer/final ordering, cancellation, WorkingContext, and Compaction;
|
|
202
224
|
- protocol exhaustion, exact-byte retry, and partial-output failure;
|
|
225
|
+
- every append point on Memory and SQLite, before and after commit, with recovery and no-replay assertions;
|
|
226
|
+
- Tool/Delivery side-effect failures, writer takeover, late results, parallel partial completion, and repeated recovery;
|
|
227
|
+
- public Store conformance plus deliberately broken Store rejection;
|
|
203
228
|
- resource-lock recovery, conflict prevention, and explicit release;
|
|
204
229
|
- real subprocess exits during Tool execution and final delivery, followed by SQLite recovery;
|
|
205
230
|
- recorded OpenAI and Anthropic SSE streams;
|
|
206
231
|
- 12 live Kimi scenarios across both protocols, real Tool usage, parallel execution, recovery, steer, cancellation, Compaction, and WorkingContext;
|
|
207
232
|
- live DeepSeek text + Preview + usage and real Tool Call + Delivery smoke;
|
|
208
|
-
-
|
|
233
|
+
- a 10,505-event benchmark with cross-Store, incremental, and required-content parity;
|
|
234
|
+
- 341 offline tests, `ruff`, `mypy`, wheel/sdist builds, `twine check`, and clean wheel installation.
|
|
209
235
|
|
|
210
236
|
Current limits:
|
|
211
237
|
|
|
212
238
|
- nika integration is separate acceptance work.
|
|
213
|
-
- Concurrent writers across multiple processes fail closed; they are not coordinated.
|
|
214
|
-
- Large-asset lifecycle, backup, and GC are not part of this release
|
|
239
|
+
- Concurrent writers across multiple processes fail closed; they are not coordinated by time-based leases.
|
|
240
|
+
- Large-asset lifecycle, backup, and GC are not part of this release.
|
|
241
|
+
- Official OpenAI and Anthropic API acceptance remains a 1.0 hard gate; recorded streams and DeepSeek do not substitute for it.
|
|
215
242
|
|
|
216
243
|
## Documents
|
|
217
244
|
|
|
245
|
+
- [Architecture and import contract](docs/design/architecture.md)
|
|
246
|
+
- [Domain glossary](CONTEXT.md)
|
|
218
247
|
- [AgentLoop design](docs/design/agent-loop.md)
|
|
219
248
|
- [Public interface](docs/design/loop-interface.md)
|
|
220
249
|
- [Harness and extension interface](docs/design/harness.md)
|
|
@@ -222,11 +251,12 @@ Current limits:
|
|
|
222
251
|
- [Directory-based SkillRegistry](docs/design/skills.md)
|
|
223
252
|
- [Verification matrix](docs/design/verification-matrix.md)
|
|
224
253
|
- [Development plan](docs/architecture/development-plan.md)
|
|
254
|
+
- [Contributing](CONTRIBUTING.md) and [Security](SECURITY.md)
|
|
225
255
|
- [Changelog](CHANGELOG.md)
|
|
226
|
-
- [ADR-0002](docs/adr/0002-dsh-aligned-agent-loop.md)
|
|
256
|
+
- [ADR-0002](docs/adr/0002-dsh-aligned-agent-loop.md), [ADR-0003](docs/adr/0003-python-and-centralized-contracts.md), [ADR-0004 Event compatibility](docs/adr/0004-event-compatibility.md), [ADR-0005 Pending Input](docs/adr/0005-pending-input.md), [ADR-0006 Operation identity](docs/adr/0006-operation-id.md), and [ADR-0007 Approval](docs/adr/0007-approval.md)
|
|
227
257
|
|
|
228
258
|
## Release
|
|
229
259
|
|
|
230
|
-
CI covers Python 3.11, 3.12, and 3.
|
|
260
|
+
CI covers Python 3.11, 3.12, 3.13, and 3.14. A `v*` tag runs the release workflow, which verifies the package and benchmark, publishes wheel and sdist to PyPI through Trusted Publishing, and creates a GitHub Release.
|
|
231
261
|
|
|
232
262
|
This is a public repository. Do not commit credentials, private trajectories, internal endpoints, or personal data.
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
**Small core. Serious runtime semantics.**
|
|
4
4
|
|
|
5
|
-
nextloop is an embeddable Python AgentLoop for developers who want to build their own agent runtime — not inherit a heavyweight framework. Deterministic
|
|
5
|
+
nextloop is an embeddable Python AgentLoop for developers who want to build their own agent runtime — not inherit a heavyweight framework. Deterministic scheduling and state folding, append-only history, explicit crash recovery, typed Tools, and committed-event observability, all in a package you can actually read.
|
|
6
6
|
|
|
7
7
|
**Your agent, your rules. No magic, no black box.**
|
|
8
8
|
|
|
9
|
-
Current version: **0.
|
|
9
|
+
Current version: **0.6.0**.
|
|
10
10
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
python -m pip install nextloop==0.
|
|
14
|
+
python -m pip install nextloop==0.6.0
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
For local development:
|
|
@@ -35,9 +35,9 @@ It is a library, not an HTTP service, product bot, Router, EventBus, or multi-ag
|
|
|
35
35
|
|
|
36
36
|
## Under the hood
|
|
37
37
|
|
|
38
|
-
-
|
|
39
|
-
- Append-only Trajectory
|
|
40
|
-
-
|
|
38
|
+
- Session/Turn/Step execution with 4D integer coordinates and writer fencing.
|
|
39
|
+
- Append-only Trajectory with `surface_op` watermark semantics and Turn-private surface snapshots.
|
|
40
|
+
- Log-derived Pending Input and in-memory inbox signaling for steer and final commitment.
|
|
41
41
|
- Whole-batch Tool Schema validation, bounded parallel calls, and exclusive failure barriers.
|
|
42
42
|
- Closed five-variant `ToolOutcome`: `Completed`, `Skipped`, `Cancelled`, `UncertainSettled`, `UncertainHanging`.
|
|
43
43
|
- Bounded Provider retries, protocol correction, WorkingContext, Compaction, and cancellation.
|
|
@@ -59,9 +59,29 @@ AgentLoop.run(TurnContext) -> TurnOutcome
|
|
|
59
59
|
AgentLoop.steer(session_id, content, *, input_id=None) -> bool
|
|
60
60
|
AgentLoop.cancel(session_id, cause="user_stop") -> bool
|
|
61
61
|
AgentLoop.recover(session_id, store, delivery) -> RecoveryOutcome
|
|
62
|
+
AgentLoop.pending_inputs(session_id, store) -> tuple[PendingInput, ...]
|
|
63
|
+
AgentLoop.resume(context, *, decisions=None, reject_all=False, new_input=None) -> TurnOutcome
|
|
64
|
+
AgentLoop.retry_operation(context, operation_id) -> TurnOutcome
|
|
65
|
+
AgentLoop.resource_locks(session_id, store) -> frozenset[str]
|
|
66
|
+
AgentLoop.release_resource(session_id, store, resource, *, actor, evidence) -> bool
|
|
62
67
|
```
|
|
63
68
|
|
|
64
|
-
|
|
69
|
+
Core adapter seams are `EventStore`, `ModelProvider`, `ToolRuntime`, and `DeliveryOwner`. Additional extension points include `PreviewSink`, Exporters, Skills, and stdio/MCP workers. Context projection and Compaction are built in and configured through `LoopConfig`.
|
|
70
|
+
|
|
71
|
+
## Guarantees and non-guarantees
|
|
72
|
+
|
|
73
|
+
| Area | Guarantee | Not a guarantee |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| Accepted input | Accepted inputs are projected from the log by `input_id` and can be queried with `AgentLoop.pending_inputs`. Explicit IDs are non-empty; identical retries deduplicate, conflicting content is rejected without consuming the original. | Automatic deduplication when callers retry with a different or missing ID. |
|
|
76
|
+
| Delivery | Delivery is at least once; DeliveryOwner must deduplicate by stable `final_message_id`. | Exactly-once delivery or delivery without an idempotent owner. |
|
|
77
|
+
| Tool execution | The library never automatically replays an already dispatched Tool. Explicit reconciliation is limited to READ_ONLY and IDEMPOTENT operations. | No duplicate external effect when a model reissues a call or a Tool is not idempotent. |
|
|
78
|
+
| Resource locks | Unresolved uncertain results retain declared resources; otherwise NON_IDEMPOTENT uses the Tool name. Successful reconciliation releases all locks associated with the operation. | Global idempotency across different resources or operations, or safe concurrent execution of NON_IDEMPOTENT calls. |
|
|
79
|
+
| Approval | Any approval-required item suspends the whole batch before dispatch. Resume requires explicit decisions, binds original IDs/arguments, and rechecks expiry and prior dispatch inside the Session lock. | Automatic approval, execution before a durable grant, or replay after dispatch without recovery. |
|
|
80
|
+
| Event compatibility | Schema 1.0 is upcast only during reads; original payload bytes are preserved for idempotent append. | Reading schema 1.1 with 0.5.0 or earlier, or accepting unknown future schemas. |
|
|
81
|
+
| Recovery | Recovery writes crash closers; the caller starts a new Turn with projected prior messages and Pending Input. | In-place replay of the interrupted Turn or automatic execution of uncertain calls. |
|
|
82
|
+
| Preview | Preview is transient and cannot execute partial Tool arguments. | Preview as a durable EventStore fact or a substitute for committed Delivery. |
|
|
83
|
+
| Observability | Committed Events are authoritative and can be replayed for history. | The current in-memory Exporter queue as a durable outbox. |
|
|
84
|
+
| MCP | stdio lifecycle, paginated static catalogs, operation metadata, and uncertain crash handling. | Remote MCP, OAuth, dynamic `listChanged`, or non-text content mapping. |
|
|
65
85
|
|
|
66
86
|
`Harness.load("harness.toml")` assembles those adapters without changing the Loop. Use `await harness.check()` for offline validation and `await harness.run("input")` for a model-backed Turn. See [Harness and extension interface](docs/design/harness.md) for the strict TOML schema, stdio protocol, lifecycle rules, and CLI.
|
|
67
87
|
|
|
@@ -160,33 +180,41 @@ src/nextloop/
|
|
|
160
180
|
events/ # pure projection, response/outcome folds, crash repair
|
|
161
181
|
execute/ # model retries, Tool registration, batch scheduling
|
|
162
182
|
adapters/ # SQLite, memory, OpenAI, Anthropic
|
|
183
|
+
testing.py # Store conformance and deterministic fault injection
|
|
163
184
|
```
|
|
164
185
|
|
|
165
186
|
`events/` performs no I/O. `execute/` owns side effects and classified failures. `driver.py` only composes them.
|
|
166
187
|
|
|
167
188
|
## Verification
|
|
168
189
|
|
|
169
|
-
The release
|
|
190
|
+
The release checks cover:
|
|
170
191
|
|
|
171
192
|
- text, Tool, multi-Step, mixed, empty, truncated, and malformed responses;
|
|
172
193
|
- whole-batch rejection and parallel/exclusive scheduling with deterministic gates;
|
|
173
194
|
- steer/final ordering, cancellation, WorkingContext, and Compaction;
|
|
174
195
|
- protocol exhaustion, exact-byte retry, and partial-output failure;
|
|
196
|
+
- every append point on Memory and SQLite, before and after commit, with recovery and no-replay assertions;
|
|
197
|
+
- Tool/Delivery side-effect failures, writer takeover, late results, parallel partial completion, and repeated recovery;
|
|
198
|
+
- public Store conformance plus deliberately broken Store rejection;
|
|
175
199
|
- resource-lock recovery, conflict prevention, and explicit release;
|
|
176
200
|
- real subprocess exits during Tool execution and final delivery, followed by SQLite recovery;
|
|
177
201
|
- recorded OpenAI and Anthropic SSE streams;
|
|
178
202
|
- 12 live Kimi scenarios across both protocols, real Tool usage, parallel execution, recovery, steer, cancellation, Compaction, and WorkingContext;
|
|
179
203
|
- live DeepSeek text + Preview + usage and real Tool Call + Delivery smoke;
|
|
180
|
-
-
|
|
204
|
+
- a 10,505-event benchmark with cross-Store, incremental, and required-content parity;
|
|
205
|
+
- 341 offline tests, `ruff`, `mypy`, wheel/sdist builds, `twine check`, and clean wheel installation.
|
|
181
206
|
|
|
182
207
|
Current limits:
|
|
183
208
|
|
|
184
209
|
- nika integration is separate acceptance work.
|
|
185
|
-
- Concurrent writers across multiple processes fail closed; they are not coordinated.
|
|
186
|
-
- Large-asset lifecycle, backup, and GC are not part of this release
|
|
210
|
+
- Concurrent writers across multiple processes fail closed; they are not coordinated by time-based leases.
|
|
211
|
+
- Large-asset lifecycle, backup, and GC are not part of this release.
|
|
212
|
+
- Official OpenAI and Anthropic API acceptance remains a 1.0 hard gate; recorded streams and DeepSeek do not substitute for it.
|
|
187
213
|
|
|
188
214
|
## Documents
|
|
189
215
|
|
|
216
|
+
- [Architecture and import contract](docs/design/architecture.md)
|
|
217
|
+
- [Domain glossary](CONTEXT.md)
|
|
190
218
|
- [AgentLoop design](docs/design/agent-loop.md)
|
|
191
219
|
- [Public interface](docs/design/loop-interface.md)
|
|
192
220
|
- [Harness and extension interface](docs/design/harness.md)
|
|
@@ -194,11 +222,12 @@ Current limits:
|
|
|
194
222
|
- [Directory-based SkillRegistry](docs/design/skills.md)
|
|
195
223
|
- [Verification matrix](docs/design/verification-matrix.md)
|
|
196
224
|
- [Development plan](docs/architecture/development-plan.md)
|
|
225
|
+
- [Contributing](CONTRIBUTING.md) and [Security](SECURITY.md)
|
|
197
226
|
- [Changelog](CHANGELOG.md)
|
|
198
|
-
- [ADR-0002](docs/adr/0002-dsh-aligned-agent-loop.md)
|
|
227
|
+
- [ADR-0002](docs/adr/0002-dsh-aligned-agent-loop.md), [ADR-0003](docs/adr/0003-python-and-centralized-contracts.md), [ADR-0004 Event compatibility](docs/adr/0004-event-compatibility.md), [ADR-0005 Pending Input](docs/adr/0005-pending-input.md), [ADR-0006 Operation identity](docs/adr/0006-operation-id.md), and [ADR-0007 Approval](docs/adr/0007-approval.md)
|
|
199
228
|
|
|
200
229
|
## Release
|
|
201
230
|
|
|
202
|
-
CI covers Python 3.11, 3.12, and 3.
|
|
231
|
+
CI covers Python 3.11, 3.12, 3.13, and 3.14. A `v*` tag runs the release workflow, which verifies the package and benchmark, publishes wheel and sdist to PyPI through Trusted Publishing, and creates a GitHub Release.
|
|
203
232
|
|
|
204
233
|
This is a public repository. Do not commit credentials, private trajectories, internal endpoints, or personal data.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
### Language and dependencies
|
|
10
10
|
|
|
11
|
-
- Python 3.11+ with native `asyncio`; CI covers 3.11, 3.12, and 3.
|
|
11
|
+
- Python 3.11+ with native `asyncio`; CI covers 3.11, 3.12, 3.13, and 3.14.
|
|
12
12
|
- Standard-library `dataclasses`, `typing`, and `sqlite3`.
|
|
13
13
|
- `httpx` for Provider HTTP/SSE and `jsonschema` for Tool argument validation.
|
|
14
14
|
- `pytest` and `pytest-asyncio` for tests; `ruff` and `mypy` for static checks.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# ADR-0004: Event compatibility and read-only upcasting
|
|
2
|
+
|
|
3
|
+
Status: accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
nextloop 0.5.0 writes Event schema 1.0. The 0.6 operation identity, approval, and Compaction lineage work adds payload fields without changing the Event envelope. Compatibility must not rewrite history, silently accept a future schema, or compare upcast payloads as if they were original bytes.
|
|
8
|
+
|
|
9
|
+
## Decision
|
|
10
|
+
|
|
11
|
+
New Events are written as schema 1.1. Stores accept 1.0 history and upcast it only while loading. Unknown schema versions fail closed with `InvariantViolation`; older readers that only understand 1.0 therefore cannot read a 1.1 Session.
|
|
12
|
+
|
|
13
|
+
- Upcasting is a pure, deterministic, idempotent function. No Store UPDATE or rewrite is part of loading.
|
|
14
|
+
- The original stored payload and event ID remain authoritative for idempotent append comparison. Comparing a draft with an upcast representation is not equivalent to comparing original bytes and is rejected when they differ.
|
|
15
|
+
- A schema-1.0 TOOL_CALL without `operation_id` receives a deterministic ID derived from `session_id`, `turn`, `step`, and `call_id`. The same coordinates in ASSISTANT_MESSAGE Tool Calls receive the same ID; identical call IDs in different Steps receive different IDs.
|
|
16
|
+
- A schema-1.0 COMPACTION without lineage receives `source_seqs=None`. No exact source range is fabricated.
|
|
17
|
+
- Projection, Trace, and Recovery consume upcast Events; idempotent append uses the stored, non-upcast representation.
|
|
18
|
+
- The reserved single-key payload `{"_nextloop_erased": True}` denotes erased content for future retention work. Reusing that event ID raises `PayloadErasedError` without comparing payload content. No content hash is retained for low-entropy PII, and event-level erasure itself is outside 0.6.
|
|
19
|
+
- Every released schema has a real Store fixture produced by that release. The 1.0 fixture contains normal multi-Step Tool Calls with a repeated call ID, Compaction, and an interrupted Tool Call. New readers must preserve raw fixture bytes while loading and upcasting.
|
|
20
|
+
|
|
21
|
+
## Consequences
|
|
22
|
+
|
|
23
|
+
- Old 1.0 logs remain readable without a migration write or downtime.
|
|
24
|
+
- New 1.1 logs are intentionally not readable by 0.5.0 and earlier.
|
|
25
|
+
- Read-time compatibility does not weaken append idempotency or future-version checks.
|
|
26
|
+
- Operation identity for legacy calls is deterministic and coordinate-scoped. New operation IDs introduced in 0.6 are persisted facts, not regenerated during recovery.
|
|
27
|
+
- Payload erasure has a fail-closed identity rule without prematurely implementing deletion or retaining PII hashes.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# ADR-0005: Pending Input as a pure log projection
|
|
2
|
+
|
|
3
|
+
Status: accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
`steer()` persists INPUT_ACCEPTED before writing the in-memory actor inbox. INPUT_ACCEPTED alone is not part of the model-visible projection. A crash can therefore acknowledge an input that the model never sees. Rebuilding this state in `recover()` would create another writer and another crash window.
|
|
8
|
+
|
|
9
|
+
## Decision
|
|
10
|
+
|
|
11
|
+
The event log is the sole source of truth. The actor inbox is only a wake-up signal.
|
|
12
|
+
|
|
13
|
+
- Scan INPUT_ACCEPTED and USER_MESSAGE in seq order and match them by `input_id`.
|
|
14
|
+
- Accepted inputs without a corresponding USER_MESSAGE are Pending Input.
|
|
15
|
+
- Compute Pending Input at the start of each Turn. Recovery never writes the actor inbox.
|
|
16
|
+
- A new Turn commits recovered Pending as USER_MESSAGE at its first Step boundary. This consumption fact is required; injecting Pending only into a Provider request would leave it pending forever.
|
|
17
|
+
- Pending historical inputs appear before the new Turn's initial_input. Inputs accepted during approval suspension appear only after the corresponding Tool results.
|
|
18
|
+
- Inputs from cancelled or budget-terminated Turns carry into the next Turn by default.
|
|
19
|
+
- Active execution also uses the log's consumption state, so an input present in both the log and actor inbox is injected once.
|
|
20
|
+
- Pending is queryable with `input_id`, original seq, original Turn, and content. No cleanup event is introduced in this version.
|
|
21
|
+
- `recover()` may be called repeatedly without duplicating Pending. A crash between recover and run has the same projection.
|
|
22
|
+
|
|
23
|
+
`input_id` is the idempotency boundary. A caller retrying initial input or steer must supply the same `input_id`, or query Pending before retrying. An absent or automatically generated ID does not provide cross-crash deduplication. Explicit IDs must be non-empty. The same ID with identical content is a no-op retry; the same ID with different content is rejected before a new INPUT_ACCEPTED is committed, so the original Pending content is preserved.
|
|
24
|
+
|
|
25
|
+
No cleanup event is introduced. Pending remains visible until the caller consumes it or the protocol later defines an explicit discard fact.
|
|
26
|
+
|
|
27
|
+
## Consequences
|
|
28
|
+
|
|
29
|
+
- Accepted inputs are not silently lost after process crashes.
|
|
30
|
+
- No second recovery writer or in-memory Pending copy can diverge from the log.
|
|
31
|
+
- Callers that blindly retry with a new ID may intentionally receive duplicate content; this is not deduplicated.
|
|
32
|
+
- Compaction and approval pairing must preserve Pending ordering and must not split a Tool Intent from its result.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# ADR-0006: Operation identity and Tool effects
|
|
2
|
+
|
|
3
|
+
Status: accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
A model can issue the same Tool Call again after an uncertain result. Without a persisted logical operation identity and an explicit effect declaration, the runtime cannot distinguish a new intent from a safe same-operation reconciliation.
|
|
8
|
+
|
|
9
|
+
## Decision
|
|
10
|
+
|
|
11
|
+
- Every admitted assistant Tool Intent receives a new `operation_id` when ASSISTANT_MESSAGE is committed. TOOL_CALL, ToolContext, Tool Result, Trace, recovery, MCP, and stdio preserve that same ID. A new model intent receives a new ID even when `call_id`, Tool name, and arguments repeat.
|
|
12
|
+
- `ToolEffect = READ_ONLY | IDEMPOTENT | NON_IDEMPOTENT`; the default is NON_IDEMPOTENT. IDEMPOTENT means repeated or concurrent execution with the same operation ID has the same external effect as one execution.
|
|
13
|
+
- Declared `resources` continue to control normal conflict checks. A separate `uncertain_resources` projection is used only after uncertain execution: explicit resources win; otherwise NON_IDEMPOTENT uses the Tool name. This default does not serialize normal parallel scheduling.
|
|
14
|
+
- `AgentLoop.resource_locks(session_id, store)` and `release_resource(...)` expose log-derived lock state. Release writes an Event with actor and caller evidence rather than mutating a side table.
|
|
15
|
+
- `AgentLoop.retry_operation(context, operation_id)` is an explicit new Turn. Only READ_ONLY and IDEMPOTENT operations are eligible; NON_IDEMPOTENT is rejected. The caller accepts that the original hanging operation may still run concurrently.
|
|
16
|
+
- Reconciliation executes the original Tool and arguments with the original operation ID. It emits a Reconciliation Result notification linked to the original coordinate, never a second Tool Result at that coordinate. Success releases corresponding locks; another uncertain result retains them. The library never automatically retries.
|
|
17
|
+
- Harness TOML `effect` is explicit configuration. `nextloop check` reports a migration warning when it is absent. MCP annotations are untrusted hints and do not choose the effect.
|
|
18
|
+
|
|
19
|
+
## Consequences
|
|
20
|
+
|
|
21
|
+
- Default uncertainty becomes visible for side-effecting Tools that declare no resources; this is an intentional breaking change.
|
|
22
|
+
- Explicit resource-based parallelism is unchanged.
|
|
23
|
+
- Reconciliation is auditable and does not rewrite old history or create ambiguous duplicate Results.
|
|
24
|
+
- Caller-provided idempotency is a semantic contract, not a hint the library can verify.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ADR-0007: Approval suspension and cross-Turn resume
|
|
2
|
+
|
|
3
|
+
Status: accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
TOOL_CALL is a dispatch-boundary fact, not a Tool Intent. Approval must be decided before side effects and must survive crashes without changing original operation identity or arguments.
|
|
8
|
+
|
|
9
|
+
## Decision
|
|
10
|
+
|
|
11
|
+
- `ApprovalPolicy(version, predicate=None, expires_after_seconds=None)` is a ToolSpec declaration. A missing policy needs no approval; a missing predicate always requires it; a predicate is a pure argument callback.
|
|
12
|
+
- If any call in a validated batch requires approval, Tool Intent and APPROVAL_REQUESTED commit atomically and the entire batch waits before its first TOOL_CALL. The request binds operation IDs, canonical arguments, policy versions, Event schema, and optional expiry.
|
|
13
|
+
- The waiting Turn ends with `approval_pending`. A crash closer must not turn undispatched approval intents into Skipped Results. New `run()` input and `steer()` are rejected while suspended; `cancel()` writes cancellation and invalidates the approval.
|
|
14
|
+
- `resume()` uses a new Turn and tail-conditional append. Decisions bind operation IDs. Any rejection or expiry rejects the whole batch; all approvals preserve the original parallel/exclusive order.
|
|
15
|
+
- APPROVAL_GRANTED commits before dispatch. A crash after permission but before TOOL_CALL can be resumed without another side effect. TOOL_CALL after permission follows ordinary uncertain recovery.
|
|
16
|
+
- Results physically append in the resume Turn and carry `origin_turn/origin_step`. Projection, Trace, and Recovery pair them to the original Tool Intent without rewriting the original coordinate.
|
|
17
|
+
- Rejected calls produce Skipped Results in the resume Turn, followed by new input. `resume(reject_all=True, new_input=...)` is the exit path.
|
|
18
|
+
- Expiry is evaluated lazily at resume, never by a background timer. Resume uses fresh Turn budgets and deadlines. Concurrent resume is serialized by the Session actor and revalidated against the log.
|
|
19
|
+
|
|
20
|
+
## Consequences
|
|
21
|
+
|
|
22
|
+
- Approval cannot produce side effects before a durable permission fact.
|
|
23
|
+
- Permission and dispatch are separate crash windows with explicit recovery behavior.
|
|
24
|
+
- Original IDs and arguments survive across Turns; model projection sees Results before new Pending input.
|
|
25
|
+
- Approval waiting time is not Tool execution time.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# nextloop development and verification plan
|
|
2
|
+
|
|
3
|
+
Current stage: **0.6.0 release verification**. `0.5.0` is published; later milestones are not claimed as implemented.
|
|
4
|
+
|
|
5
|
+
## Delivery order
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
0.5.0rc2: Pending Input recovery and guarantee documentation
|
|
9
|
+
→ 0.5.0: fault matrix, Store conformance, 10k benchmark, Python 3.14, import contract
|
|
10
|
+
→ 0.6: upcasting, operation_id, approval/resume, Compaction source ranges
|
|
11
|
+
→ 0.7: opt-in owner leases and persistent Pending behavior
|
|
12
|
+
→ 0.8: caller-driven durable Outbox and OTel ID mapping
|
|
13
|
+
→ 0.9: reentrant whole-Session deletion and tombstones
|
|
14
|
+
→ 1.0: all hard gates and official OpenAI/Anthropic acceptance
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Each stage requires an independent Standards / Spec / Risk review, complete regression gates, and a separate release. A design or ADR is not accepted evidence until its fault scenarios pass.
|
|
18
|
+
|
|
19
|
+
## 0.5.0 — falsification and frozen integration paths
|
|
20
|
+
|
|
21
|
+
- `nextloop.testing` provides Store, ToolRuntime, and DeliveryOwner fault injection, including after-side-effect and after-commit failures.
|
|
22
|
+
- The standard Tool + steer + final scenario traverses every append point on Memory and SQLite, before and after commit, and verifies seq, Pending, resource locks, Delivery, and no Tool replay.
|
|
23
|
+
- Explicit scenarios cover writer takeover before dispatch, late Tool results, parallel partial completion, Compaction, and repeated recovery.
|
|
24
|
+
- `check_event_store()` accepts both built-in Stores and rejects unchecked writers, duplicate event IDs, and incorrect Surface implementations.
|
|
25
|
+
- A 10,505-event benchmark checks Memory/SQLite Conversation Projection parity and incremental/whole-history Trace parity while reporting timings.
|
|
26
|
+
- CI covers Python 3.11, 3.12, 3.13, and 3.14.
|
|
27
|
+
- Existing root re-exports and core/extras module paths are frozen without a physical package split.
|
|
28
|
+
|
|
29
|
+
See [Architecture and import contract](../design/architecture.md), [Verification matrix](../design/verification-matrix.md), and [CONTRIBUTING](../../CONTRIBUTING.md).
|
|
30
|
+
|
|
31
|
+
## 0.6 — explicit operation and approval semantics
|
|
32
|
+
|
|
33
|
+
- Versioned, read-only Event upcasting with real historical fixtures and fail-fast unknown versions.
|
|
34
|
+
- `operation_id` is created and persisted with Tool Intent; new model intent receives a new ID.
|
|
35
|
+
- `ToolEffect = READ_ONLY | IDEMPOTENT | NON_IDEMPOTENT`, defaulting to NON_IDEMPOTENT. Default Tool-name locking applies only to unresolved uncertain outcomes and is an explicit breaking change.
|
|
36
|
+
- Explicit same-ID reconciliation is allowed only for READ_ONLY and IDEMPOTENT operations. It creates a Reconciliation Result notification, never a second Tool Result at the original coordinate.
|
|
37
|
+
- Approval distinguishes Tool Intent from dispatch, binds canonical arguments and policy versions, and uses conditional append. Approval precedes side effects; resume uses original IDs and arguments in a new Turn.
|
|
38
|
+
- Compaction records source seq ranges and cannot split a Tool Intent from its result.
|
|
39
|
+
|
|
40
|
+
## 0.7 — opt-in writer leases
|
|
41
|
+
|
|
42
|
+
- `owner_id` remains optional; existing `attach_writer` behavior stays unchanged when leases are not configured.
|
|
43
|
+
- Same-owner restart can take over immediately. Different owners wait for expiry or explicit forced takeover.
|
|
44
|
+
- Store time determines expiry; heartbeat renewal is independent. Every actual dispatch retains a writer/lease check.
|
|
45
|
+
- SQLite promises same-host multi-process behavior only. Late results from stale writers are discarded and remain uncertain.
|
|
46
|
+
- Existing `steer() -> bool` remains compatible; `steer_result()` adds explicit rejection reasons.
|
|
47
|
+
|
|
48
|
+
## 0.8 — durable, caller-driven Outbox
|
|
49
|
+
|
|
50
|
+
- Export state and cursors live outside the Event log and do not consume writer epochs.
|
|
51
|
+
- `export_pending(session_id=None)` is caller-driven and can enumerate Sessions with unexported closed Turns without starting recovery.
|
|
52
|
+
- Watermarks advance only after durable Export acknowledgement. Bounded retries record auditable gaps rather than blocking forever or pretending success.
|
|
53
|
+
- Trace replay uses stable OTel 128-bit trace IDs and 64-bit span IDs. No OTel Exporter implementation is included in this milestone.
|
|
54
|
+
|
|
55
|
+
## 0.9 — whole-Session deletion
|
|
56
|
+
|
|
57
|
+
- Deletion first commits a deleting tombstone and fences writers, then deletes primary and derived local state. Interrupted deletion is reentrant.
|
|
58
|
+
- A Session-ID-only tombstone prevents recreation. Event-level erasure and external blob reference counting are excluded.
|
|
59
|
+
- SQLite verification scans DB, WAL, SHM, and rollback-journal bytes with synthetic canaries. Third-party exports and user backups are not covered.
|
|
60
|
+
|
|
61
|
+
## 1.0 hard gates
|
|
62
|
+
|
|
63
|
+
- All Store, ToolRuntime, DeliveryOwner, negative-conformance, takeover, and recovery scenarios pass.
|
|
64
|
+
- The 10k benchmark and parity checks pass.
|
|
65
|
+
- Python 3.14 CI passes.
|
|
66
|
+
- Official OpenAI and Anthropic API acceptance passes. Missing official credentials blocks 1.0; DeepSeek is not a substitute.
|
|
67
|
+
- Documentation, ADRs, migration notes, guarantee tables, and actual behavior agree.
|
|
68
|
+
|
|
69
|
+
## Explicit non-goals through 1.0
|
|
70
|
+
|
|
71
|
+
No streaming `async for` API, OTel Exporter implementation, remote MCP/OAuth, additional Providers, `@tool` decorator, agent-as-Tool framework, Postgres implementation, physical core/extras split, automatic replay, in-place same-Turn resume, event-level erasure, or external blob lifecycle.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# nextloop discussion and delivery roadmap
|
|
2
|
+
|
|
3
|
+
Purpose: preserve the accepted direction and remaining decision boundaries without duplicating nika's product roadmap.
|
|
4
|
+
|
|
5
|
+
Current entry: **0.5.0 falsification and integration-contract closure**. The executable implementation plan is [development-plan.md](development-plan.md).
|
|
6
|
+
|
|
7
|
+
## Fixed guardrails
|
|
8
|
+
|
|
9
|
+
- One embeddable Loop, not a service or multi-agent framework.
|
|
10
|
+
- Append-only Trajectory is authoritative; Conversation and Traces are derived.
|
|
11
|
+
- Whole-batch validation precedes every Tool side effect.
|
|
12
|
+
- TOOL_CALL precedes dispatch, and a writer check follows that commit immediately before execution.
|
|
13
|
+
- Unknown effects stop new dispatch and are never automatically replayed.
|
|
14
|
+
- Every exit has one finalization path; committed finals recover by Delivery only.
|
|
15
|
+
- Pending Input is derived from the Event log; in-memory inboxes do not become a second authority.
|
|
16
|
+
- Provider connection configuration stays outside Trajectory.
|
|
17
|
+
- No Feishu, Wiki, concrete product Tools, or Proactive product policy in nextloop.
|
|
18
|
+
|
|
19
|
+
## Topic closure
|
|
20
|
+
|
|
21
|
+
| Topic | Accepted direction | Current state |
|
|
22
|
+
|---|---|---|
|
|
23
|
+
| Execution and ReAct | Turn/Step driver, bounded correction, ordered steer, common finalization | Implemented; normal and terminal behavior covered |
|
|
24
|
+
| Model and Context | Frozen in-memory requests, external Provider configuration, append-only projection, Compaction | Implemented; recorded Adapter contracts and separately identified live smoke |
|
|
25
|
+
| Tool contracts | Admission, parallel/exclusive scheduling, ordered Observations, explicit uncertainty | Implemented; full append and side-effect fault scenarios covered |
|
|
26
|
+
| Durable state | Atomic conditional append, idempotency, writer fencing, crash closers | Implemented for single-process fencing; timed leases remain 0.7 |
|
|
27
|
+
| Pending Input | Log projection by `input_id` and Step-boundary consumption | Implemented; cross-process steering reasons remain 0.7 |
|
|
28
|
+
| Observability | Committed-event Trace projection with failure isolation | Implemented; persistent Outbox remains 0.8 |
|
|
29
|
+
| Schema evolution | Read-only upcasting and versioned real fixtures | 0.6, not currently claimed |
|
|
30
|
+
| Operation identity and approval | Persistent `operation_id`, effect declarations, approved new-Turn resume | 0.6, not currently claimed |
|
|
31
|
+
| Retention | Reentrant whole-Session deletion with tombstones | 0.9, not currently claimed |
|
|
32
|
+
| Consumer integration | Public versioned Adapters; nika is a consumer, not a dependency | Separate acceptance |
|
|
33
|
+
| Release | Python 3.11–3.14, frozen imports, fault matrix, benchmark, official API gates | 0.5 verifies engineering; official OpenAI/Anthropic acceptance blocks 1.0 |
|
|
34
|
+
|
|
35
|
+
## Decision order
|
|
36
|
+
|
|
37
|
+
1. Falsify current guarantees before freezing them.
|
|
38
|
+
2. Add operation identity and approval before changing writer ownership.
|
|
39
|
+
3. Add leases before promising coordinated multi-process behavior.
|
|
40
|
+
4. Add persistent export acknowledgement before calling Traces durable.
|
|
41
|
+
5. Add tombstones before promising deletion.
|
|
42
|
+
6. Require official Provider evidence before 1.0.
|
|
43
|
+
|
|
44
|
+
The [verification matrix](../design/verification-matrix.md) is the executable checklist. Documentation alone never marks a requirement implemented.
|
|
45
|
+
|
|
46
|
+
## Integration links
|
|
47
|
+
|
|
48
|
+
- [nika](https://github.com/12bitsD/nika) independently owns personal-agent behavior, Feishu, AgentWiki, Skills, Prompts, deployment, and Proactive behavior.
|
|
49
|
+
- [ADR-0002](../adr/0002-dsh-aligned-agent-loop.md) records the DSH-aligned decision and deltas.
|
|
50
|
+
- [Open-source evaluation](../research/2026-11-06-open-source-agent-loops.md) preserves the earlier candidate comparison.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# nextloop feature worklist
|
|
2
|
+
|
|
3
|
+
Purpose: distinguish implemented capabilities from remaining work. Executable evidence is owned by the [verification matrix](../design/verification-matrix.md).
|
|
4
|
+
|
|
5
|
+
## Implemented in the current 0.6 line
|
|
6
|
+
|
|
7
|
+
| Feature | Implementation | Evidence |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| Turn/Step driver | 4D coordinates, append-only Events, thin orchestration | Text, Tool, multi-Step, cancellation, final-order, and budget tests |
|
|
10
|
+
| Response protocol | Bounded correction, terminal failures, exact-byte retry | Empty, truncated, malformed, exhaustion, retry, and partial-output tests |
|
|
11
|
+
| Tool scheduling | Whole-batch Schema validation, bounded parallel calls, exclusive barriers | Zero-side-effect rejection, concurrency gates, ordering, and truncation tests |
|
|
12
|
+
| Recovery | Crash closers, explicit uncertainty, resource locks, delivery-only retry | Every-append fault matrix, real process exits, takeover, late-result, and repeated-recovery tests |
|
|
13
|
+
| Pending Input | Log projection by `input_id`, query API, Step-boundary consumption | Accepted/not-consumed windows, duplicate recovery, retry, cancellation, and next-Turn tests |
|
|
14
|
+
| Context | Append-only projection, WorkingContext, Compaction, result preview/page/full | Projection parity, compaction, UTF-8 paging, read-back, and capacity tests |
|
|
15
|
+
| EventStore | Memory and SQLite, atomic conditional append, idempotency, writer checks | Public conformance plus deliberately broken Store rejection |
|
|
16
|
+
| Event compatibility | Read-only 1.0→1.1 upcasting, raw append comparison | Real 1.0/1.1 SQLite fixtures and unknown-schema negative paths |
|
|
17
|
+
| Operation identity | operation_id, ToolEffect, resource locks, explicit Reconciliation | End-to-end propagation, dynamic locks, repeated/concurrent retry, and no-replay evidence |
|
|
18
|
+
| Approval | Atomic Intent/request, new-Turn resume, origin pairing, lazy expiry | Zero pre-grant dispatch, crash windows, concurrent resume, rejection, cancellation, and fresh budgets |
|
|
19
|
+
| Providers | OpenAI-compatible and Anthropic streaming adapters | Recorded protocol streams plus separately identified live-provider smoke |
|
|
20
|
+
| Observability | Model/Tool/Turn Trace DTOs, async Exporters, history | Live/history parity, failure isolation, bounded close, and 10k incremental parity |
|
|
21
|
+
| Integrations | Harness, directory Skills, stdio workers, MCP stdio | Offline diagnostics, subprocess conformance, lifecycle, and clean-wheel examples |
|
|
22
|
+
| Release contract | Frozen root/module re-exports, Python 3.11–3.14 CI | Import snapshot, complete gates, wheel/sdist, and clean-install checks |
|
|
23
|
+
|
|
24
|
+
## Remaining work
|
|
25
|
+
|
|
26
|
+
| Feature | Target and boundary |
|
|
27
|
+
|---|---|
|
|
28
|
+
| Time-based writer leases | 0.7; opt-in owner identity, heartbeat, expiry, and takeover |
|
|
29
|
+
| Durable Outbox | 0.8; caller-driven export, persistent acknowledgement, auditable gaps |
|
|
30
|
+
| Whole-Session deletion | 0.9; tombstones and local derived-state cleanup |
|
|
31
|
+
| Official OpenAI/Anthropic acceptance | 1.0 hard gate; recorded streams and DeepSeek do not substitute |
|
|
32
|
+
| nika product integration | Separate consumer acceptance; no Feishu/Wiki dependency enters nextloop |
|
|
33
|
+
| Large external-asset lifecycle | Not claimed; current large Tool Results remain in the EventStore |
|
|
34
|
+
| Remote MCP/OAuth and more Providers | Explicitly outside the 1.0 plan |
|
|
@@ -17,11 +17,11 @@ This map records reusable execution requirements and verification ownership. No
|
|
|
17
17
|
| L11 | Make Tool implementations replaceable behind one contract | [ToolRuntime](../design/loop-interface.md#toolruntime) | **Generic design closed.** Consumer Schemas, resources, cancellation, unknown and assets conformance |
|
|
18
18
|
| L12 | Keep one append-only event authority and derive Conversation | [Event model](../design/agent-loop.md#8-event-model-and-transaction-groups) | **Design closed.** Field schema, seq, idempotency, lease/fence, transactions and malformed history |
|
|
19
19
|
| L13 | Recover from every commit window without replaying side effects | [Recovery](../design/agent-loop.md#9-recovery-and-delivery) | **Design closed.** Process-exit matrix, stale leases and persistent resource tests |
|
|
20
|
-
| L14 | Preserve large outputs and their references | [Content access](../design/context-builder.md#content-access-and-task-performance) | **
|
|
20
|
+
| L14 | Preserve large outputs and their references | [Content access](../design/context-builder.md#content-access-and-task-performance) | **Partially implemented.** Durable full Tool Results, bounded preview/page projections, and read-back are verified; backup, GC, and external-asset lifecycle remain open |
|
|
21
21
|
| L15 | Retry delivery without rerunning model or Tools | [DeliveryOwner](../design/loop-interface.md#deliveryowner) | **Design closed.** `final_message_id`, delivery_unknown, durable handoff and writer-release tests |
|
|
22
|
-
| L16 | Prove consumer independence through public Adapters | [Loop interface](../design/loop-interface.md) | **Open.** Fake and
|
|
23
|
-
| L18 | Load third-party instruction Skills from directories on demand | [SkillRegistry](../design/skills.md) | **Implemented
|
|
24
|
-
| L17 | Package and release only after protocol verification | [Development plan](development-plan.md), [ADR-0003](../adr/0003-python-and-centralized-contracts.md) | **0.
|
|
22
|
+
| L16 | Prove consumer independence through public Adapters | [Loop interface](../design/loop-interface.md) | **Open.** Fake Adapters and public Store conformance are implemented; nika consumer acceptance remains separate |
|
|
23
|
+
| L18 | Load third-party instruction Skills from directories on demand | [SkillRegistry](../design/skills.md) | **Implemented.** Metadata discovery, current-body loading, duplicate/dependency/version errors, and `skill_view` tests |
|
|
24
|
+
| L17 | Package and release only after protocol verification | [Development plan](development-plan.md), [ADR-0003](../adr/0003-python-and-centralized-contracts.md) | **0.6.0 implemented and verified.** The complete fault matrix, benchmark, Python 3.14, import contract, upcasting, operation, approval, and clean package gates pass; publication and later milestones remain separate |
|
|
25
25
|
|
|
26
26
|
## Independence rule
|
|
27
27
|
|