가입 후 초대 링크를 공유하면 동영상 재생 및 초대 보상을 받을 수 있습니다.

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture 投稿は個人の意見です。
가입 May 2026
286 팔로잉 중    470 팬
# Useful but Little-Known Features of OpenAI Agent SDK 🌍 Are you exposing every single tool from your MCP server to the agent? Tool filtering lets you control tool visibility statically or dynamically, improving agent accuracy and security. 📌 Title: Tool Filtering (Static / Dynamic) 🔗 URL: 🧩 Overview When MCP servers expose many tools, showing them all to the agent can cause confusion or unintended tool calls. The `tool_filter` parameter lets you use a static filter (`create_static_tool_filter`) to specify allow/block lists, or a dynamic filter (a sync or async callable) to decide tool availability based on runtime context. When both `allowed_tool_names` and `blocked_tool_names` are supplied, the allow-list is applied first and blocked tools are then removed from the remaining set. 🛠 How to use it ```python from agents.mcp import MCPServerStreamableHttp, create_static_tool_filter # Static filter: explicitly allow specific tools server = MCPServerStreamableHttp( params={"url": ""}, tool_filter=create_static_tool_filter( allowed_tool_names=["search", "summarize"] ), ) # Dynamic filter: decide at runtime using context async def my_filter(context, tool) -> bool: # context.agent, context.server_name available if == "admin": return True # Admins get all tools return in ["search", "read"] server_dynamic = MCPServerStreamableHttp( params={"url": ""}, tool_filter=my_filter, ) ``` 🏗 Building it into production ・Dynamically switch available tools based on user permission levels ・Use static filters to exclude unnecessary tools and improve model tool selection accuracy ・Pass tenant information via ` to isolate tools in multi-tenant environments ・Log dynamic filter decisions for access control audit trails 💡 Use cases 🔒 Role-based tool access control 🎯 Narrowing tools for task-specific agents 🏢 Tool isolation in multi-tenant environments 🛡 Enforcing security policies on tool access ⚠️ Watch out Dynamic filters are called every time the tool list is fetched, so heavy operations (like DB lookups) can impact latency. Keep filter logic simple and use caching when needed. Also verify that filtered-out tools aren't essential for the agent's core functionality. ✨ With tool filtering, give your agent exactly the tools it needs — nothing more, nothing less. #OpenAIAgentSDK# #AIAgent#
더 보기