feat(agent): add persistent runtime context providers

This commit is contained in:
chengyongru authored and Xubin Ren committed 2026-07-12 00:35:17 +08:00
1 parent 7f8c3453e1
commit f75d3519db
27 files changed
+789 -371

No files matched your search

+5
View File
@@ -11,6 +11,7 @@ if typing.TYPE_CHECKING:
from pydantic import BaseModel
from nanobot.agent.tools.context import ToolContext
from nanobot.runtime_context import RuntimeContextProvider
_ToolT = TypeVar("_ToolT", bound="Tool")
@@ -206,6 +207,10 @@ class Tool(ABC):
def create(cls, ctx: ToolContext) -> Tool:
return cls()
def runtime_context_provider(self) -> RuntimeContextProvider | None:
"""Return optional per-turn prompt context owned by this tool."""
return None
@abstractmethod
async def execute(self, **kwargs: Any) -> Any:
"""Run the tool; return content, or ``ToolResult.error(...)`` for failures."""