""" Tools 包 - 工具注册和 Schema 生成 """ import os from agent.tools.registry import ToolRegistry, tool, get_tool_registry from agent.tools.schema import SchemaGenerator from agent.tools.models import ToolResult, ToolContext, ToolContextImpl # 导入 builtin 工具以触发 @tool 装饰器注册 # noqa: F401 表示这是故意的副作用导入 import agent.tools.builtin # noqa: F401 # 默认:bash / 文件类工具在存在 gateway_exec 或 AGENT_DEFAULT_DOCKER_CONTAINER 时走 docker exec # (见 agent.tools.docker_runner)。本机执行可设 AGENT_DISABLE_GATEWAY_WORKSPACE_DISPATCH / # AGENT_DISABLE_BASH_GATEWAY_DISPATCH=true。 _reg = get_tool_registry() if os.getenv("AGENT_DISABLE_GATEWAY_WORKSPACE_DISPATCH", "").strip().lower() not in ( "1", "true", "yes", ): from agent.tools.docker_runner import install_workspace_file_tools_dispatch install_workspace_file_tools_dispatch(_reg) if os.getenv("AGENT_DISABLE_BASH_GATEWAY_DISPATCH", "").strip().lower() not in ( "1", "true", "yes", ): from agent.tools.docker_runner import install_bash_gateway_dispatch install_bash_gateway_dispatch(_reg) __all__ = [ "ToolRegistry", "tool", "get_tool_registry", "SchemaGenerator", "ToolResult", "ToolContext", "ToolContextImpl", ]