Files
nanobot/nanobot/agent/execution_policy.py
T
chengyongruandchengyongru 62c2ed4e7e refactor(goal): sustain one ReAct run until the goal closes (#6538)
* refactor(goal): sustain one ReAct run until the goal closes

Keep active goals in the same runner beyond the ordinary iteration limit, with a final answer after successful closure. Remove cross-turn goal handoffs, continuation allowances and rollback bookkeeping while preserving input authorization, recovery, cancellation and terminal lifecycle ownership.

Contributes to NAN-392

Co-authored-by: chengyongru <chengyongru.ai@gmail.com>

* test(goal): consolidate sustained-run regression coverage

Retain lifecycle, history, usage, provider-state privacy and checkpoint cancellation assertions in the existing long-run scenarios. Remove duplicate smoke cases and parameter combinations that do not exercise distinct behavior; keep real Gateway, authorization and generation regressions.
2026-11-03 22:47:00 +08:00

26 lines
723 B
Python

"""Execution-local input authorization and optional sustained-run guidance."""
from __future__ import annotations
from collections.abc import Iterable
from contextlib import AbstractContextManager
from typing import Protocol
from nanobot.bus.events import InboundMessage
class ExecutionControlError(RuntimeError):
"""An input control operation failed."""
class ExecutionScope(Protocol):
def consume_inputs(self, messages: Iterable[InboundMessage]) -> None: ...
async def continuation_prompt(self) -> str | None: ...
class ExecutionPolicy(Protocol):
def scope(
self, session_key: str | None, generation: str | None, *, persistent: bool,
) -> AbstractContextManager[ExecutionScope]: ...