diff --git a/nanobot/agent/__init__.py b/nanobot/agent/__init__.py index d3805805b..7d3ab2af4 100644 --- a/nanobot/agent/__init__.py +++ b/nanobot/agent/__init__.py @@ -2,10 +2,10 @@ from nanobot.agent.context import ContextBuilder from nanobot.agent.hook import AgentHook, AgentHookContext, CompositeHook -from nanobot.agent.loop import AgentLoop, LoopHook +from nanobot.agent.loop import AgentLoop from nanobot.agent.memory import MemoryStore from nanobot.agent.skills import SkillsLoader -from nanobot.agent.subagent import SubagentHook, SubagentManager +from nanobot.agent.subagent import SubagentManager __all__ = [ "AgentHook", @@ -13,9 +13,7 @@ __all__ = [ "AgentLoop", "CompositeHook", "ContextBuilder", - "LoopHook", "MemoryStore", "SkillsLoader", - "SubagentHook", "SubagentManager", ] diff --git a/nanobot/agent/loop.py b/nanobot/agent/loop.py index c45257657..97d352cb8 100644 --- a/nanobot/agent/loop.py +++ b/nanobot/agent/loop.py @@ -37,12 +37,11 @@ if TYPE_CHECKING: from nanobot.cron.service import CronService -class LoopHook(AgentHook): +class _LoopHook(AgentHook): """Core lifecycle hook for the main agent loop. Handles streaming delta relay, progress reporting, tool-call logging, - and think-tag stripping. Public so downstream users can subclass or - compose it via :class:`CompositeHook`. + and think-tag stripping for the built-in agent path. """ def __init__( @@ -105,7 +104,7 @@ class LoopHook(AgentHook): class _LoopHookChain(AgentHook): """Run the core loop hook first, then best-effort extra hooks. - This preserves the historical failure behavior of ``LoopHook`` while still + This preserves the historical failure behavior of ``_LoopHook`` while still letting user-supplied hooks opt into ``CompositeHook`` isolation. """ @@ -325,7 +324,7 @@ class AgentLoop: ``resuming=True`` means tool calls follow (spinner should restart); ``resuming=False`` means this is the final response. """ - loop_hook = LoopHook( + loop_hook = _LoopHook( self, on_progress=on_progress, on_stream=on_stream, diff --git a/nanobot/agent/subagent.py b/nanobot/agent/subagent.py index 691f53820..c1aaa2d0d 100644 --- a/nanobot/agent/subagent.py +++ b/nanobot/agent/subagent.py @@ -21,11 +21,8 @@ from nanobot.config.schema import ExecToolConfig from nanobot.providers.base import LLMProvider -class SubagentHook(AgentHook): - """Logging-only hook for subagent execution. - - Public so downstream users can subclass or compose via :class:`CompositeHook`. - """ +class _SubagentHook(AgentHook): + """Logging-only hook for subagent execution.""" def __init__(self, task_id: str) -> None: self._task_id = task_id @@ -138,7 +135,7 @@ class SubagentManager: tools=tools, model=self.model, max_iterations=15, - hook=SubagentHook(task_id), + hook=_SubagentHook(task_id), max_iterations_message="Task completed but no final response was generated.", error_message=None, fail_on_tool_error=True,