feat(agent): register native tools in agent loop

BashTool20250124, EditTool20250728, and ComputerTool20251124 are now
automatically registered alongside existing function tools.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 22:58:41 +00:00
parent 6003777eda
commit c5f78bf17e
+19 -5
View File
@@ -102,36 +102,50 @@ class AgentLoop:
def _register_default_tools(self) -> None:
"""Register the default set of tools."""
# Import native tools
from nanobot.agent.tools.anthropic import (
BashTool20250124,
EditTool20250728,
ComputerTool20251124,
)
# File tools (restrict to workspace if configured)
allowed_dir = self.workspace if self.restrict_to_workspace else None
self.tools.register(ReadFileTool(allowed_dir=allowed_dir))
self.tools.register(WriteFileTool(allowed_dir=allowed_dir))
self.tools.register(EditFileTool(allowed_dir=allowed_dir))
self.tools.register(ListDirTool(allowed_dir=allowed_dir))
# Shell tool
self.tools.register(ExecTool(
working_dir=str(self.workspace),
timeout=self.exec_config.timeout,
restrict_to_workspace=self.restrict_to_workspace,
))
# Web tools
self.tools.register(WebSearchTool(api_key=self.brave_api_key))
self.tools.register(WebFetchTool())
# Message tool
message_tool = MessageTool(send_callback=self.bus.publish_outbound, sessions=self.sessions)
self.tools.register(message_tool)
# Spawn tool (for subagents)
spawn_tool = SpawnTool(manager=self.subagents)
self.tools.register(spawn_tool)
self.tools.register(WaitForSubagentsTool(manager=self.subagents))
# Cron tool (for scheduling)
if self.cron_service:
self.tools.register(CronTool(self.cron_service))
# Register native Anthropic tools
self.tools.register(BashTool20250124())
self.tools.register(EditTool20250728())
self.tools.register(ComputerTool20251124())
logger.info("Registered native Anthropic tools: bash, text_editor, computer")
async def run(self) -> None:
"""Run the agent loop, processing messages from the bus."""