Metadata-Version: 2.4
Name: nextloop
Version: 1.1.0rc1
Summary: An embeddable AgentLoop with explicit event, tool, recovery, and delivery semantics
Author-email: 12bitsD <bis12@163.com>
License-Expression: MIT
Project-URL: Repository, https://github.com/12bitsD/nextloop
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx<1,>=0.27
Requires-Dist: jsonschema<5,>=4.23
Provides-Extra: dev
Requires-Dist: build<2,>=1.2; extra == "dev"
Requires-Dist: mypy<2,>=1.13; extra == "dev"
Requires-Dist: pytest<10,>=8; extra == "dev"
Requires-Dist: pytest-asyncio<2,>=0.24; extra == "dev"
Requires-Dist: ruff<1,>=0.8; extra == "dev"
Requires-Dist: twine<7,>=5; extra == "dev"
Requires-Dist: types-jsonschema<5,>=4.23; extra == "dev"
Dynamic: license-file

<div align="center">

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/wordmark-dark.svg">
  <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/wordmark-light.svg">
  <img alt="nextloop — Python agent execution library" src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/wordmark-light.svg" width="800" height="200" fetchpriority="high">
</picture>

<p>
  <a href="https://github.com/12bitsD/nextloop/actions/workflows/ci.yml"><img alt="CI status" src="https://img.shields.io/github/actions/workflow/status/12bitsD/nextloop/ci.yml?branch=main&amp;style=flat-square&amp;label=CI&amp;color=black"></a>
  <a href="https://pypi.org/project/nextloop/"><img alt="PyPI version" src="https://img.shields.io/pypi/v/nextloop?style=flat-square&amp;color=black"></a>
  <a href="https://pypi.org/project/nextloop/"><img alt="Python versions" src="https://img.shields.io/pypi/pyversions/nextloop?style=flat-square&amp;color=black"></a>
  <a href="LICENSE"><img alt="MIT license" src="https://img.shields.io/badge/license-MIT-black?style=flat-square"></a>
</p>

<p>
  <a href="docs/tutorial.md">Tutorial</a> ·
  <a href="docs/design/harness.md">Configuration</a> ·
  <a href="docs/design/loop-interface.md">API</a> ·
  <a href="docs/design/guarantees.md">Guarantees</a> ·
  <a href="CONTRIBUTING.md">Contributing</a>
</p>
</div>

nextloop is a Python library for building agent applications. It coordinates model calls and tool execution, and records what happens during each run.

These records let you inspect a run and recover after a process crash. During recovery, nextloop does not automatically run a dispatched tool again.

Your application provides the model, tools, storage, and delivery method.

<div align="center">
  <picture>
    <source media="(max-width: 600px) and (prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/steps-compact-dark.svg">
    <source media="(max-width: 600px) and (prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/steps-compact-light.svg">
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/steps-dark.svg">
    <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/steps-light.svg">
    <img alt="Execution path: input, model, tool, model, and delivery, with each stage recorded in event history" src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/steps-light.svg" width="900" loading="lazy">
  </picture>
</div>

## Quickstart

<table role="presentation">
  <tr>
    <td width="50%" valign="top">
      <strong>01 / Install</strong><br>
      Python 3.11 or later is required.
      <pre><code>python -m pip install nextloop</code></pre>
    </td>
    <td width="50%" valign="top">
      <strong>02 / Run the example</strong><br>
      Run from a source checkout. No API key is needed.
      <pre><code>python examples/basic.py</code></pre>
    </td>
  </tr>
</table>

The example prints `hello from nextloop` after completing a two-Step Tool round trip.

Follow [Your first AgentLoop](docs/tutorial.md) to build the same model → Tool → model → Delivery run yourself. The tutorial also shows how to connect a hosted model with `Harness` and `harness.toml`.

## What nextloop provides

<table role="presentation">
  <tr>
    <td width="50%" valign="top">
      <img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/history.svg" width="36" height="36" alt="">
      <br>
      <strong>Execution history</strong><br>
      Record model calls, tool calls, results, and final responses. Query history or export traces.
    </td>
    <td width="50%" valign="top">
      <img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/recovery.svg" width="36" height="36" alt="">
      <br>
      <strong>Crash recovery</strong><br>
      See completed and uncertain operations. Redeliver committed responses without rerunning the model or tools.
    </td>
  </tr>
  <tr>
    <td width="50%" valign="top">
      <img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/integration.svg" width="36" height="36" alt="">
      <br>
      <strong>Tool and model integration</strong><br>
      Use Python, MCP, Rust, or C++ tools. OpenAI-compatible and Anthropic providers are included. Custom adapters are supported.
    </td>
    <td width="50%" valign="top">
      <img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/limits.svg" width="36" height="36" alt="">
      <br>
      <strong>Execution limits</strong><br>
      Limit steps, model calls, tool calls, tokens, and running time.
    </td>
  </tr>
  <tr>
    <td width="50%" valign="top">
      <img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/results.svg" width="36" height="36" alt="">
      <br>
      <strong>Large tool results</strong><br>
      Show previews or pages to the model. Keep full results available for later reads.
    </td>
    <td width="50%" valign="top">
      <img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/streaming.svg" width="36" height="36" alt="">
      <br>
      <strong>Streaming previews</strong><br>
      Stream output without executing partial tool calls, changing event history, or replacing the final response.
    </td>
  </tr>
</table>

nextloop does not provide an HTTP service or multi-agent orchestration. Your application controls execution, delivery, and recovery decisions. Harness delegates the complete run, approval-resume, reconciliation, pending-input, resource-lock, recovery, and deletion workflow, while Event logs remain the sole execution authority. Long Turns use pure Conversation Projection with cross-Store parity checks.

## Documentation

<table role="presentation">
  <tr>
    <td width="30%" valign="top">
      <strong>Get started</strong><br>
      <a href="docs/tutorial.md">Your first AgentLoop</a><br>
      <a href="docs/design/harness.md">Harness configuration</a><br>
      <a href="docs/design/loop-interface.md">Public API and adapters</a>
    </td>
    <td width="40%" valign="top">
      <strong>Understand the runtime</strong><br>
      <a href="docs/design/architecture.md">Architecture</a><br>
      <a href="docs/design/agent-loop.md">AgentLoop design</a><br>
      <a href="docs/design/guarantees.md">Guarantees</a><br>
      <a href="CONTEXT.md">Domain glossary</a><br>
      <a href="docs/adr/">Design decisions</a>
    </td>
    <td width="30%" valign="top">
      <strong>Verify and develop</strong><br>
      <a href="docs/design/verification-matrix.md">Verification matrix</a><br>
      <a href="CONTRIBUTING.md">Contributing</a><br>
      <a href="CHANGELOG.md">Changelog</a><br>
      <a href="SECURITY.md">Security</a>
    </td>
  </tr>
</table>

## Release and security

<table role="presentation">
  <tr>
    <td valign="top">
      <img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/testing.svg" width="36" height="36" alt="">
      <br>
      <strong>Python support</strong><br>
      CI covers Python 3.11, 3.12, 3.13, and 3.14.
    </td>
  </tr>
  <tr>
    <td valign="top">
      <img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/release.svg" width="36" height="36" alt="">
      <br>
      <strong>Tagged releases</strong><br>
      A <code>v*</code> tag verifies the package and benchmark, publishes wheel and sdist to PyPI through Trusted Publishing, and creates a GitHub Release.
    </td>
  </tr>
  <tr>
    <td valign="top">
      <img src="https://raw.githubusercontent.com/12bitsD/nextloop/main/docs/assets/icons/security.svg" width="36" height="36" alt="">
      <br>
      <strong>Public repository</strong><br>
      Do not commit credentials, private trajectories, internal endpoints, or personal data.
    </td>
  </tr>
</table>
