๊ฐ€์ž… ํ›„ ์ดˆ๋Œ€ ๋งํฌ๋ฅผ ๊ณต์œ ํ•˜๋ฉด ๋™์˜์ƒ ์žฌ์ƒ ๋ฐ ์ดˆ๋Œ€ ๋ณด์ƒ์„ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture ๆŠ•็จฟใฏๅ€‹ไบบใฎๆ„่ฆ‹ใงใ™ใ€‚
๊ฐ€์ž… May 2026
286 ํŒ”๋กœ์ž‰ ์ค‘    469 ํŒฌ
# Practical and Useful Patterns for OpenAI Agent SDK ๐ŸŒ No need to host your own MCP server -- OpenAI-hosted MCP tools get you started immediately. From repo investigation with DeepWiki to Google Calendar integration, all with minimal code. Hosted MCP server tools are managed by OpenAI, so you can integrate MCP capabilities into your agents without building any infrastructure. ๐Ÿ“Œ Title: MCP -- Hosted MCP server tools ๐Ÿ”— URL: ๐Ÿงฉ Overview Hosted MCP server tools let you use OpenAI-hosted MCP servers directly as agent tools. Simply specify the server URL via `HostedMCPTool` and your agent gains access to external services like DeepWiki (repository documentation search) or Google Calendar. Use `require_approval` to control pre-execution approval flows, and `on_approval_request` to combine auto-approval with human escalation. ๐Ÿ›  How to Use Import `Agent`, `Runner`, and `HostedMCPTool` from `agents`. Pass a `HostedMCPTool` to the agent's `tools`, setting `tool_config` with `type` as `"mcp"`, `server_label` as `"deepwiki"`, `server_url` as `""`, and `require_approval` as `"never"`. Run with ` "What are the key features of openai/openai-agents-python?")` and retrieve the result via ` ๐Ÿ— Practical Usage Patterns **Repo Investigation with DeepWiki in Minimal Code** No need to manually ingest OSS documentation -- investigate repository structure and features through DeepWiki MCP. Create an `Agent` with `name="OSSAnalyzer"` and investigation-focused `instructions`, passing a `HostedMCPTool` in `tools` with `server_label="deepwiki"`, `server_url=""`, and `require_approval="never"`. This gives you a repo investigation agent with minimal setup. **Safe Auto-Approval with require_approval + on_approval_request** Auto-approve read operations while escalating write operations to humans. Import `HostedMCPTool`, `MCPToolApprovalRequest`, and `MCPToolApprovalFunctionResult` from `agents`. Define a `smart_approval(request: MCPToolApprovalRequest) -> MCPToolApprovalFunctionResult` function that checks ` against a set of safe tools like `{"read_file", "search", "list_events", "get_event"}` -- returning `{"approve": True}` for auto-approval, or calling `ask_human_via_slack` for write tools and returning `{"approve": False, "reason": "..."}` when denied. Set `require_approval="always"` in the `tool_config` and pass `on_approval_request=smart_approval` to `HostedMCPTool`, creating a flow where reads are auto-approved and writes escalate to humans. **Authenticated Service Connection with connector_id** For services requiring authentication like Google Calendar, pass connector_id and auth tokens. Pass a `HostedMCPTool` to the agent's `tools` with `server_label="google_calendar"` in the `tool_config`. For connector-backed servers, use `connector_id="connector_googlecalendar"` instead of `server_url`, and supply the access token via `authorization=os.environ["GOOGLE_CALENDAR_AUTHORIZATION"]`. This builds an OAuth-authenticated Google Calendar integration agent. ๐Ÿ’ก Use Cases ๐Ÿ” Investigate OSS repo structure and features with DeepWiki + HostedMCPTool in minimal code ๐Ÿ›ก Auto-approve reads, escalate writes to humans with require_approval="always" + on_approval_request ๐Ÿ“… Build a scheduling assistant with connector_id + OAuth tokens for Google Calendar integration ๐Ÿค– Combine multiple Hosted MCP tools in a single agent for multi-service orchestration โš ๏ธ Caveats - Hosted MCP servers are hosted by OpenAI, so latency depends on network conditions. Configure timeouts appropriately. - Use `require_approval="never"` only for read-only services. Always implement approval flows for services with write capabilities. - OAuth token expiry management is your responsibility. Build in refresh token mechanisms. โœจ With Hosted MCP tools, you can start integrating external services without worrying about MCP server infrastructure. Try repo investigation with DeepWiki first, then gradually add approval flows and auth integrations! #OpenAIAgentSDK# #AIAgent#
๋” ๋ณด๊ธฐ