nextloop 1.1.0__tar.gz → 1.2.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-1.1.0 → nextloop-1.2.0}/MANIFEST.in +1 -0
- {nextloop-1.1.0/src/nextloop.egg-info → nextloop-1.2.0}/PKG-INFO +35 -5
- {nextloop-1.1.0 → nextloop-1.2.0}/README.md +32 -4
- nextloop-1.2.0/README.zh-CN.md +194 -0
- nextloop-1.2.0/docs/README.md +46 -0
- nextloop-1.2.0/docs/adr/0001-embeddable-agent-loop.md +55 -0
- nextloop-1.2.0/docs/adr/0002-dsh-aligned-agent-loop.md +56 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/docs/adr/0003-python-and-centralized-contracts.md +10 -12
- nextloop-1.2.0/docs/adr/0004-event-compatibility.md +29 -0
- nextloop-1.2.0/docs/adr/0005-pending-input.md +41 -0
- nextloop-1.2.0/docs/adr/0006-operation-id.md +36 -0
- nextloop-1.2.0/docs/adr/0007-approval.md +36 -0
- nextloop-1.2.0/docs/adr/0008-lease.md +25 -0
- nextloop-1.2.0/docs/adr/0009-outbox.md +43 -0
- nextloop-1.2.0/docs/adr/0010-session-deletion.md +48 -0
- nextloop-1.2.0/docs/adr/0011-live-provider-acceptance.md +20 -0
- nextloop-1.2.0/docs/architecture/agent-loop-capability-review.md +152 -0
- nextloop-1.2.0/docs/architecture/development-plan.md +72 -0
- nextloop-1.2.0/docs/architecture/discussion-roadmap.md +48 -0
- nextloop-1.2.0/docs/architecture/feature-worklist.md +34 -0
- nextloop-1.2.0/docs/architecture/requirements.md +30 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/docs/design/agent-loop.md +32 -31
- nextloop-1.2.0/docs/design/architecture.md +76 -0
- nextloop-1.2.0/docs/design/context-builder.md +133 -0
- nextloop-1.2.0/docs/design/exporters.md +143 -0
- nextloop-1.2.0/docs/design/guarantees.md +33 -0
- nextloop-1.2.0/docs/design/harness.md +323 -0
- nextloop-1.2.0/docs/design/loop-interface.md +114 -0
- nextloop-1.2.0/docs/design/outer-policies.md +71 -0
- nextloop-1.2.0/docs/design/react-protocol.md +53 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/docs/design/skills.md +20 -19
- {nextloop-1.1.0 → nextloop-1.2.0}/docs/design/verification-matrix.md +16 -16
- nextloop-1.2.0/docs/research/2026-11-02-dsh-primary-sources.md +153 -0
- nextloop-1.2.0/docs/research/2026-11-02-loop-evidence-notes.md +129 -0
- nextloop-1.2.0/docs/research/2026-11-03-hermes-turn-control.md +102 -0
- nextloop-1.2.0/docs/research/2026-11-03-tool-batch-failures.md +125 -0
- nextloop-1.2.0/docs/research/2026-11-03-tool-call-validation.md +71 -0
- nextloop-1.2.0/docs/research/2026-11-03-yomi-turn-control.md +5 -0
- nextloop-1.2.0/docs/research/2026-11-06-open-source-agent-loops.md +199 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/docs/research/2026-11-06-react-tool-event-recovery.md +66 -66
- nextloop-1.2.0/docs/research/2026-11-09-observability-langfuse.md +183 -0
- nextloop-1.2.0/docs/research/2026-11-10-nextloop-optimization-review.md +198 -0
- nextloop-1.2.0/docs/research/real-eval-2026-11-13/README.md +43 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/docs/tutorial.md +43 -17
- nextloop-1.2.0/examples/basic.py +50 -0
- nextloop-1.2.0/examples/goal_loop.py +280 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/examples/harness-skills/echo/SKILL.md +1 -1
- {nextloop-1.1.0 → nextloop-1.2.0}/examples/harness.toml +7 -1
- {nextloop-1.1.0 → nextloop-1.2.0}/examples/live_smoke.py +104 -27
- nextloop-1.2.0/examples/observability_adapter.py +198 -0
- nextloop-1.2.0/examples/plan_mode.py +332 -0
- nextloop-1.2.0/examples/python_tools.py +13 -0
- nextloop-1.2.0/examples/real_eval.py +582 -0
- nextloop-1.2.0/examples/real_resilience_eval.py +690 -0
- nextloop-1.2.0/examples/skills/coding/SKILL.md +13 -0
- nextloop-1.2.0/examples/skills_demo.py +22 -0
- nextloop-1.2.0/examples/workers/cpp_worker.cpp +465 -0
- nextloop-1.2.0/examples/workers/python_worker.py +57 -0
- nextloop-1.2.0/examples/workers/rust_worker.rs +393 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/pyproject.toml +9 -2
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/__init__.py +15 -1
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/adapters/__init__.py +4 -0
- nextloop-1.2.0/src/nextloop/adapters/_http.py +113 -0
- nextloop-1.2.0/src/nextloop/adapters/_parameters.py +33 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/adapters/_sqlite.py +13 -12
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/adapters/_sse.py +3 -1
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/adapters/anthropic.py +143 -63
- nextloop-1.2.0/src/nextloop/adapters/base.py +112 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/adapters/capabilities.py +32 -31
- nextloop-1.2.0/src/nextloop/adapters/functional.py +40 -0
- nextloop-1.2.0/src/nextloop/adapters/memory.py +460 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/adapters/observing.py +245 -67
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/adapters/openai.py +109 -68
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/adapters/outbox.py +109 -30
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/adapters/sqlite.py +312 -57
- nextloop-1.2.0/src/nextloop/cli.py +209 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/contracts.py +214 -28
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/driver.py +513 -163
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/events/__init__.py +8 -1
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/events/approval.py +19 -9
- nextloop-1.2.0/src/nextloop/events/codec.py +155 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/events/input.py +10 -2
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/events/outcome.py +71 -21
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/events/pending.py +34 -22
- nextloop-1.2.0/src/nextloop/events/project.py +508 -0
- nextloop-1.2.0/src/nextloop/events/repair.py +343 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/events/response.py +58 -12
- nextloop-1.2.0/src/nextloop/events/summary.py +363 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/events/trace.py +86 -31
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/events/upcast.py +28 -6
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/execute/__init__.py +5 -1
- nextloop-1.2.0/src/nextloop/execute/base.py +99 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/execute/batch.py +128 -48
- nextloop-1.2.0/src/nextloop/execute/cancellation.py +40 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/execute/composite.py +97 -23
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/execute/mcp.py +74 -40
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/execute/model.py +87 -18
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/execute/preview.py +52 -15
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/execute/result_read.py +24 -12
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/execute/stdio.py +70 -38
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/execute/stdio_transport.py +137 -36
- nextloop-1.2.0/src/nextloop/execute/tools.py +387 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/harness.py +328 -113
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/loop.py +118 -33
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/skills.py +41 -12
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/testing.py +56 -58
- nextloop-1.2.0/src/nextloop/worker.py +206 -0
- {nextloop-1.1.0 → nextloop-1.2.0/src/nextloop.egg-info}/PKG-INFO +35 -5
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop.egg-info/SOURCES.txt +27 -19
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop.egg-info/requires.txt +3 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_aggregate_close.py +19 -6
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_approval.py +168 -61
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_approval_regressions.py +120 -42
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_budgets.py +32 -10
- nextloop-1.2.0/tests/test_cli.py +220 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_deletion.py +27 -9
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_events.py +96 -17
- nextloop-1.2.0/tests/test_extensibility_dx.py +179 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_failures.py +66 -19
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_fault_injection.py +31 -13
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_fault_matrix.py +85 -31
- nextloop-1.2.0/tests/test_feature_polish.py +449 -0
- nextloop-1.2.0/tests/test_goal_loop_example.py +36 -0
- nextloop-1.2.0/tests/test_harness.py +933 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_import_contract.py +27 -2
- nextloop-1.2.0/tests/test_invariant_counterexamples.py +400 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_lease.py +97 -28
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_loop.py +101 -66
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_mcp.py +147 -16
- nextloop-1.2.0/tests/test_model_parameters.py +644 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_observability.py +339 -28
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_operations.py +148 -40
- nextloop-1.1.0/tests/test_outbox_regressions.py → nextloop-1.2.0/tests/test_outbox.py +199 -22
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_pending_inputs.py +88 -22
- nextloop-1.2.0/tests/test_performance_gates.py +354 -0
- nextloop-1.2.0/tests/test_plan_mode_example.py +44 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_preview.py +71 -16
- nextloop-1.2.0/tests/test_projection.py +178 -0
- nextloop-1.2.0/tests/test_provider_terminal.py +195 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_providers.py +100 -25
- nextloop-1.1.0/tests/test_finalizer_races.py → nextloop-1.2.0/tests/test_races.py +156 -22
- nextloop-1.2.0/tests/test_regressions.py +874 -0
- nextloop-1.2.0/tests/test_result_policies.py +326 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_skills.py +8 -3
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_stdio.py +6 -2
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_stdio_cleanup.py +27 -7
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_stdio_frames.py +17 -6
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_stdio_safety.py +26 -8
- nextloop-1.2.0/tests/test_stores.py +466 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_upcasting.py +71 -20
- {nextloop-1.1.0 → nextloop-1.2.0}/tests/test_worker_conformance.py +74 -18
- nextloop-1.1.0/docs/adr/0001-embeddable-agent-loop.md +0 -48
- nextloop-1.1.0/docs/adr/0002-dsh-aligned-agent-loop.md +0 -42
- nextloop-1.1.0/docs/adr/0004-event-compatibility.md +0 -27
- nextloop-1.1.0/docs/adr/0005-pending-input.md +0 -32
- nextloop-1.1.0/docs/adr/0006-operation-id.md +0 -24
- nextloop-1.1.0/docs/adr/0007-approval.md +0 -25
- nextloop-1.1.0/docs/adr/0008-lease.md +0 -24
- nextloop-1.1.0/docs/adr/0009-outbox.md +0 -30
- nextloop-1.1.0/docs/adr/0010-session-deletion.md +0 -28
- nextloop-1.1.0/docs/adr/0011-live-provider-acceptance.md +0 -18
- nextloop-1.1.0/docs/architecture/agent-loop-capability-review.md +0 -147
- nextloop-1.1.0/docs/architecture/development-plan.md +0 -72
- nextloop-1.1.0/docs/architecture/discussion-roadmap.md +0 -50
- nextloop-1.1.0/docs/architecture/feature-worklist.md +0 -34
- nextloop-1.1.0/docs/architecture/requirements.md +0 -30
- nextloop-1.1.0/docs/design/architecture.md +0 -69
- nextloop-1.1.0/docs/design/context-builder.md +0 -139
- nextloop-1.1.0/docs/design/guarantees.md +0 -33
- nextloop-1.1.0/docs/design/harness.md +0 -203
- nextloop-1.1.0/docs/design/loop-interface.md +0 -105
- nextloop-1.1.0/docs/design/react-protocol.md +0 -53
- nextloop-1.1.0/docs/research/2026-11-02-dsh-primary-sources.md +0 -144
- nextloop-1.1.0/docs/research/2026-11-02-loop-evidence-notes.md +0 -122
- nextloop-1.1.0/docs/research/2026-11-03-hermes-turn-control.md +0 -96
- nextloop-1.1.0/docs/research/2026-11-03-tool-batch-failures.md +0 -109
- nextloop-1.1.0/docs/research/2026-11-03-tool-call-validation.md +0 -69
- nextloop-1.1.0/docs/research/2026-11-03-yomi-turn-control.md +0 -5
- nextloop-1.1.0/docs/research/2026-11-06-open-source-agent-loops.md +0 -204
- nextloop-1.1.0/docs/research/2026-11-10-nextloop-optimization-review.md +0 -197
- nextloop-1.1.0/examples/basic.py +0 -64
- nextloop-1.1.0/examples/python_tools.py +0 -20
- nextloop-1.1.0/examples/skills/coding/SKILL.md +0 -13
- nextloop-1.1.0/examples/skills_demo.py +0 -16
- nextloop-1.1.0/examples/workers/cpp_worker.cpp +0 -111
- nextloop-1.1.0/examples/workers/python_worker.py +0 -161
- nextloop-1.1.0/examples/workers/rust_worker.rs +0 -103
- nextloop-1.1.0/src/nextloop/adapters/_http.py +0 -28
- nextloop-1.1.0/src/nextloop/adapters/memory.py +0 -229
- nextloop-1.1.0/src/nextloop/cli.py +0 -157
- nextloop-1.1.0/src/nextloop/events/codec.py +0 -63
- nextloop-1.1.0/src/nextloop/events/project.py +0 -315
- nextloop-1.1.0/src/nextloop/events/repair.py +0 -200
- nextloop-1.1.0/src/nextloop/execute/cancellation.py +0 -29
- nextloop-1.1.0/src/nextloop/execute/tools.py +0 -146
- nextloop-1.1.0/tests/test_cli.py +0 -67
- nextloop-1.1.0/tests/test_compaction_lineage.py +0 -75
- nextloop-1.1.0/tests/test_complexity_regressions.py +0 -56
- nextloop-1.1.0/tests/test_correctness_regressions.py +0 -174
- nextloop-1.1.0/tests/test_execution_races.py +0 -85
- nextloop-1.1.0/tests/test_execution_regressions.py +0 -242
- nextloop-1.1.0/tests/test_harness.py +0 -271
- nextloop-1.1.0/tests/test_harness_delegation.py +0 -424
- nextloop-1.1.0/tests/test_harness_injection.py +0 -87
- nextloop-1.1.0/tests/test_mcp_hardening.py +0 -84
- nextloop-1.1.0/tests/test_observability_close_deadline.py +0 -53
- nextloop-1.1.0/tests/test_outbox.py +0 -137
- nextloop-1.1.0/tests/test_projection_parity.py +0 -17
- nextloop-1.1.0/tests/test_provider_terminal.py +0 -105
- nextloop-1.1.0/tests/test_result_budget_regressions.py +0 -51
- nextloop-1.1.0/tests/test_result_policies.py +0 -168
- nextloop-1.1.0/tests/test_retry_regressions.py +0 -148
- nextloop-1.1.0/tests/test_review_regressions.py +0 -205
- nextloop-1.1.0/tests/test_sqlite_safety.py +0 -76
- nextloop-1.1.0/tests/test_store_contract.py +0 -81
- nextloop-1.1.0/tests/test_store_regressions.py +0 -225
- nextloop-1.1.0/tests/test_stores.py +0 -68
- nextloop-1.1.0/tests/test_surface_snapshot.py +0 -70
- {nextloop-1.1.0 → nextloop-1.2.0}/LICENSE +0 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/setup.cfg +0 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/events/trace_ids.py +0 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/execute/cleanup.py +0 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop/py.typed +0 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop.egg-info/dependency_links.txt +0 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop.egg-info/entry_points.txt +0 -0
- {nextloop-1.1.0 → nextloop-1.2.0}/src/nextloop.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nextloop
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.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
|
|
@@ -25,6 +25,8 @@ Requires-Dist: pytest-asyncio<2,>=0.24; extra == "dev"
|
|
|
25
25
|
Requires-Dist: ruff<1,>=0.8; extra == "dev"
|
|
26
26
|
Requires-Dist: twine<7,>=5; extra == "dev"
|
|
27
27
|
Requires-Dist: types-jsonschema<5,>=4.23; extra == "dev"
|
|
28
|
+
Provides-Extra: property
|
|
29
|
+
Requires-Dist: hypothesis<7,>=6; extra == "property"
|
|
28
30
|
Dynamic: license-file
|
|
29
31
|
|
|
30
32
|
<div align="center">
|
|
@@ -47,7 +49,8 @@ Dynamic: license-file
|
|
|
47
49
|
<a href="docs/design/harness.md">Configuration</a> ·
|
|
48
50
|
<a href="docs/design/loop-interface.md">API</a> ·
|
|
49
51
|
<a href="docs/design/guarantees.md">Guarantees</a> ·
|
|
50
|
-
<a href="CONTRIBUTING.md">Contributing</a>
|
|
52
|
+
<a href="CONTRIBUTING.md">Contributing</a> ·
|
|
53
|
+
<a href="README.zh-CN.md">中文版</a>
|
|
51
54
|
</p>
|
|
52
55
|
</div>
|
|
53
56
|
|
|
@@ -84,9 +87,9 @@ Your application provides the model, tools, storage, and delivery method.
|
|
|
84
87
|
</tr>
|
|
85
88
|
</table>
|
|
86
89
|
|
|
87
|
-
The example prints `hello from nextloop
|
|
90
|
+
The example calls a Tool and prints `hello from nextloop`.
|
|
88
91
|
|
|
89
|
-
Follow [Your first AgentLoop](docs/tutorial.md) to build the same
|
|
92
|
+
Follow [Your first AgentLoop](docs/tutorial.md) to build the same flow yourself. The tutorial also shows how to connect a hosted model.
|
|
90
93
|
|
|
91
94
|
## What nextloop provides
|
|
92
95
|
|
|
@@ -135,16 +138,43 @@ Follow [Your first AgentLoop](docs/tutorial.md) to build the same model → Tool
|
|
|
135
138
|
</tr>
|
|
136
139
|
</table>
|
|
137
140
|
|
|
138
|
-
nextloop
|
|
141
|
+
nextloop is a library, not an HTTP service or a multi-agent framework. Your application controls when to run, deliver, and recover work. `Harness` gives you one place to perform these operations. The Event log is the source of truth.
|
|
142
|
+
|
|
143
|
+
## Direction
|
|
144
|
+
|
|
145
|
+
Keep the core small and easy to understand. Use a few clear concepts and keep optional capabilities in adapters and outer layers.
|
|
146
|
+
|
|
147
|
+
### Reliable execution
|
|
148
|
+
|
|
149
|
+
Make long-running and concurrent work easier to recover and reason about. Improve the runtime when real use and test evidence show a need.
|
|
150
|
+
|
|
151
|
+
### Composable capabilities
|
|
152
|
+
|
|
153
|
+
Let applications add long-term Memory, evaluation, and Recursive Self-Improvement (RSI) through small public interfaces. Applications own Memory policy, experiment strategy, scoring, and product decisions.
|
|
154
|
+
|
|
155
|
+
### Open observability
|
|
156
|
+
|
|
157
|
+
Let applications connect OpenTelemetry, Langfuse, and other systems through Adapters. Adapters own vendor-specific features and dependencies.
|
|
158
|
+
|
|
159
|
+
### Tools in more languages
|
|
160
|
+
|
|
161
|
+
Make Tools easier to write in languages such as Go and Rust through the existing Worker model. Share one AgentLoop core across languages.
|
|
162
|
+
|
|
163
|
+
### Stable core, independent extensions
|
|
164
|
+
|
|
165
|
+
Keep the public API and Event history coherent while extensions evolve independently. Let real consumer needs guide new core interfaces. Release verified improvements.
|
|
139
166
|
|
|
140
167
|
## Documentation
|
|
141
168
|
|
|
169
|
+
Start with the [documentation index](docs/README.md) for current contracts, design decisions, historical plans, and research evidence.
|
|
170
|
+
|
|
142
171
|
<table role="presentation">
|
|
143
172
|
<tr>
|
|
144
173
|
<td width="30%" valign="top">
|
|
145
174
|
<strong>Get started</strong><br>
|
|
146
175
|
<a href="docs/tutorial.md">Your first AgentLoop</a><br>
|
|
147
176
|
<a href="docs/design/harness.md">Harness configuration</a><br>
|
|
177
|
+
<a href="docs/design/exporters.md">Custom Trace Exporters</a><br>
|
|
148
178
|
<a href="docs/design/loop-interface.md">Public API and adapters</a>
|
|
149
179
|
</td>
|
|
150
180
|
<td width="40%" valign="top">
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
<a href="docs/design/harness.md">Configuration</a> ·
|
|
19
19
|
<a href="docs/design/loop-interface.md">API</a> ·
|
|
20
20
|
<a href="docs/design/guarantees.md">Guarantees</a> ·
|
|
21
|
-
<a href="CONTRIBUTING.md">Contributing</a>
|
|
21
|
+
<a href="CONTRIBUTING.md">Contributing</a> ·
|
|
22
|
+
<a href="README.zh-CN.md">中文版</a>
|
|
22
23
|
</p>
|
|
23
24
|
</div>
|
|
24
25
|
|
|
@@ -55,9 +56,9 @@ Your application provides the model, tools, storage, and delivery method.
|
|
|
55
56
|
</tr>
|
|
56
57
|
</table>
|
|
57
58
|
|
|
58
|
-
The example prints `hello from nextloop
|
|
59
|
+
The example calls a Tool and prints `hello from nextloop`.
|
|
59
60
|
|
|
60
|
-
Follow [Your first AgentLoop](docs/tutorial.md) to build the same
|
|
61
|
+
Follow [Your first AgentLoop](docs/tutorial.md) to build the same flow yourself. The tutorial also shows how to connect a hosted model.
|
|
61
62
|
|
|
62
63
|
## What nextloop provides
|
|
63
64
|
|
|
@@ -106,16 +107,43 @@ Follow [Your first AgentLoop](docs/tutorial.md) to build the same model → Tool
|
|
|
106
107
|
</tr>
|
|
107
108
|
</table>
|
|
108
109
|
|
|
109
|
-
nextloop
|
|
110
|
+
nextloop is a library, not an HTTP service or a multi-agent framework. Your application controls when to run, deliver, and recover work. `Harness` gives you one place to perform these operations. The Event log is the source of truth.
|
|
111
|
+
|
|
112
|
+
## Direction
|
|
113
|
+
|
|
114
|
+
Keep the core small and easy to understand. Use a few clear concepts and keep optional capabilities in adapters and outer layers.
|
|
115
|
+
|
|
116
|
+
### Reliable execution
|
|
117
|
+
|
|
118
|
+
Make long-running and concurrent work easier to recover and reason about. Improve the runtime when real use and test evidence show a need.
|
|
119
|
+
|
|
120
|
+
### Composable capabilities
|
|
121
|
+
|
|
122
|
+
Let applications add long-term Memory, evaluation, and Recursive Self-Improvement (RSI) through small public interfaces. Applications own Memory policy, experiment strategy, scoring, and product decisions.
|
|
123
|
+
|
|
124
|
+
### Open observability
|
|
125
|
+
|
|
126
|
+
Let applications connect OpenTelemetry, Langfuse, and other systems through Adapters. Adapters own vendor-specific features and dependencies.
|
|
127
|
+
|
|
128
|
+
### Tools in more languages
|
|
129
|
+
|
|
130
|
+
Make Tools easier to write in languages such as Go and Rust through the existing Worker model. Share one AgentLoop core across languages.
|
|
131
|
+
|
|
132
|
+
### Stable core, independent extensions
|
|
133
|
+
|
|
134
|
+
Keep the public API and Event history coherent while extensions evolve independently. Let real consumer needs guide new core interfaces. Release verified improvements.
|
|
110
135
|
|
|
111
136
|
## Documentation
|
|
112
137
|
|
|
138
|
+
Start with the [documentation index](docs/README.md) for current contracts, design decisions, historical plans, and research evidence.
|
|
139
|
+
|
|
113
140
|
<table role="presentation">
|
|
114
141
|
<tr>
|
|
115
142
|
<td width="30%" valign="top">
|
|
116
143
|
<strong>Get started</strong><br>
|
|
117
144
|
<a href="docs/tutorial.md">Your first AgentLoop</a><br>
|
|
118
145
|
<a href="docs/design/harness.md">Harness configuration</a><br>
|
|
146
|
+
<a href="docs/design/exporters.md">Custom Trace Exporters</a><br>
|
|
119
147
|
<a href="docs/design/loop-interface.md">Public API and adapters</a>
|
|
120
148
|
</td>
|
|
121
149
|
<td width="40%" valign="top">
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/wordmark-dark.svg">
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/wordmark-light.svg">
|
|
6
|
+
<img alt="nextloop — Python Agent 执行库" src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/wordmark-light.svg" width="800" height="200" fetchpriority="high">
|
|
7
|
+
</picture>
|
|
8
|
+
|
|
9
|
+
<p>
|
|
10
|
+
<a href="https://github.com/12bitsD/nextloop/actions/workflows/ci.yml"><img alt="CI 状态" src="https://img.shields.io/github/actions/workflow/status/12bitsD/nextloop/ci.yml?branch=main&style=flat-square&label=CI&color=black"></a>
|
|
11
|
+
<a href="https://pypi.org/project/nextloop/"><img alt="PyPI 版本" src="https://img.shields.io/pypi/v/nextloop?style=flat-square&color=black"></a>
|
|
12
|
+
<a href="https://pypi.org/project/nextloop/"><img alt="支持的 Python 版本" src="https://img.shields.io/pypi/pyversions/nextloop?style=flat-square&color=black"></a>
|
|
13
|
+
<a href="LICENSE"><img alt="MIT 许可证" src="https://img.shields.io/badge/license-MIT-black?style=flat-square"></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
<p>
|
|
17
|
+
<a href="docs/tutorial.md">使用教程</a> ·
|
|
18
|
+
<a href="docs/design/harness.md">配置说明</a> ·
|
|
19
|
+
<a href="docs/design/loop-interface.md">公共 API</a> ·
|
|
20
|
+
<a href="docs/design/guarantees.md">能力边界</a> ·
|
|
21
|
+
<a href="CONTRIBUTING.md">参与开发</a> ·
|
|
22
|
+
<a href="README.md">English</a>
|
|
23
|
+
</p>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
nextloop 是一个用于构建 Agent 应用的 Python 库。它负责协调模型调用和 Tool 执行,并记录每次运行的过程。
|
|
27
|
+
|
|
28
|
+
你可以通过这些记录检查运行过程,并在进程崩溃后恢复。恢复时,nextloop 不会自动重新执行已经派发过的 Tool。
|
|
29
|
+
|
|
30
|
+
模型、Tool、存储和最终结果的投递方式由你的应用提供。
|
|
31
|
+
|
|
32
|
+
<div align="center">
|
|
33
|
+
<picture>
|
|
34
|
+
<source media="(max-width: 600px) and (prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/steps-compact-dark.svg">
|
|
35
|
+
<source media="(max-width: 600px) and (prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/steps-compact-light.svg">
|
|
36
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/steps-dark.svg">
|
|
37
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/steps-light.svg">
|
|
38
|
+
<img alt="执行路径:输入、模型、Tool、模型和投递,每个阶段都记录在事件历史中" src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/steps-light.svg" width="900" loading="lazy">
|
|
39
|
+
</picture>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
## 快速开始
|
|
43
|
+
|
|
44
|
+
<table role="presentation">
|
|
45
|
+
<tr>
|
|
46
|
+
<td width="50%" valign="top">
|
|
47
|
+
<strong>01 / 安装</strong><br>
|
|
48
|
+
需要 Python 3.11 或更高版本。
|
|
49
|
+
<pre><code>python -m pip install nextloop</code></pre>
|
|
50
|
+
</td>
|
|
51
|
+
<td width="50%" valign="top">
|
|
52
|
+
<strong>02 / 运行示例</strong><br>
|
|
53
|
+
在源码目录中运行,不需要 API key。
|
|
54
|
+
<pre><code>python examples/basic.py</code></pre>
|
|
55
|
+
</td>
|
|
56
|
+
</tr>
|
|
57
|
+
</table>
|
|
58
|
+
|
|
59
|
+
示例会调用一个 Tool,并输出 `hello from nextloop`。
|
|
60
|
+
|
|
61
|
+
按照[第一个 AgentLoop 教程](docs/tutorial.md),你可以自己实现同样的流程,并学习如何接入托管模型。
|
|
62
|
+
|
|
63
|
+
## 主要功能
|
|
64
|
+
|
|
65
|
+
<table role="presentation">
|
|
66
|
+
<tr>
|
|
67
|
+
<td width="50%" valign="top">
|
|
68
|
+
<img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/history.svg" width="36" height="36" alt="">
|
|
69
|
+
<br>
|
|
70
|
+
<strong>执行历史</strong><br>
|
|
71
|
+
记录模型调用、Tool 调用、执行结果和最终回复。支持查询历史和导出 Trace。
|
|
72
|
+
</td>
|
|
73
|
+
<td width="50%" valign="top">
|
|
74
|
+
<img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/recovery.svg" width="36" height="36" alt="">
|
|
75
|
+
<br>
|
|
76
|
+
<strong>崩溃恢复</strong><br>
|
|
77
|
+
查看已完成和结果不确定的操作。重新投递已提交的最终回复,无需重新运行模型或 Tool。
|
|
78
|
+
</td>
|
|
79
|
+
</tr>
|
|
80
|
+
<tr>
|
|
81
|
+
<td width="50%" valign="top">
|
|
82
|
+
<img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/integration.svg" width="36" height="36" alt="">
|
|
83
|
+
<br>
|
|
84
|
+
<strong>Tool 与模型接入</strong><br>
|
|
85
|
+
支持 Python、MCP、Rust 和 C++ Tool,内置 OpenAI 兼容及 Anthropic Provider,也支持自定义 Adapter。
|
|
86
|
+
</td>
|
|
87
|
+
<td width="50%" valign="top">
|
|
88
|
+
<img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/limits.svg" width="36" height="36" alt="">
|
|
89
|
+
<br>
|
|
90
|
+
<strong>执行限制</strong><br>
|
|
91
|
+
限制 Step 数、模型调用次数、Tool 调用次数、Token 用量和运行时间。
|
|
92
|
+
</td>
|
|
93
|
+
</tr>
|
|
94
|
+
<tr>
|
|
95
|
+
<td width="50%" valign="top">
|
|
96
|
+
<img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/results.svg" width="36" height="36" alt="">
|
|
97
|
+
<br>
|
|
98
|
+
<strong>大结果读取</strong><br>
|
|
99
|
+
向模型展示预览或分页内容,同时保留完整结果供后续读取。
|
|
100
|
+
</td>
|
|
101
|
+
<td width="50%" valign="top">
|
|
102
|
+
<img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/streaming.svg" width="36" height="36" alt="">
|
|
103
|
+
<br>
|
|
104
|
+
<strong>流式预览</strong><br>
|
|
105
|
+
流式查看输出,不执行未完成的 Tool 调用,不改变事件历史,也不替代最终回复。
|
|
106
|
+
</td>
|
|
107
|
+
</tr>
|
|
108
|
+
</table>
|
|
109
|
+
|
|
110
|
+
nextloop 是一个 Python 库,不是 HTTP 服务或多 Agent 框架。你的应用决定何时运行、投递和恢复工作。`Harness` 提供统一的操作入口,Event 日志是唯一事实来源。
|
|
111
|
+
|
|
112
|
+
## 发展方向
|
|
113
|
+
|
|
114
|
+
保持核心简单、容易理解。只保留少量清晰的概念,将可选能力放在 Adapter 和外层扩展中。
|
|
115
|
+
|
|
116
|
+
### 可靠的执行
|
|
117
|
+
|
|
118
|
+
让长程和并发任务更容易恢复,也更容易理解运行状态。根据真实需求和测试证据改进运行时。
|
|
119
|
+
|
|
120
|
+
### 可组合的能力
|
|
121
|
+
|
|
122
|
+
应用可以通过小型公共接口接入长期 Memory、评估和递归自我改进(RSI)。Memory 策略、实验策略、评分和产品决策由应用负责。
|
|
123
|
+
|
|
124
|
+
### 开放的可观测性
|
|
125
|
+
|
|
126
|
+
应用可以通过 Adapter 接入 OpenTelemetry、Langfuse 和其他观测系统。平台特性和依赖由各自的 Adapter 负责。
|
|
127
|
+
|
|
128
|
+
### 多语言 Tool
|
|
129
|
+
|
|
130
|
+
通过现有 Worker 模型,让 Go、Rust 等语言更容易编写 Tool。不同语言共用一个 AgentLoop 核心。
|
|
131
|
+
|
|
132
|
+
### 稳定的核心,独立的扩展
|
|
133
|
+
|
|
134
|
+
保持公共 API 和 Event 历史一致,同时让扩展独立演进。根据真实使用需求增加核心接口,发布经过验证的改进。
|
|
135
|
+
|
|
136
|
+
## 文档
|
|
137
|
+
|
|
138
|
+
从[文档索引](docs/README.md)开始,查找当前使用说明、设计决策、历史规划和研究证据。
|
|
139
|
+
|
|
140
|
+
<table role="presentation">
|
|
141
|
+
<tr>
|
|
142
|
+
<td width="30%" valign="top">
|
|
143
|
+
<strong>快速上手</strong><br>
|
|
144
|
+
<a href="docs/tutorial.md">第一个 AgentLoop</a><br>
|
|
145
|
+
<a href="docs/design/harness.md">Harness 配置</a><br>
|
|
146
|
+
<a href="docs/design/exporters.md">自定义观测导出</a><br>
|
|
147
|
+
<a href="docs/design/loop-interface.md">公共 API 与 Adapter</a>
|
|
148
|
+
</td>
|
|
149
|
+
<td width="40%" valign="top">
|
|
150
|
+
<strong>理解运行时</strong><br>
|
|
151
|
+
<a href="docs/design/architecture.md">整体架构</a><br>
|
|
152
|
+
<a href="docs/design/agent-loop.md">AgentLoop 设计</a><br>
|
|
153
|
+
<a href="docs/design/guarantees.md">能力边界</a><br>
|
|
154
|
+
<a href="CONTEXT.md">领域术语</a><br>
|
|
155
|
+
<a href="docs/adr/">设计决策</a>
|
|
156
|
+
</td>
|
|
157
|
+
<td width="30%" valign="top">
|
|
158
|
+
<strong>验证与开发</strong><br>
|
|
159
|
+
<a href="docs/design/verification-matrix.md">验证矩阵</a><br>
|
|
160
|
+
<a href="CONTRIBUTING.md">参与开发</a><br>
|
|
161
|
+
<a href="CHANGELOG.md">变更日志</a><br>
|
|
162
|
+
<a href="SECURITY.md">安全说明</a>
|
|
163
|
+
</td>
|
|
164
|
+
</tr>
|
|
165
|
+
</table>
|
|
166
|
+
|
|
167
|
+
## 发布与安全
|
|
168
|
+
|
|
169
|
+
<table role="presentation">
|
|
170
|
+
<tr>
|
|
171
|
+
<td valign="top">
|
|
172
|
+
<img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/testing.svg" width="36" height="36" alt="">
|
|
173
|
+
<br>
|
|
174
|
+
<strong>Python 支持</strong><br>
|
|
175
|
+
CI 覆盖 Python 3.11、3.12、3.13 和 3.14。
|
|
176
|
+
</td>
|
|
177
|
+
</tr>
|
|
178
|
+
<tr>
|
|
179
|
+
<td valign="top">
|
|
180
|
+
<img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/release.svg" width="36" height="36" alt="">
|
|
181
|
+
<br>
|
|
182
|
+
<strong>版本发布</strong><br>
|
|
183
|
+
创建 <code>v*</code> tag 后,CI 会验证包和基准,通过 Trusted Publishing 将 wheel 和 sdist 发布到 PyPI,并创建 GitHub Release。
|
|
184
|
+
</td>
|
|
185
|
+
</tr>
|
|
186
|
+
<tr>
|
|
187
|
+
<td valign="top">
|
|
188
|
+
<img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/security.svg" width="36" height="36" alt="">
|
|
189
|
+
<br>
|
|
190
|
+
<strong>公开仓库</strong><br>
|
|
191
|
+
请勿提交凭据、私有执行轨迹、内部端点或个人数据。
|
|
192
|
+
</td>
|
|
193
|
+
</tr>
|
|
194
|
+
</table>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# nextloop documentation
|
|
2
|
+
|
|
3
|
+
New to nextloop? Start with the [tutorial](tutorial.md). Use the current guides to learn how the library works. Use the other sections when you need design history or research.
|
|
4
|
+
|
|
5
|
+
## Learn the basics
|
|
6
|
+
|
|
7
|
+
- [Tutorial](tutorial.md) — run your first AgentLoop and connect a hosted model.
|
|
8
|
+
- [Architecture](design/architecture.md) — see how the main parts work together.
|
|
9
|
+
- [Harness configuration](design/harness.md) — configure models, storage, Tools, and exports.
|
|
10
|
+
- [Custom Trace Exporters](design/exporters.md) — send execution records to your own observability system.
|
|
11
|
+
- [Plan mode and goal loops](design/outer-policies.md) — build read-only planning and multi-Turn goals in outer layers.
|
|
12
|
+
- [Public API and adapters](design/loop-interface.md) — connect your own implementations.
|
|
13
|
+
- [Guarantees](design/guarantees.md) — learn what nextloop does and does not promise.
|
|
14
|
+
- [Verification matrix](design/verification-matrix.md) — see how those promises are tested.
|
|
15
|
+
- [Domain glossary](../CONTEXT.md) — look up execution terms.
|
|
16
|
+
- [Project direction](../README.md#direction) — read the broad design direction.
|
|
17
|
+
|
|
18
|
+
## Design and release history
|
|
19
|
+
|
|
20
|
+
The [design guides](design/) describe current behavior. [Architecture Decision Records](adr/) explain why earlier decisions were made. They are not a checklist of current work.
|
|
21
|
+
|
|
22
|
+
The [architecture documents](architecture/) contain requirements, release plans, reviews, and earlier roadmaps. If their status conflicts with current code, tests, or design guides, use the current sources.
|
|
23
|
+
|
|
24
|
+
## Research and evaluation
|
|
25
|
+
|
|
26
|
+
[Research notes](research/) are dated investigations, not current product contracts. They include:
|
|
27
|
+
|
|
28
|
+
- [Open-source AgentLoop comparison](research/2026-11-06-open-source-agent-loops.md)
|
|
29
|
+
- [Tool failures and Event recovery research](research/2026-11-06-react-tool-event-recovery.md)
|
|
30
|
+
- [Observability, Langfuse, and OpenTelemetry integration boundaries](research/2026-11-09-observability-langfuse.md)
|
|
31
|
+
- [Optimization review](research/2026-11-10-nextloop-optimization-review.md)
|
|
32
|
+
- [Real-model evaluation results](research/real-eval-2026-11-13/) — Provider metrics, cache usage, recovery scenarios, and TTFT measurements
|
|
33
|
+
|
|
34
|
+
Each research document should state its date and evidence source. Do not treat design ideas, Fake Adapter tests, recorded streams, and live-model results as the same kind of evidence.
|
|
35
|
+
|
|
36
|
+
## Writing and maintenance rules
|
|
37
|
+
|
|
38
|
+
- Write for a first-time reader.
|
|
39
|
+
- Explain new terms before using abbreviations.
|
|
40
|
+
- Keep one main topic per document and use short sections.
|
|
41
|
+
- Show the common path before exceptions and history.
|
|
42
|
+
- Link to the current guide instead of copying its content.
|
|
43
|
+
- Update the relevant design guide when behavior changes.
|
|
44
|
+
- Preserve ADRs and dated research as history. Add a newer decision or note instead of silently changing their original claims.
|
|
45
|
+
- Keep disposable screenshots, previews, and scratch output under the ignored `.local/` directory.
|
|
46
|
+
- Do not commit credentials, private trajectories, internal endpoints, personal data, or `.DS_Store` files.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# ADR-0001: Keep nextloop as an embeddable execution library
|
|
2
|
+
|
|
3
|
+
- Status: Accepted
|
|
4
|
+
- Date: 2026-11-06
|
|
5
|
+
- Scope: repository ownership, public interfaces, documentation ownership, and release boundaries
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
nika started with one native AgentLoop alongside Feishu, AgentWiki, Skills, concrete Tools, deployment, and product policy. The execution protocol is useful outside nika, but keeping all of these responsibilities in one repository makes the Loop harder to reuse and verify independently.
|
|
10
|
+
|
|
11
|
+
We compared open-source AgentLoops in [open-source-agent-loops.md](../research/2026-11-06-open-source-agent-loops.md). None fit as a complete kernel. nextloop therefore has an independent implementation, using DSH as its main structural reference and Hermes as a secondary lifecycle reference. [ADR-0002](0002-dsh-aligned-agent-loop.md) later refined this decision.
|
|
12
|
+
|
|
13
|
+
## Decision
|
|
14
|
+
|
|
15
|
+
nextloop is an embeddable library, not an HTTP service, product bot, Router, EventBus, or multi-agent framework. Its public interface stays small:
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
AgentLoop.run(RunContext) -> RunOutcome
|
|
19
|
+
AgentLoop.steer(input)
|
|
20
|
+
AgentLoop.cancel(cause)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
nextloop owns:
|
|
24
|
+
|
|
25
|
+
- execution identities and state transitions;
|
|
26
|
+
- input and final-commit ordering;
|
|
27
|
+
- model invocation and retry admission;
|
|
28
|
+
- whole-batch Tool validation and correlated observations;
|
|
29
|
+
- unknown outcomes, Event Projection, and recovery;
|
|
30
|
+
- finalization and delivery-only recovery.
|
|
31
|
+
|
|
32
|
+
Consumers own their product behavior: goals, verification, Proactive behavior, supervision, multi-agent collaboration, channels, concrete Tools, credentials, resource supervision, Prompt and WorkingContext policy, Wiki, Skills, deployment, and product acceptance. These are outside nextloop.
|
|
33
|
+
|
|
34
|
+
## Documentation ownership
|
|
35
|
+
|
|
36
|
+
The execution contracts live in nextloop:
|
|
37
|
+
|
|
38
|
+
- `docs/design/agent-loop.md`
|
|
39
|
+
- `docs/design/context-builder.md`
|
|
40
|
+
- `docs/architecture/agent-loop-capability-review.md`
|
|
41
|
+
- `docs/research/`
|
|
42
|
+
|
|
43
|
+
nika keeps product-specific Prompt, AgentWiki, Feishu, deployment, and product design. Its former Loop paths contain navigation pointers only, not duplicate contracts.
|
|
44
|
+
|
|
45
|
+
Historical nika context remains in nika's [ADR-0002](https://github.com/12bitsD/nika/blob/main/docs/adr/0002-single-agent-loop.md) and [ADR-0001](https://github.com/12bitsD/nika/blob/main/docs/adr/0001-unified-agent-runtime.md). This ADR defines nextloop's own repository boundary; it does not claim those product documents moved here.
|
|
46
|
+
|
|
47
|
+
## Interface and release rules
|
|
48
|
+
|
|
49
|
+
- API compatibility and Event Schema compatibility are versioned separately.
|
|
50
|
+
- Provider-specific wire types stay out of the public Event envelope and Loop interface.
|
|
51
|
+
- Preview deltas are not authoritative Trajectory Events.
|
|
52
|
+
- A release requires failure and recovery tests, not only a successful model → Tool → model path.
|
|
53
|
+
- nika is the first consumer, not a special case in the public contract.
|
|
54
|
+
|
|
55
|
+
A contract test should not need a Feishu ID, Wiki path, desktop lock, or product Prompt. Replacing a channel should not require changing nextloop.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# ADR-0002: Follow DSH's AgentLoop with explicit execution deltas
|
|
2
|
+
|
|
3
|
+
- Status: Accepted (refined 2026-11-06)
|
|
4
|
+
- Date: 2026-11-06
|
|
5
|
+
- Scope: coordinates, driver structure, Tool scheduling, Tool outcomes, Surface Projection, and recovery
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
DSH provides a clear Event-sourced AgentLoop structure: append-only Session logs, Conversation derived from the Surface, integer `(turn, step)` coordinates, next-step Inbox checks, parallel/exclusive Tool barriers, and pure crash-closer functions.
|
|
10
|
+
|
|
11
|
+
An early nextloop draft was too complex: six nested UUID identities, four independent Tool status fields producing 80 combinations, and database exceptions controlling in-process steer/final races.
|
|
12
|
+
|
|
13
|
+
## Decision
|
|
14
|
+
|
|
15
|
+
nextloop adopts DSH's Turn/Step driver and Surface Projection, with five simplifications.
|
|
16
|
+
|
|
17
|
+
### 1. Numeric coordinates and writer fencing
|
|
18
|
+
|
|
19
|
+
Use `(session_id, turn, step, attempt)` plus `writer_epoch`.
|
|
20
|
+
|
|
21
|
+
- Recovery closes an interrupted Turn instead of replaying it, so `Turn` and `Run` become one `turn: int`.
|
|
22
|
+
- One Step is one logical Model request and its Tool batch, so `Step` and `ModelCall` become one `step: int`.
|
|
23
|
+
- `writer_epoch` rejects stale writers without another execution hierarchy.
|
|
24
|
+
|
|
25
|
+
### 2. Five closed Tool outcomes
|
|
26
|
+
|
|
27
|
+
Replace independent `status × execution_state × effect_state × continuation_allowed` fields with:
|
|
28
|
+
|
|
29
|
+
- `Completed`
|
|
30
|
+
- `Skipped`
|
|
31
|
+
- `Cancelled`
|
|
32
|
+
- `UncertainSettled`
|
|
33
|
+
- `UncertainHanging`
|
|
34
|
+
|
|
35
|
+
This prevents invalid combinations. `UncertainSettled` closes the batch and allows a same-Turn inspection Step. `UncertainHanging` closes the batch, locks resources, and blocks the Turn.
|
|
36
|
+
|
|
37
|
+
### 3. One in-memory actor per Session
|
|
38
|
+
|
|
39
|
+
One active `SessionDriver` serializes steer, Step transitions, and final commitment in memory. SQLite `PRIMARY KEY (session_id, seq)` and `writer_epoch` checks fail closed on crashes and stale writers; they are not normal `try/except` control flow.
|
|
40
|
+
|
|
41
|
+
### 4. Surface watermarks
|
|
42
|
+
|
|
43
|
+
- Audit-only Events such as `turn/start`, `step/start`, `assistant/attempt`, `tool/call`, and `delivery/*` use `surface_op='none'`.
|
|
44
|
+
- Model-visible messages use `surface_op='append'`.
|
|
45
|
+
- `compaction` uses `surface_op='epoch'`, so ContextBuilder reads only Events since the latest epoch.
|
|
46
|
+
|
|
47
|
+
### 5. Batch admission, scheduling, and Provider configuration
|
|
48
|
+
|
|
49
|
+
- Any malformed call or Schema error rejects the whole batch before dispatch.
|
|
50
|
+
- Admitted calls use bounded parallel pools and exclusive barriers, with Tool Results committed in model order.
|
|
51
|
+
- A parallel error does not stop sibling calls. An exclusive error or uncertain outcome marks later unstarted calls as `Skipped`, preventing dependent writes after a failure.
|
|
52
|
+
- Provider protocol, model, URL, and credentials stay outside Trajectory. Trajectory stores execution facts only.
|
|
53
|
+
|
|
54
|
+
## Consequences
|
|
55
|
+
|
|
56
|
+
The design has fewer identities and states while preserving its safety rules. Traces use readable integer coordinates, invalid Tool outcomes cannot be constructed, and Conversation Projection depends on the current epoch rather than total Session age.
|
|
@@ -4,28 +4,26 @@
|
|
|
4
4
|
- Date: 2026-11-06
|
|
5
5
|
- Scope: implementation language, dependencies, package layout, and `contracts.py` discipline
|
|
6
6
|
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
### Language and dependencies
|
|
7
|
+
## Language and dependencies
|
|
10
8
|
|
|
11
9
|
- Python 3.11+ with native `asyncio`; CI covers 3.11, 3.12, 3.13, and 3.14.
|
|
12
10
|
- Standard-library `dataclasses`, `typing`, and `sqlite3`.
|
|
13
11
|
- `httpx` for Provider HTTP/SSE and `jsonschema` for Tool argument validation.
|
|
14
12
|
- `pytest` and `pytest-asyncio` for tests; `ruff` and `mypy` for static checks.
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
## Public contracts in one file
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
`src/nextloop/contracts.py` contains the public data types and Protocols:
|
|
19
17
|
|
|
20
|
-
-
|
|
18
|
+
- Event coordinates and `SurfaceOp`;
|
|
21
19
|
- messages, requests, responses, Tool specs, and validation results;
|
|
22
|
-
- the closed
|
|
20
|
+
- the five closed `ToolOutcome` variants;
|
|
23
21
|
- `LoopConfig`, Turn/Recovery outcomes, errors, and versions;
|
|
24
|
-
-
|
|
22
|
+
- `EventStore`, `ModelProvider`, `ToolRuntime`, and `DeliveryOwner`.
|
|
25
23
|
|
|
26
|
-
`src/nextloop/__init__.py` explicitly re-exports the supported public
|
|
24
|
+
`src/nextloop/__init__.py` explicitly re-exports the supported public names. Provider-private wire types and consumer-owned product schemas stay outside this file.
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
## Package layout
|
|
29
27
|
|
|
30
28
|
```text
|
|
31
29
|
src/nextloop/
|
|
@@ -49,8 +47,8 @@ src/nextloop/
|
|
|
49
47
|
__init__.py # explicit public exports
|
|
50
48
|
```
|
|
51
49
|
|
|
52
|
-
`events/` contains pure functions with no I/O. `execute/` owns asynchronous side effects and normalized failures. `driver.py`
|
|
50
|
+
`events/` contains pure functions with no I/O. `execute/` owns asynchronous side effects and normalized failures. `driver.py` composes these mechanisms and owns finalization.
|
|
53
51
|
|
|
54
52
|
## No generic handler layer
|
|
55
53
|
|
|
56
|
-
There is no EventBus, middleware chain, per-state class hierarchy, or handler registry
|
|
54
|
+
There is no EventBus, middleware chain, per-state class hierarchy, or Session handler registry. `ToolRegistry` is a concrete `ToolRuntime`, not a lifecycle hook system. Registration/validation and batch scheduling remain separate because they have different responsibilities.
|
|
@@ -0,0 +1,29 @@
|
|
|
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. Version 0.6 adds operation identity, approval, and Compaction lineage fields without changing the Event envelope. Compatibility must not rewrite history, accept unknown future versions, or confuse upcast data with original stored bytes.
|
|
8
|
+
|
|
9
|
+
## Decision
|
|
10
|
+
|
|
11
|
+
New Events use Schema 1.1. Stores read 1.0 history and upcast it only during loading. Unknown versions fail with `InvariantViolation`. Readers that only support 1.0 cannot read a 1.1 Session.
|
|
12
|
+
|
|
13
|
+
Rules:
|
|
14
|
+
|
|
15
|
+
- Upcasting is pure, deterministic, and idempotent. Loading never runs an UPDATE or rewrites Events.
|
|
16
|
+
- Idempotent append compares the original stored payload and Event ID, not the upcast representation. Different original content is rejected.
|
|
17
|
+
- A 1.0 `TOOL_CALL` without `operation_id` gets a deterministic ID from `session_id`, `turn`, `step`, and `call_id`. The matching call in `ASSISTANT_MESSAGE` gets the same ID. The same call ID in another Step gets a different ID.
|
|
18
|
+
- A 1.0 `COMPACTION` without lineage gets `source_seqs=None`. No source range is invented.
|
|
19
|
+
- Projection, Trace, and Recovery use upcast Events. Idempotent append uses the stored, non-upcast representation.
|
|
20
|
+
- The reserved payload `{"_nextloop_erased": True}` marks erased content for future retention work. Reusing that Event ID raises `PayloadErasedError` without comparing content. No low-entropy PII hash is retained, and Event-level erasure is outside 0.6.
|
|
21
|
+
- Each released schema has a real Store fixture from that release. The 1.0 fixture covers repeated call IDs, Compaction, and an interrupted Tool Call. Reading and upcasting must not change fixture bytes.
|
|
22
|
+
|
|
23
|
+
## Consequences
|
|
24
|
+
|
|
25
|
+
- Old 1.0 logs remain readable without a migration write or downtime.
|
|
26
|
+
- Versions 0.5.0 and earlier intentionally cannot read 1.1 logs.
|
|
27
|
+
- Read-time compatibility does not weaken append idempotency or future-version checks.
|
|
28
|
+
- Legacy operation IDs are deterministic and coordinate-scoped. New operation IDs introduced in 0.6 are persisted facts, not regenerated during recovery.
|
|
29
|
+
- Erased payloads fail closed by identity without implementing deletion early or retaining PII hashes.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# ADR-0005: Pending Input as a pure log projection
|
|
2
|
+
|
|
3
|
+
Status: accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
`steer()` commits `INPUT_ACCEPTED` before writing the in-memory Inbox. `INPUT_ACCEPTED` alone is not shown to the model. A crash can therefore happen after an input is accepted but before the model sees it. Rebuilding state inside `recover()` would add another writer and another crash window.
|
|
8
|
+
|
|
9
|
+
## Decision
|
|
10
|
+
|
|
11
|
+
The Event log is the source of truth. The actor Inbox is only a wake-up signal.
|
|
12
|
+
|
|
13
|
+
Pending rules:
|
|
14
|
+
|
|
15
|
+
- Read `INPUT_ACCEPTED` and `USER_MESSAGE` in sequence order and match them by `input_id`.
|
|
16
|
+
- An accepted input without its `USER_MESSAGE` is Pending.
|
|
17
|
+
- Compute Pending at the start of each Turn. Recovery never writes the actor Inbox.
|
|
18
|
+
- A new Turn commits recovered Pending as `USER_MESSAGE` at its first Step boundary. Adding Pending only to a Provider request would leave it pending forever.
|
|
19
|
+
- Historical Pending appears before the new Turn's `initial_input`. Input accepted during approval suspension appears after the corresponding Tool Results.
|
|
20
|
+
- Inputs from cancelled or budget-terminated Turns carry into the next Turn by default.
|
|
21
|
+
- Active execution also checks the log, so input present in both the log and Inbox is injected once.
|
|
22
|
+
- Pending queries include `input_id`, original sequence, original Turn, and content.
|
|
23
|
+
- Repeated recovery, or a crash between recovery and run, produces the same Pending Projection without duplication.
|
|
24
|
+
|
|
25
|
+
### Idempotency
|
|
26
|
+
|
|
27
|
+
`input_id` is the deduplication boundary. Callers must reuse the same ID when retrying, or query Pending before trying again. Missing or generated IDs do not deduplicate across crashes. Explicit IDs must be non-empty.
|
|
28
|
+
|
|
29
|
+
- After successful initial input, the same ID and content return the original `TurnOutcome` without new execution.
|
|
30
|
+
- Failed, cancelled, blocked, interrupted, or still-Pending work may start a new Turn.
|
|
31
|
+
- Identical steer retries do not duplicate accepted input.
|
|
32
|
+
- Reusing any ID with different content is rejected before another `INPUT_ACCEPTED` is committed. The original Pending content is preserved.
|
|
33
|
+
|
|
34
|
+
This version has no cleanup Event. Pending remains visible until consumed, or until a later protocol defines an explicit discard fact.
|
|
35
|
+
|
|
36
|
+
## Consequences
|
|
37
|
+
|
|
38
|
+
- Accepted input is not silently lost after a process crash.
|
|
39
|
+
- No recovery writer or in-memory Pending copy can diverge from the log.
|
|
40
|
+
- Retrying with a new ID can intentionally duplicate content; this is not deduplicated.
|
|
41
|
+
- Compaction and approval pairing must preserve Pending order and keep each Tool Intent with its result.
|