登録して招待リンクを共有すると、動画再生報酬と紹介報酬を獲得できます。

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture 投稿は個人の意見です。
参加 May 2026
258 フォロー中    220 ファン
# Useful but Little-Known Features of OpenAI Agent SDK 🌍 Too many tools eating up your token budget? There's a way to load tools only when needed. Combining `defer_loading` with `ToolSearchTool`, the model can search for and dynamically load only the tools it needs, dramatically reducing token consumption. 📌 Title: Hosted Tool Search / tool_namespace / defer_loading 🔗 URL: 🧩 Overview Tools decorated with `@function_tool(defer_loading=True)` are excluded from the tool list on the initial model call. By adding `ToolSearchTool()` to the agent, the model first searches for relevant tools and loads only the ones it needs. You can also group tools using `tool_namespace`. This is a powerful feature for optimizing token usage in agents with many tools. Note that this feature is only available with `OpenAIResponsesModel`. 🛠 How to use it ```python from agents import Agent, function_tool from agents.tool import ToolSearchTool @function_tool(defer_loading=True, tool_namespace="analytics") def run_report(report_type: str) -> str: return generate_report(report_type) @function_tool(defer_loading=True, tool_namespace="analytics") def export_csv(dataset: str) -> str: return create_csv(dataset) @function_tool(defer_loading=True, tool_namespace="admin") def manage_users(action: str) -> str: return user_management(action) agent = Agent( name="assistant", tools=[ ToolSearchTool(), # Enable tool search run_report, export_csv, manage_users, ], ) ``` 🏗 Building it into production ・Reduce token costs for agents with dozens to hundreds of tools ・Use `tool_namespace` to logically group tools and improve search accuracy ・Keep frequently used tools at `defer_loading=False` (default) and defer only rarely used ones ・Scale tool count without worrying about prompt size 💡 Use cases 🧰 Tool management for feature-rich SaaS agents 📊 On-demand loading of analytics and reporting tools 🔧 Showing admin tools only when needed 🚀 Ensuring tool count scalability ⚠️ Watch out This feature works only with `OpenAIResponsesModel` and is not available with other model providers. Deferred tools are unavailable on the first turn, so they're not suitable for tools that must respond immediately to the user's initial request. ✨ Load "only the right tools at the right time" with tool search for smarter agents. #OpenAIAgentSDK# #AIAgent#
もっと見る