__init__.py 677 B

123456789101112131415161718192021222324
  1. """
  2. Tools 包 - 工具注册和 Schema 生成
  3. """
  4. import os
  5. from agent.tools.registry import ToolRegistry, tool, get_tool_registry
  6. from agent.tools.schema import SchemaGenerator
  7. from agent.tools.models import ToolResult, ToolContext, ToolContextImpl
  8. # 导入 builtin 工具以触发 @tool 装饰器注册(可通过环境变量关闭)
  9. if os.getenv("AGENT_DISABLE_BUILTIN_TOOL_REGISTRATION", "").lower() not in {"1", "true", "yes", "on"}:
  10. # noqa: F401 表示这是故意的副作用导入
  11. import agent.tools.builtin # noqa: F401
  12. __all__ = [
  13. "ToolRegistry",
  14. "tool",
  15. "get_tool_registry",
  16. "SchemaGenerator",
  17. "ToolResult",
  18. "ToolContext",
  19. "ToolContextImpl",
  20. ]