{
  "schemaVersion": "1.0",
  "item": {
    "slug": "ydc-openai-agent-sdk-integration",
    "name": "Integrate OpenAI Agents SDK with You.com MCP server",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/EdwardIrby/ydc-openai-agent-sdk-integration",
    "canonicalUrl": "https://clawhub.ai/EdwardIrby/ydc-openai-agent-sdk-integration",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/ydc-openai-agent-sdk-integration",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=ydc-openai-agent-sdk-integration",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/ydc-openai-agent-sdk-integration"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/ydc-openai-agent-sdk-integration",
    "agentPageUrl": "https://openagent3.xyz/skills/ydc-openai-agent-sdk-integration/agent",
    "manifestUrl": "https://openagent3.xyz/skills/ydc-openai-agent-sdk-integration/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/ydc-openai-agent-sdk-integration/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Integrate OpenAI Agents SDK with You.com MCP",
        "body": "Interactive workflow to set up OpenAI Agents SDK with You.com's MCP server."
      },
      {
        "title": "Workflow",
        "body": "Ask: Language Choice\n\nPython or TypeScript?\n\n\n\nAsk: MCP Configuration Type\n\nHosted MCP (OpenAI-managed with server URL): Recommended for simplicity\nStreamable HTTP (Self-managed connection): For custom infrastructure\n\n\n\nInstall Package\n\nPython: pip install openai-agents\nTypeScript: npm install @openai/agents\n\n\n\nAsk: Environment Variables\nFor Both Modes:\n\nYDC_API_KEY (You.com API key for Bearer token)\nOPENAI_API_KEY (OpenAI API key)\n\nHave they set them?\n\nIf NO: Guide to get keys:\n\nYDC_API_KEY: https://you.com/platform/api-keys\nOPENAI_API_KEY: https://platform.openai.com/api-keys\n\n\n\n\n\nAsk: File Location\n\nNEW file: Ask where to create and what to name\nEXISTING file: Ask which file to integrate into (add MCP config)\n\n\n\nCreate/Update File\nFor NEW files:\n\nUse the complete template code from the \"Complete Templates\" section below\nUser can run immediately with their API keys set\n\nFor EXISTING files:\n\nAdd MCP server configuration to their existing code\n\nHosted MCP configuration block (Python):\nfrom agents import Agent, Runner\nfrom agents.mcp import HostedMCPTool\n\n# Validate: ydc_api_key = os.getenv(\"YDC_API_KEY\")\nagent = Agent(\n    name=\"Assistant\",\n    instructions=\"Use You.com tools to answer questions.\",\n    tools=[\n        HostedMCPTool(\n            tool_config={\n                \"type\": \"mcp\",\n                \"server_label\": \"ydc\",\n                \"server_url\": \"https://api.you.com/mcp\",\n                \"headers\": {\n                    \"Authorization\": f\"Bearer {ydc_api_key}\"\n                },\n                \"require_approval\": \"never\",\n            }\n        )\n    ],\n)\n\nHosted MCP configuration block (TypeScript):\nimport { Agent, hostedMcpTool } from '@openai/agents';\n\n// Validate: const ydcApiKey = process.env.YDC_API_KEY;\nconst agent = new Agent({\n  name: 'Assistant',\n  instructions: 'Use You.com tools to answer questions.',\n  tools: [\n    hostedMcpTool({\n     serverLabel: 'ydc',\n      serverUrl: 'https://api.you.com/mcp',\n      headers: {\n        Authorization: `Bearer ${ydcApiKey}`,\n      },\n    }),\n  ],\n});\n\nStreamable HTTP configuration block (Python):\nfrom agents import Agent, Runner\nfrom agents.mcp import MCPServerStreamableHttp\n\n# Validate: ydc_api_key = os.getenv(\"YDC_API_KEY\")\nasync with MCPServerStreamableHttp(\n    name=\"You.com MCP Server\",\n    params={\n        \"url\": \"https://api.you.com/mcp\",\n        \"headers\": {\"Authorization\": f\"Bearer {ydc_api_key}\"},\n        \"timeout\": 10,\n    },\n    cache_tools_list=True,\n    max_retry_attempts=3,\n) as server:\n    agent = Agent(\n        name=\"Assistant\",\n        instructions=\"Use You.com tools to answer questions.\",\n        mcp_servers=[server],\n    )\n\nStreamable HTTP configuration block (TypeScript):\nimport { Agent, MCPServerStreamableHttp } from '@openai/agents';\n\n// Validate: const ydcApiKey = process.env.YDC_API_KEY;\nconst mcpServer = new MCPServerStreamableHttp({\n  url: 'https://api.you.com/mcp',\n  name: 'You.com MCP Server',\n  requestInit: {\n    headers: {\n      Authorization: `Bearer ${ydcApiKey}`,\n    },\n  },\n});\n\nconst agent = new Agent({\n  name: 'Assistant',\n  instructions: 'Use You.com tools to answer questions.',\n  mcpServers: [mcpServer],\n});"
      },
      {
        "title": "Complete Templates",
        "body": "Use these complete templates for new files. Each template is ready to run with your API keys set."
      },
      {
        "title": "Python Hosted MCP Template (Complete Example)",
        "body": "\"\"\"\nOpenAI Agents SDK with You.com Hosted MCP\nPython implementation with OpenAI-managed infrastructure\n\"\"\"\n\nimport os\nimport asyncio\nfrom agents import Agent, Runner\nfrom agents.mcp import HostedMCPTool\n\n# Validate environment variables\nydc_api_key = os.getenv(\"YDC_API_KEY\")\nopenai_api_key = os.getenv(\"OPENAI_API_KEY\")\n\nif not ydc_api_key:\n    raise ValueError(\n        \"YDC_API_KEY environment variable is required. \"\n        \"Get your key at: https://you.com/platform/api-keys\"\n    )\n\nif not openai_api_key:\n    raise ValueError(\n        \"OPENAI_API_KEY environment variable is required. \"\n        \"Get your key at: https://platform.openai.com/api-keys\"\n    )\n\n\nasync def main():\n    \"\"\"\n    Example: Search for AI news using You.com hosted MCP tools\n    \"\"\"\n    # Configure agent with hosted MCP tools\n    agent = Agent(\n        name=\"AI News Assistant\",\n        instructions=\"Use You.com tools to search for and answer questions about AI news.\",\n        tools=[\n            HostedMCPTool(\n                tool_config={\n                    \"type\": \"mcp\",\n                    \"server_label\": \"ydc\",\n                    \"server_url\": \"https://api.you.com/mcp\",\n                    \"headers\": {\n                        \"Authorization\": f\"Bearer {ydc_api_key}\"\n                    },\n                    \"require_approval\": \"never\",\n                }\n            )\n        ],\n    )\n\n    # Run agent with user query\n    result = await Runner.run(\n        agent,\n        \"Search for the latest AI news from this week\"\n    )\n\n    print(result.final_output)\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())"
      },
      {
        "title": "Python Streamable HTTP Template (Complete Example)",
        "body": "\"\"\"\nOpenAI Agents SDK with You.com Streamable HTTP MCP\nPython implementation with self-managed connection\n\"\"\"\n\nimport os\nimport asyncio\nfrom agents import Agent, Runner\nfrom agents.mcp import MCPServerStreamableHttp\n\n# Validate environment variables\nydc_api_key = os.getenv(\"YDC_API_KEY\")\nopenai_api_key = os.getenv(\"OPENAI_API_KEY\")\n\nif not ydc_api_key:\n    raise ValueError(\n        \"YDC_API_KEY environment variable is required. \"\n        \"Get your key at: https://you.com/platform/api-keys\"\n    )\n\nif not openai_api_key:\n    raise ValueError(\n        \"OPENAI_API_KEY environment variable is required. \"\n        \"Get your key at: https://platform.openai.com/api-keys\"\n    )\n\n\nasync def main():\n    \"\"\"\n    Example: Search for AI news using You.com streamable HTTP MCP server\n    \"\"\"\n    # Configure streamable HTTP MCP server\n    async with MCPServerStreamableHttp(\n        name=\"You.com MCP Server\",\n        params={\n            \"url\": \"https://api.you.com/mcp\",\n            \"headers\": {\"Authorization\": f\"Bearer {ydc_api_key}\"},\n            \"timeout\": 10,\n        },\n        cache_tools_list=True,\n        max_retry_attempts=3,\n    ) as server:\n        # Configure agent with MCP server\n        agent = Agent(\n            name=\"AI News Assistant\",\n            instructions=\"Use You.com tools to search for and answer questions about AI news.\",\n            mcp_servers=[server],\n        )\n\n        # Run agent with user query\n        result = await Runner.run(\n            agent,\n            \"Search for the latest AI news from this week\"\n        )\n\n        print(result.final_output)\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())"
      },
      {
        "title": "TypeScript Hosted MCP Template (Complete Example)",
        "body": "/**\n * OpenAI Agents SDK with You.com Hosted MCP\n * TypeScript implementation with OpenAI-managed infrastructure\n */\n\nimport { Agent, run, hostedMcpTool } from '@openai/agents';\n\n// Validate environment variables\nconst ydcApiKey = process.env.YDC_API_KEY;\nconst openaiApiKey = process.env.OPENAI_API_KEY;\n\nif (!ydcApiKey) {\n  throw new Error(\n    'YDC_API_KEY environment variable is required. ' +\n      'Get your key at: https://you.com/platform/api-keys'\n  );\n}\n\nif (!openaiApiKey) {\n  throw new Error(\n    'OPENAI_API_KEY environment variable is required. ' +\n      'Get your key at: https://platform.openai.com/api-keys'\n  );\n}\n\n/**\n * Example: Search for AI news using You.com hosted MCP tools\n */\nasync function main() {\n  // Configure agent with hosted MCP tools\n  const agent = new Agent({\n    name: 'AI News Assistant',\n    instructions:\n      'Use You.com tools to search for and answer questions about AI news.',\n    tools: [\n      hostedMcpTool({\n        serverLabel: 'ydc',\n        serverUrl: 'https://api.you.com/mcp',\n        headers: {\n          Authorization: `Bearer ${ydcApiKey}`,\n        },\n      }),\n    ],\n  });\n\n  // Run agent with user query\n  const result = await run(\n    agent,\n    'Search for the latest AI news from this week'\n  );\n\n  console.log(result.finalOutput);\n}\n\nmain().catch(console.error);"
      },
      {
        "title": "TypeScript Streamable HTTP Template (Complete Example)",
        "body": "/**\n * OpenAI Agents SDK with You.com Streamable HTTP MCP\n * TypeScript implementation with self-managed connection\n */\n\nimport { Agent, run, MCPServerStreamableHttp } from '@openai/agents';\n\n// Validate environment variables\nconst ydcApiKey = process.env.YDC_API_KEY;\nconst openaiApiKey = process.env.OPENAI_API_KEY;\n\nif (!ydcApiKey) {\n  throw new Error(\n    'YDC_API_KEY environment variable is required. ' +\n      'Get your key at: https://you.com/platform/api-keys'\n  );\n}\n\nif (!openaiApiKey) {\n  throw new Error(\n    'OPENAI_API_KEY environment variable is required. ' +\n      'Get your key at: https://platform.openai.com/api-keys'\n  );\n}\n\n/**\n * Example: Search for AI news using You.com streamable HTTP MCP server\n */\nasync function main() {\n  // Configure streamable HTTP MCP server\n  const mcpServer = new MCPServerStreamableHttp({\n    url: 'https://api.you.com/mcp',\n    name: 'You.com MCP Server',\n    requestInit: {\n      headers: {\n        Authorization: `Bearer ${ydcApiKey}`,\n      },\n    },\n  });\n\n  try {\n    // Connect to MCP server\n    await mcpServer.connect();\n\n    // Configure agent with MCP server\n    const agent = new Agent({\n      name: 'AI News Assistant',\n      instructions:\n        'Use You.com tools to search for and answer questions about AI news.',\n      mcpServers: [mcpServer],\n    });\n\n    // Run agent with user query\n    const result = await run(\n      agent,\n      'Search for the latest AI news from this week'\n    );\n\n    console.log(result.finalOutput);\n  } finally {\n    // Clean up connection\n    await mcpServer.close();\n  }\n}\n\nmain().catch(console.error);"
      },
      {
        "title": "Hosted MCP (Recommended)",
        "body": "What it is: OpenAI manages the MCP connection and tool routing through their Responses API.\n\nBenefits:\n\n✅ Simpler configuration (no connection management)\n✅ OpenAI handles authentication and retries\n✅ Lower latency (tools run in OpenAI infrastructure)\n✅ Automatic tool discovery and listing\n✅ No need to manage async context or cleanup\n\nUse when:\n\nBuilding production applications\nWant minimal boilerplate code\nNeed reliable tool execution\nDon't require custom transport layer\n\nConfiguration:\n\nPython:\n\nfrom agents.mcp import HostedMCPTool\n\ntools=[\n    HostedMCPTool(\n        tool_config={\n            \"type\": \"mcp\",\n            \"server_label\": \"ydc\",\n            \"server_url\": \"https://api.you.com/mcp\",\n            \"headers\": {\n                \"Authorization\": f\"Bearer {os.environ['YDC_API_KEY']}\"\n            },\n            \"require_approval\": \"never\",\n        }\n    )\n]\n\nTypeScript:\n\nimport { hostedMcpTool } from '@openai/agents';\n\ntools: [\n  hostedMcpTool({\n    serverLabel: 'ydc',\n    serverUrl: 'https://api.you.com/mcp',\n    headers: {\n      Authorization: `Bearer ${process.env.YDC_API_KEY}`,\n    },\n  }),\n]"
      },
      {
        "title": "Streamable HTTP MCP",
        "body": "What it is: You manage the MCP connection and transport layer yourself.\n\nBenefits:\n\n✅ Full control over network connection\n✅ Custom infrastructure integration\n✅ Can add custom headers, timeouts, retry logic\n✅ Run MCP server in your own environment\n✅ Better for testing and development\n\nUse when:\n\nNeed custom transport configuration\nRunning MCP server in your infrastructure\nRequire specific networking setup\nDevelopment and testing scenarios\n\nConfiguration:\n\nPython:\n\nfrom agents.mcp import MCPServerStreamableHttp\n\nasync with MCPServerStreamableHttp(\n    name=\"You.com MCP Server\",\n    params={\n        \"url\": \"https://api.you.com/mcp\",\n        \"headers\": {\"Authorization\": f\"Bearer {os.environ['YDC_API_KEY']}\"},\n        \"timeout\": 10,\n    },\n    cache_tools_list=True,\n    max_retry_attempts=3,\n) as server:\n    agent = Agent(mcp_servers=[server])\n\nTypeScript:\n\nimport { MCPServerStreamableHttp } from '@openai/agents';\n\nconst mcpServer = new MCPServerStreamableHttp({\n  url: 'https://api.you.com/mcp',\n  name: 'You.com MCP Server',\n  requestInit: {\n    headers: {\n      Authorization: `Bearer ${process.env.YDC_API_KEY}`,\n    },\n  },\n});\n\nawait mcpServer.connect();\ntry {\n  const agent = new Agent({ mcpServers: [mcpServer] });\n  // Use agent\n} finally {\n  await mcpServer.close();\n}"
      },
      {
        "title": "Available You.com Tools",
        "body": "After configuration, agents can discover and use:\n\nmcp__ydc__you_search - Web and news search\nmcp__ydc__you_express - AI-powered answers with web context\nmcp__ydc__you_contents - Web page content extraction"
      },
      {
        "title": "Environment Variables",
        "body": "Both API keys are required for both configuration modes:\n\n# Add to your .env file or shell profile\nexport YDC_API_KEY=\"your-you-api-key-here\"\nexport OPENAI_API_KEY=\"your-openai-api-key-here\"\n\nGet your API keys:\n\nYou.com: https://you.com/platform/api-keys\nOpenAI: https://platform.openai.com/api-keys"
      },
      {
        "title": "Validation Checklist",
        "body": "Before completing:\n\nPackage installed: openai-agents (Python) or @openai/agents (TypeScript)\n Environment variables set: YDC_API_KEY and OPENAI_API_KEY\n Template copied or configuration added to existing file\n MCP configuration type chosen (Hosted or Streamable HTTP)\n Authorization headers configured with Bearer token\n File is executable (Python) or can be compiled (TypeScript)\n Ready to test with example query"
      },
      {
        "title": "Testing Your Integration",
        "body": "Python:\n\npython your-file.py\n\nTypeScript:\n\n# With tsx (recommended for quick testing)\nnpx tsx your-file.ts\n\n# Or compile and run\ntsc your-file.ts && node your-file.js"
      },
      {
        "title": "Common Issues",
        "body": "Install the package:\n\n# NPM\nnpm install @openai/agents\n\n# Bun\nbun add @openai/agents\n\n# Yarn\nyarn add @openai/agents\n\n# pnpm\npnpm add @openai/agents\n\nSet your You.com API key:\n\nexport YDC_API_KEY=\"your-api-key-here\"\n\nGet your key at: https://you.com/platform/api-keys\n\nSet your OpenAI API key:\n\nexport OPENAI_API_KEY=\"your-api-key-here\"\n\nGet your key at: https://platform.openai.com/api-keys\n\nVerify your YDC_API_KEY is valid:\n\nCheck the key at https://you.com/platform/api-keys\nEnsure no extra spaces or quotes in the environment variable\nVerify the Authorization header format: Bearer ${YDC_API_KEY}\n\nFor Both Modes:\n\nEnsure server_url: \"https://api.you.com/mcp\" is correct\nVerify Authorization header includes Bearer prefix\nCheck YDC_API_KEY environment variable is set\nConfirm require_approval is set to \"never\" for automatic execution\n\nFor Streamable HTTP specifically:\n\nEnsure MCP server is connected before creating agent\nVerify connection was successful before running agent\n\nFor Streamable HTTP only:\n\nIncrease timeout or retry attempts:\n\nPython:\n\nasync with MCPServerStreamableHttp(\n    params={\n        \"url\": \"https://api.you.com/mcp\",\n        \"headers\": {\"Authorization\": f\"Bearer {os.environ['YDC_API_KEY']}\"},\n        \"timeout\": 30,  # Increased timeout\n    },\n    max_retry_attempts=5,  # More retries\n) as server:\n    # ...\n\nTypeScript:\n\nconst mcpServer = new MCPServerStreamableHttp({\n  url: 'https://api.you.com/mcp',\n  requestInit: {\n    headers: { Authorization: `Bearer ${process.env.YDC_API_KEY}` },\n    // Add custom timeout via fetch options\n  },\n});"
      },
      {
        "title": "Additional Resources",
        "body": "OpenAI Agents SDK (Python): https://openai.github.io/openai-agents-python/\nOpenAI Agents SDK (TypeScript): https://openai.github.io/openai-agents-js/\nMCP Configuration (Python): https://openai.github.io/openai-agents-python/mcp/\nMCP Configuration (TypeScript): https://openai.github.io/openai-agents-js/guides/mcp/\nYou.com MCP Server: https://documentation.you.com/developer-resources/mcp-server\nAPI Keys:\n\nYou.com: https://you.com/platform/api-keys\nOpenAI: https://platform.openai.com/api-keys"
      }
    ],
    "body": "Integrate OpenAI Agents SDK with You.com MCP\n\nInteractive workflow to set up OpenAI Agents SDK with You.com's MCP server.\n\nWorkflow\n\nAsk: Language Choice\n\nPython or TypeScript?\n\nAsk: MCP Configuration Type\n\nHosted MCP (OpenAI-managed with server URL): Recommended for simplicity\nStreamable HTTP (Self-managed connection): For custom infrastructure\n\nInstall Package\n\nPython: pip install openai-agents\nTypeScript: npm install @openai/agents\n\nAsk: Environment Variables\n\nFor Both Modes:\n\nYDC_API_KEY (You.com API key for Bearer token)\nOPENAI_API_KEY (OpenAI API key)\n\nHave they set them?\n\nIf NO: Guide to get keys:\nYDC_API_KEY: https://you.com/platform/api-keys\nOPENAI_API_KEY: https://platform.openai.com/api-keys\n\nAsk: File Location\n\nNEW file: Ask where to create and what to name\nEXISTING file: Ask which file to integrate into (add MCP config)\n\nCreate/Update File\n\nFor NEW files:\n\nUse the complete template code from the \"Complete Templates\" section below\nUser can run immediately with their API keys set\n\nFor EXISTING files:\n\nAdd MCP server configuration to their existing code\n\nHosted MCP configuration block (Python):\n\nfrom agents import Agent, Runner\nfrom agents.mcp import HostedMCPTool\n\n# Validate: ydc_api_key = os.getenv(\"YDC_API_KEY\")\nagent = Agent(\n    name=\"Assistant\",\n    instructions=\"Use You.com tools to answer questions.\",\n    tools=[\n        HostedMCPTool(\n            tool_config={\n                \"type\": \"mcp\",\n                \"server_label\": \"ydc\",\n                \"server_url\": \"https://api.you.com/mcp\",\n                \"headers\": {\n                    \"Authorization\": f\"Bearer {ydc_api_key}\"\n                },\n                \"require_approval\": \"never\",\n            }\n        )\n    ],\n)\n\n\nHosted MCP configuration block (TypeScript):\n\nimport { Agent, hostedMcpTool } from '@openai/agents';\n\n// Validate: const ydcApiKey = process.env.YDC_API_KEY;\nconst agent = new Agent({\n  name: 'Assistant',\n  instructions: 'Use You.com tools to answer questions.',\n  tools: [\n    hostedMcpTool({\n     serverLabel: 'ydc',\n      serverUrl: 'https://api.you.com/mcp',\n      headers: {\n        Authorization: `Bearer ${ydcApiKey}`,\n      },\n    }),\n  ],\n});\n\n\nStreamable HTTP configuration block (Python):\n\nfrom agents import Agent, Runner\nfrom agents.mcp import MCPServerStreamableHttp\n\n# Validate: ydc_api_key = os.getenv(\"YDC_API_KEY\")\nasync with MCPServerStreamableHttp(\n    name=\"You.com MCP Server\",\n    params={\n        \"url\": \"https://api.you.com/mcp\",\n        \"headers\": {\"Authorization\": f\"Bearer {ydc_api_key}\"},\n        \"timeout\": 10,\n    },\n    cache_tools_list=True,\n    max_retry_attempts=3,\n) as server:\n    agent = Agent(\n        name=\"Assistant\",\n        instructions=\"Use You.com tools to answer questions.\",\n        mcp_servers=[server],\n    )\n\n\nStreamable HTTP configuration block (TypeScript):\n\nimport { Agent, MCPServerStreamableHttp } from '@openai/agents';\n\n// Validate: const ydcApiKey = process.env.YDC_API_KEY;\nconst mcpServer = new MCPServerStreamableHttp({\n  url: 'https://api.you.com/mcp',\n  name: 'You.com MCP Server',\n  requestInit: {\n    headers: {\n      Authorization: `Bearer ${ydcApiKey}`,\n    },\n  },\n});\n\nconst agent = new Agent({\n  name: 'Assistant',\n  instructions: 'Use You.com tools to answer questions.',\n  mcpServers: [mcpServer],\n});\n\nComplete Templates\n\nUse these complete templates for new files. Each template is ready to run with your API keys set.\n\nPython Hosted MCP Template (Complete Example)\n\"\"\"\nOpenAI Agents SDK with You.com Hosted MCP\nPython implementation with OpenAI-managed infrastructure\n\"\"\"\n\nimport os\nimport asyncio\nfrom agents import Agent, Runner\nfrom agents.mcp import HostedMCPTool\n\n# Validate environment variables\nydc_api_key = os.getenv(\"YDC_API_KEY\")\nopenai_api_key = os.getenv(\"OPENAI_API_KEY\")\n\nif not ydc_api_key:\n    raise ValueError(\n        \"YDC_API_KEY environment variable is required. \"\n        \"Get your key at: https://you.com/platform/api-keys\"\n    )\n\nif not openai_api_key:\n    raise ValueError(\n        \"OPENAI_API_KEY environment variable is required. \"\n        \"Get your key at: https://platform.openai.com/api-keys\"\n    )\n\n\nasync def main():\n    \"\"\"\n    Example: Search for AI news using You.com hosted MCP tools\n    \"\"\"\n    # Configure agent with hosted MCP tools\n    agent = Agent(\n        name=\"AI News Assistant\",\n        instructions=\"Use You.com tools to search for and answer questions about AI news.\",\n        tools=[\n            HostedMCPTool(\n                tool_config={\n                    \"type\": \"mcp\",\n                    \"server_label\": \"ydc\",\n                    \"server_url\": \"https://api.you.com/mcp\",\n                    \"headers\": {\n                        \"Authorization\": f\"Bearer {ydc_api_key}\"\n                    },\n                    \"require_approval\": \"never\",\n                }\n            )\n        ],\n    )\n\n    # Run agent with user query\n    result = await Runner.run(\n        agent,\n        \"Search for the latest AI news from this week\"\n    )\n\n    print(result.final_output)\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n\nPython Streamable HTTP Template (Complete Example)\n\"\"\"\nOpenAI Agents SDK with You.com Streamable HTTP MCP\nPython implementation with self-managed connection\n\"\"\"\n\nimport os\nimport asyncio\nfrom agents import Agent, Runner\nfrom agents.mcp import MCPServerStreamableHttp\n\n# Validate environment variables\nydc_api_key = os.getenv(\"YDC_API_KEY\")\nopenai_api_key = os.getenv(\"OPENAI_API_KEY\")\n\nif not ydc_api_key:\n    raise ValueError(\n        \"YDC_API_KEY environment variable is required. \"\n        \"Get your key at: https://you.com/platform/api-keys\"\n    )\n\nif not openai_api_key:\n    raise ValueError(\n        \"OPENAI_API_KEY environment variable is required. \"\n        \"Get your key at: https://platform.openai.com/api-keys\"\n    )\n\n\nasync def main():\n    \"\"\"\n    Example: Search for AI news using You.com streamable HTTP MCP server\n    \"\"\"\n    # Configure streamable HTTP MCP server\n    async with MCPServerStreamableHttp(\n        name=\"You.com MCP Server\",\n        params={\n            \"url\": \"https://api.you.com/mcp\",\n            \"headers\": {\"Authorization\": f\"Bearer {ydc_api_key}\"},\n            \"timeout\": 10,\n        },\n        cache_tools_list=True,\n        max_retry_attempts=3,\n    ) as server:\n        # Configure agent with MCP server\n        agent = Agent(\n            name=\"AI News Assistant\",\n            instructions=\"Use You.com tools to search for and answer questions about AI news.\",\n            mcp_servers=[server],\n        )\n\n        # Run agent with user query\n        result = await Runner.run(\n            agent,\n            \"Search for the latest AI news from this week\"\n        )\n\n        print(result.final_output)\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n\nTypeScript Hosted MCP Template (Complete Example)\n/**\n * OpenAI Agents SDK with You.com Hosted MCP\n * TypeScript implementation with OpenAI-managed infrastructure\n */\n\nimport { Agent, run, hostedMcpTool } from '@openai/agents';\n\n// Validate environment variables\nconst ydcApiKey = process.env.YDC_API_KEY;\nconst openaiApiKey = process.env.OPENAI_API_KEY;\n\nif (!ydcApiKey) {\n  throw new Error(\n    'YDC_API_KEY environment variable is required. ' +\n      'Get your key at: https://you.com/platform/api-keys'\n  );\n}\n\nif (!openaiApiKey) {\n  throw new Error(\n    'OPENAI_API_KEY environment variable is required. ' +\n      'Get your key at: https://platform.openai.com/api-keys'\n  );\n}\n\n/**\n * Example: Search for AI news using You.com hosted MCP tools\n */\nasync function main() {\n  // Configure agent with hosted MCP tools\n  const agent = new Agent({\n    name: 'AI News Assistant',\n    instructions:\n      'Use You.com tools to search for and answer questions about AI news.',\n    tools: [\n      hostedMcpTool({\n        serverLabel: 'ydc',\n        serverUrl: 'https://api.you.com/mcp',\n        headers: {\n          Authorization: `Bearer ${ydcApiKey}`,\n        },\n      }),\n    ],\n  });\n\n  // Run agent with user query\n  const result = await run(\n    agent,\n    'Search for the latest AI news from this week'\n  );\n\n  console.log(result.finalOutput);\n}\n\nmain().catch(console.error);\n\nTypeScript Streamable HTTP Template (Complete Example)\n/**\n * OpenAI Agents SDK with You.com Streamable HTTP MCP\n * TypeScript implementation with self-managed connection\n */\n\nimport { Agent, run, MCPServerStreamableHttp } from '@openai/agents';\n\n// Validate environment variables\nconst ydcApiKey = process.env.YDC_API_KEY;\nconst openaiApiKey = process.env.OPENAI_API_KEY;\n\nif (!ydcApiKey) {\n  throw new Error(\n    'YDC_API_KEY environment variable is required. ' +\n      'Get your key at: https://you.com/platform/api-keys'\n  );\n}\n\nif (!openaiApiKey) {\n  throw new Error(\n    'OPENAI_API_KEY environment variable is required. ' +\n      'Get your key at: https://platform.openai.com/api-keys'\n  );\n}\n\n/**\n * Example: Search for AI news using You.com streamable HTTP MCP server\n */\nasync function main() {\n  // Configure streamable HTTP MCP server\n  const mcpServer = new MCPServerStreamableHttp({\n    url: 'https://api.you.com/mcp',\n    name: 'You.com MCP Server',\n    requestInit: {\n      headers: {\n        Authorization: `Bearer ${ydcApiKey}`,\n      },\n    },\n  });\n\n  try {\n    // Connect to MCP server\n    await mcpServer.connect();\n\n    // Configure agent with MCP server\n    const agent = new Agent({\n      name: 'AI News Assistant',\n      instructions:\n        'Use You.com tools to search for and answer questions about AI news.',\n      mcpServers: [mcpServer],\n    });\n\n    // Run agent with user query\n    const result = await run(\n      agent,\n      'Search for the latest AI news from this week'\n    );\n\n    console.log(result.finalOutput);\n  } finally {\n    // Clean up connection\n    await mcpServer.close();\n  }\n}\n\nmain().catch(console.error);\n\nMCP Configuration Types\nHosted MCP (Recommended)\n\nWhat it is: OpenAI manages the MCP connection and tool routing through their Responses API.\n\nBenefits:\n\n✅ Simpler configuration (no connection management)\n✅ OpenAI handles authentication and retries\n✅ Lower latency (tools run in OpenAI infrastructure)\n✅ Automatic tool discovery and listing\n✅ No need to manage async context or cleanup\n\nUse when:\n\nBuilding production applications\nWant minimal boilerplate code\nNeed reliable tool execution\nDon't require custom transport layer\n\nConfiguration:\n\nPython:\n\nfrom agents.mcp import HostedMCPTool\n\ntools=[\n    HostedMCPTool(\n        tool_config={\n            \"type\": \"mcp\",\n            \"server_label\": \"ydc\",\n            \"server_url\": \"https://api.you.com/mcp\",\n            \"headers\": {\n                \"Authorization\": f\"Bearer {os.environ['YDC_API_KEY']}\"\n            },\n            \"require_approval\": \"never\",\n        }\n    )\n]\n\n\nTypeScript:\n\nimport { hostedMcpTool } from '@openai/agents';\n\ntools: [\n  hostedMcpTool({\n    serverLabel: 'ydc',\n    serverUrl: 'https://api.you.com/mcp',\n    headers: {\n      Authorization: `Bearer ${process.env.YDC_API_KEY}`,\n    },\n  }),\n]\n\nStreamable HTTP MCP\n\nWhat it is: You manage the MCP connection and transport layer yourself.\n\nBenefits:\n\n✅ Full control over network connection\n✅ Custom infrastructure integration\n✅ Can add custom headers, timeouts, retry logic\n✅ Run MCP server in your own environment\n✅ Better for testing and development\n\nUse when:\n\nNeed custom transport configuration\nRunning MCP server in your infrastructure\nRequire specific networking setup\nDevelopment and testing scenarios\n\nConfiguration:\n\nPython:\n\nfrom agents.mcp import MCPServerStreamableHttp\n\nasync with MCPServerStreamableHttp(\n    name=\"You.com MCP Server\",\n    params={\n        \"url\": \"https://api.you.com/mcp\",\n        \"headers\": {\"Authorization\": f\"Bearer {os.environ['YDC_API_KEY']}\"},\n        \"timeout\": 10,\n    },\n    cache_tools_list=True,\n    max_retry_attempts=3,\n) as server:\n    agent = Agent(mcp_servers=[server])\n\n\nTypeScript:\n\nimport { MCPServerStreamableHttp } from '@openai/agents';\n\nconst mcpServer = new MCPServerStreamableHttp({\n  url: 'https://api.you.com/mcp',\n  name: 'You.com MCP Server',\n  requestInit: {\n    headers: {\n      Authorization: `Bearer ${process.env.YDC_API_KEY}`,\n    },\n  },\n});\n\nawait mcpServer.connect();\ntry {\n  const agent = new Agent({ mcpServers: [mcpServer] });\n  // Use agent\n} finally {\n  await mcpServer.close();\n}\n\nAvailable You.com Tools\n\nAfter configuration, agents can discover and use:\n\nmcp__ydc__you_search - Web and news search\nmcp__ydc__you_express - AI-powered answers with web context\nmcp__ydc__you_contents - Web page content extraction\nEnvironment Variables\n\nBoth API keys are required for both configuration modes:\n\n# Add to your .env file or shell profile\nexport YDC_API_KEY=\"your-you-api-key-here\"\nexport OPENAI_API_KEY=\"your-openai-api-key-here\"\n\n\nGet your API keys:\n\nYou.com: https://you.com/platform/api-keys\nOpenAI: https://platform.openai.com/api-keys\nValidation Checklist\n\nBefore completing:\n\n Package installed: openai-agents (Python) or @openai/agents (TypeScript)\n Environment variables set: YDC_API_KEY and OPENAI_API_KEY\n Template copied or configuration added to existing file\n MCP configuration type chosen (Hosted or Streamable HTTP)\n Authorization headers configured with Bearer token\n File is executable (Python) or can be compiled (TypeScript)\n Ready to test with example query\nTesting Your Integration\n\nPython:\n\npython your-file.py\n\n\nTypeScript:\n\n# With tsx (recommended for quick testing)\nnpx tsx your-file.ts\n\n# Or compile and run\ntsc your-file.ts && node your-file.js\n\nCommon Issues\n<details> <summary><strong>Cannot find module @openai/agents</strong></summary>\n\nInstall the package:\n\n# NPM\nnpm install @openai/agents\n\n# Bun\nbun add @openai/agents\n\n# Yarn\nyarn add @openai/agents\n\n# pnpm\npnpm add @openai/agents\n\n</details> <details> <summary><strong>YDC_API_KEY environment variable is required</strong></summary>\n\nSet your You.com API key:\n\nexport YDC_API_KEY=\"your-api-key-here\"\n\n\nGet your key at: https://you.com/platform/api-keys\n\n</details> <details> <summary><strong>OPENAI_API_KEY environment variable is required</strong></summary>\n\nSet your OpenAI API key:\n\nexport OPENAI_API_KEY=\"your-api-key-here\"\n\n\nGet your key at: https://platform.openai.com/api-keys\n\n</details> <details> <summary><strong>MCP connection fails with 401 Unauthorized</strong></summary>\n\nVerify your YDC_API_KEY is valid:\n\nCheck the key at https://you.com/platform/api-keys\nEnsure no extra spaces or quotes in the environment variable\nVerify the Authorization header format: Bearer ${YDC_API_KEY}\n</details> <details> <summary><strong>Tools not available or not being called</strong></summary>\n\nFor Both Modes:\n\nEnsure server_url: \"https://api.you.com/mcp\" is correct\nVerify Authorization header includes Bearer prefix\nCheck YDC_API_KEY environment variable is set\nConfirm require_approval is set to \"never\" for automatic execution\n\nFor Streamable HTTP specifically:\n\nEnsure MCP server is connected before creating agent\nVerify connection was successful before running agent\n</details> <details> <summary><strong>Connection timeout or network errors</strong></summary>\n\nFor Streamable HTTP only:\n\nIncrease timeout or retry attempts:\n\nPython:\n\nasync with MCPServerStreamableHttp(\n    params={\n        \"url\": \"https://api.you.com/mcp\",\n        \"headers\": {\"Authorization\": f\"Bearer {os.environ['YDC_API_KEY']}\"},\n        \"timeout\": 30,  # Increased timeout\n    },\n    max_retry_attempts=5,  # More retries\n) as server:\n    # ...\n\n\nTypeScript:\n\nconst mcpServer = new MCPServerStreamableHttp({\n  url: 'https://api.you.com/mcp',\n  requestInit: {\n    headers: { Authorization: `Bearer ${process.env.YDC_API_KEY}` },\n    // Add custom timeout via fetch options\n  },\n});\n\n</details>\nAdditional Resources\nOpenAI Agents SDK (Python): https://openai.github.io/openai-agents-python/\nOpenAI Agents SDK (TypeScript): https://openai.github.io/openai-agents-js/\nMCP Configuration (Python): https://openai.github.io/openai-agents-python/mcp/\nMCP Configuration (TypeScript): https://openai.github.io/openai-agents-js/guides/mcp/\nYou.com MCP Server: https://documentation.you.com/developer-resources/mcp-server\nAPI Keys:\nYou.com: https://you.com/platform/api-keys\nOpenAI: https://platform.openai.com/api-keys"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/EdwardIrby/ydc-openai-agent-sdk-integration",
    "publisherUrl": "https://clawhub.ai/EdwardIrby/ydc-openai-agent-sdk-integration",
    "owner": "EdwardIrby",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/ydc-openai-agent-sdk-integration",
    "downloadUrl": "https://openagent3.xyz/downloads/ydc-openai-agent-sdk-integration",
    "agentUrl": "https://openagent3.xyz/skills/ydc-openai-agent-sdk-integration/agent",
    "manifestUrl": "https://openagent3.xyz/skills/ydc-openai-agent-sdk-integration/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/ydc-openai-agent-sdk-integration/agent.md"
  }
}