[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78WXJMM2NK7KD9DKDGF7F5J":3,"skill-same:01M78WXJMM2NK7KD9DKDGF7F5J":55},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":13,"repositoryHtmlUrl":32,"repositoryHomepageUrl":6,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":34,"install":35,"resources":48},"01M78WXJMM2NK7KD9DKDGF7F5J","ydc-ai-sdk-integration",null,"Integrate Vercel AI SDK applications with You.com tools (web search, AI agent, content extraction). Use when developer mentions AI SDK, Vercel AI SDK, generateText, streamText, or You.com integration with AI SDK.","meghal86\u002Fstacksignal","meghal86","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F37388715?v=4","01M6CS2EW8SK89GH52R2ZEN8QQ","01M728J5CGY456EETEFG6HJBTM",0,"MIT","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fydc-ai-sdk-integration\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: ydc-ai-sdk-integration\ndescription: Integrate Vercel AI SDK applications with You.com tools (web search, AI agent, content extraction). Use when developer mentions AI SDK, Vercel AI SDK, generateText, streamText, or You.com integration with AI SDK.\nlicense: MIT\ncompatibility: Requires Node.js 18+ and npm\u002Fbun\u002Fyarn\u002Fpnpm\nmetadata:\n  author: youdotcom-oss\n  category: sdk-integration\n  version: \"1.0.0\"\n  keywords: vercel,vercel-ai-sdk,ai-sdk,you.com,integration,anthropic,openai,web-search,content-extraction,livecrawl,citations\n---\n\n# Integrate AI SDK with You.com Tools\n\nInteractive workflow to add You.com tools to your Vercel AI SDK application using `@youdotcom-oss\u002Fai-sdk-plugin`.\n\n## Workflow\n\n1. **Ask: Package Manager**\n   * Which package manager? (npm, bun, yarn, pnpm)\n   * Install package using their choice:\n     ```bash\n     npm install @youdotcom-oss\u002Fai-sdk-plugin\n     # or bun add @youdotcom-oss\u002Fai-sdk-plugin\n     # or yarn add @youdotcom-oss\u002Fai-sdk-plugin\n     # or pnpm add @youdotcom-oss\u002Fai-sdk-plugin\n     ```\n\n2. **Ask: Environment Variable Name**\n   * Using standard `YDC_API_KEY`?\n   * Or custom name? (if custom, get the name)\n   * Have they set it in their environment?\n   * If NO: Guide them to get key from https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\n\n3. **Ask: Which AI SDK Functions?**\n   * Do they use `generateText()`?\n   * Do they use `streamText()`?\n   * Both?\n\n4. **Ask: Existing Files or New Files?**\n   * EXISTING: Ask which file(s) to edit\n   * NEW: Ask where to create file(s) and what to name them\n\n5. **For Each File, Ask:**\n   * Which tools to add?\n     - `youSearch` (web search)\n     - `youExpress` (AI agent)\n     - `youContents` (content extraction)\n     - Multiple? (which combination?)\n   * Using `generateText()` or `streamText()` in this file?\n   * Which AI provider model? (to determine if stopWhen needed)\n\n6. **Reference Integration Examples**\n\n   See \"Integration Examples\" section below for complete code patterns:\n   * generateText() - Basic text generation with tools\n   * streamText() - Streaming responses with web frameworks (Next.js, Express, React)\n\n7. **Update\u002FCreate Files**\n\n   For each file:\n   * Reference integration examples (generateText or streamText based on their answer)\n   * Add import for selected tools\n   * If EXISTING file: Find their generateText\u002FstreamText call and add tools object\n   * If NEW file: Create file with example structure\n   * Tool invocation pattern based on env var name:\n     - Standard `YDC_API_KEY`: `youSearch()`\n     - Custom name: `youSearch({ apiKey: process.env.CUSTOM_NAME })`\n   * Add selected tools to tools object\n   * If streamText + Anthropic: Add stopWhen parameter\n\n## Integration Examples\n\n### generateText() - Basic Text Generation\n\n**Environment Variables Setup:**\n```typescript\nimport { anthropic } from '@ai-sdk\u002Fanthropic';\nimport { generateText } from 'ai';\nimport { youContents, youExpress, youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\n\u002F\u002F Reads YDC_API_KEY from environment automatically\nconst result = await generateText({\n  model: anthropic('claude-sonnet-4-5-20250929'),\n  tools: {\n    search: youSearch(),\n  },\n  prompt: 'What are the latest developments in quantum computing?',\n});\n\nconsole.log(result.text);\n```\n\n**Multiple Tools:**\n```typescript\nconst result = await generateText({\n  model: anthropic('claude-sonnet-4-5-20250929'),\n  tools: {\n    search: youSearch(),      \u002F\u002F Web search with citations\n    agent: youExpress(),      \u002F\u002F AI answers with web context\n    extract: youContents(),   \u002F\u002F Content extraction from URLs\n  },\n  prompt: 'Research quantum computing and summarize the key papers',\n});\n```\n\n**Custom API Key:**\n```typescript\nconst result = await generateText({\n  model: anthropic('claude-sonnet-4-5-20250929'),\n  tools: {\n    search: youSearch({ apiKey: 'your-custom-key' }),\n  },\n  prompt: 'Your prompt here',\n});\n```\n\n**Complete Example:**\n```typescript\nimport { anthropic } from '@ai-sdk\u002Fanthropic';\nimport { generateText } from 'ai';\nimport { youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\nconst main = async () => {\n  try {\n    const result = await generateText({\n      model: anthropic('claude-sonnet-4-5-20250929'),\n      tools: {\n        search: youSearch(),\n      },\n      maxSteps: 5,\n      prompt: 'What are the latest developments in quantum computing?',\n    });\n\n    console.log('Generated text:', result.text);\n    console.log('\\nTool calls:', result.steps.flatMap(s => s.toolCalls));\n  } catch (error) {\n    console.error('Error:', error);\n    process.exit(1);\n  }\n};\n\nmain();\n```\n\n### streamText() - Streaming Responses\n\n**Basic Streaming with stopWhen Pattern:**\n```typescript\nimport { anthropic } from '@ai-sdk\u002Fanthropic';\nimport { streamText, type StepResult } from 'ai';\nimport { youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\n\u002F\u002F CRITICAL: Always use stopWhen for Anthropic streaming\n\u002F\u002F Anthropic's SDK requires explicit stop conditions\nconst stepCountIs = (n: number) => (stepResult: StepResult\u003Cany>) =>\n  stepResult.stepNumber >= n;\n\nconst result = streamText({\n  model: anthropic('claude-sonnet-4-5-20250929'),\n  tools: { search: youSearch() },\n  stopWhen: stepCountIs(3),  \u002F\u002F Required for Anthropic\n  prompt: 'What are the latest AI developments?',\n});\n\n\u002F\u002F Consume stream\nfor await (const chunk of result.textStream) {\n  process.stdout.write(chunk);\n}\n```\n\n**Next.js Integration (App Router):**\n```typescript\n\u002F\u002F app\u002Fapi\u002Fchat\u002Froute.ts\nimport { anthropic } from '@ai-sdk\u002Fanthropic';\nimport { streamText, type StepResult } from 'ai';\nimport { youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\nconst stepCountIs = (n: number) => (stepResult: StepResult\u003Cany>) =>\n  stepResult.stepNumber >= n;\n\nexport async function POST(req: Request) {\n  const { prompt } = await req.json();\n\n  const result = streamText({\n    model: anthropic('claude-sonnet-4-5-20250929'),\n    tools: { search: youSearch() },\n    stopWhen: stepCountIs(5),\n    prompt,\n  });\n\n  return result.toDataStreamResponse();\n}\n```\n\n**Express.js Integration:**\n```typescript\n\u002F\u002F server.ts\nimport express from 'express';\nimport { anthropic } from '@ai-sdk\u002Fanthropic';\nimport { streamText, type StepResult } from 'ai';\nimport { youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\nconst app = express();\napp.use(express.json());\n\nconst stepCountIs = (n: number) => (stepResult: StepResult\u003Cany>) =>\n  stepResult.stepNumber >= n;\n\napp.post('\u002Fapi\u002Fchat', async (req, res) => {\n  const { prompt } = req.body;\n\n  const result = streamText({\n    model: anthropic('claude-sonnet-4-5-20250929'),\n    tools: { search: youSearch() },\n    stopWhen: stepCountIs(5),\n    prompt,\n  });\n\n  res.setHeader('Content-Type', 'text\u002Fplain; charset=utf-8');\n  res.setHeader('Transfer-Encoding', 'chunked');\n\n  for await (const chunk of result.textStream) {\n    res.write(chunk);\n  }\n\n  res.end();\n});\n\napp.listen(3000);\n```\n\n**React Client (with Next.js):**\n```typescript\n\u002F\u002F components\u002FChat.tsx\n'use client';\n\nimport { useChat } from 'ai\u002Freact';\n\nexport default function Chat() {\n  const { messages, input, handleInputChange, handleSubmit } = useChat({\n    api: '\u002Fapi\u002Fchat',\n  });\n\n  return (\n    \u003Cdiv>\n      {messages.map(m => (\n        \u003Cdiv key={m.id}>\n          \u003Cstrong>{m.role}:\u003C\u002Fstrong> {m.content}\n        \u003C\u002Fdiv>\n      ))}\n\n      \u003Cform onSubmit={handleSubmit}>\n        \u003Cinput value={input} onChange={handleInputChange} \u002F>\n        \u003Cbutton type=\"submit\">Send\u003C\u002Fbutton>\n      \u003C\u002Fform>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n**Complete Streaming Example:**\n```typescript\nimport { anthropic } from '@ai-sdk\u002Fanthropic';\nimport { streamText, type StepResult } from 'ai';\nimport { youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\nconst stepCountIs = (n: number) => (stepResult: StepResult\u003Cany>) =>\n  stepResult.stepNumber >= n;\n\nconst main = async () => {\n  try {\n    const result = streamText({\n      model: anthropic('claude-sonnet-4-5-20250929'),\n      tools: {\n        search: youSearch(),\n      },\n      stopWhen: stepCountIs(3),\n      prompt: 'What are the latest AI developments?',\n    });\n\n    \u002F\u002F Stream to stdout\n    console.log('Streaming response:\\n');\n    for await (const chunk of result.textStream) {\n      process.stdout.write(chunk);\n    }\n    console.log('\\n\\nDone!');\n  } catch (error) {\n    console.error('Error:', error);\n    process.exit(1);\n  }\n};\n\nmain();\n```\n\n## Tool Invocation Patterns\n\nBased on env var name from step 2:\n\n**Standard YDC_API_KEY:**\n```typescript\nimport { youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\ntools: {\n  search: youSearch(),\n}\n```\n\n**Custom env var:**\n```typescript\nimport { youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\nconst apiKey = process.env.THEIR_CUSTOM_NAME;\n\ntools: {\n  search: youSearch({ apiKey }),\n}\n```\n\n**Multiple tools with standard env var:**\n```typescript\nimport { youSearch, youExpress, youContents } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\ntools: {\n  search: youSearch(),\n  agent: youExpress(),\n  extract: youContents(),\n}\n```\n\n**Multiple tools with custom env var:**\n```typescript\nimport { youSearch, youExpress, youContents } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\nconst apiKey = process.env.THEIR_CUSTOM_NAME;\n\ntools: {\n  search: youSearch({ apiKey }),\n  agent: youExpress({ apiKey }),\n  extract: youContents({ apiKey }),\n}\n```\n\n## Available Tools\n\n### youSearch\nWeb and news search - model determines parameters (query, count, country, etc.)\n\n### youExpress\nAI agent with web context - model determines parameters (input, tools)\n\n### youContents\nWeb page content extraction - model determines parameters (urls, format)\n\n## Key Integration Patterns\n\nThe examples above demonstrate:\n* Import statements (AI SDK + provider + You.com tools)\n* Env var validation (optional for new files)\n* Tool configuration based on env var\n* generateText\u002FstreamText usage with tools\n* Result handling (especially textStream destructuring for streamText)\n* Anthropic streaming pattern (stopWhen: stepCountIs(3))\n* Web framework integration (Next.js, Express, React)\n\n## Implementation Checklist\n\nFor each file being updated\u002Fcreated:\n\n- [ ] Import added for selected tools\n- [ ] If custom env var: Variable declared with correct name\n- [ ] tools object added to generateText\u002FstreamText\n- [ ] Each selected tool invoked correctly:\n  - Standard env: `toolName()`\n  - Custom env: `toolName({ apiKey })`\n- [ ] If streamText: Destructured `const { textStream } = ...`\n- [ ] If Anthropic + streamText: Added `stopWhen: stepCountIs(3)`\n\nGlobal checklist:\n\n- [ ] Package installed with their package manager\n- [ ] Env var set in their environment\n- [ ] All files updated\u002Fcreated\n- [ ] Ready to test\n\n## Common Issues\n\n**Issue**: \"Cannot find module @youdotcom-oss\u002Fai-sdk-plugin\"\n**Fix**: Install with their package manager\n\n**Issue**: \"YDC_API_KEY (or custom name) environment variable is required\"\n**Fix**: Set in their environment (get key: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys)\n\n**Issue**: \"Tool execution fails with 401\"\n**Fix**: Verify API key is valid\n\n**Issue**: \"Incomplete or missing response\"\n**Fix**: If using streamText, increase the step count. Start with 3 and iterate up as needed (see README troubleshooting)\n\n**Issue**: \"textStream is not iterable\"\n**Fix**: Destructure: `const { textStream } = streamText(...)`\n\n**Issue**: \"Custom env var not working\"\n**Fix**: Pass to each tool: `youSearch({ apiKey })`\n\n## Advanced: Tool Development Patterns\n\nFor developers creating custom AI SDK tools or contributing to @youdotcom-oss\u002Fai-sdk-plugin:\n\n### Tool Function Structure\n\nEach tool function follows this pattern:\n\n```typescript\nexport const youToolName = (config: YouToolsConfig = {}) => {\n  const apiKey = config.apiKey ?? process.env.YDC_API_KEY;\n\n  return tool({\n    description: 'Tool description for AI model',\n    inputSchema: ZodSchema,\n    execute: async (params) => {\n      if (!apiKey) {\n        throw new Error('YDC_API_KEY is required');\n      }\n\n      const response = await callApiUtility({\n        params,\n        YDC_API_KEY: apiKey,\n        getUserAgent,\n      });\n\n      \u002F\u002F Return raw API response for maximum flexibility\n      return response;\n    },\n  });\n};\n```\n\n### Input Schemas Enable Smart Queries\n\nAlways use schemas from `@youdotcom-oss\u002Fmcp`:\n\n```typescript\n\u002F\u002F ✅ Import from @youdotcom-oss\u002Fmcp\nimport { SearchQuerySchema } from '@youdotcom-oss\u002Fmcp';\n\nexport const youSearch = (config: YouToolsConfig = {}) => {\n  return tool({\n    description: '...',\n    inputSchema: SearchQuerySchema,  \u002F\u002F Enables AI to use all search parameters\n    execute: async (params) => { ... },\n  });\n};\n\n\u002F\u002F ❌ Don't duplicate or simplify schemas\nconst MySearchSchema = z.object({ query: z.string() });  \u002F\u002F Missing filters!\n```\n\n**Why this matters:**\n- Rich schemas enable AI to use advanced query parameters (filters, freshness, country, etc.)\n- AI can construct more intelligent queries based on user intent\n- Prevents duplicating schema definitions across packages\n- Ensures consistency with MCP server schemas\n\n### API Key Handling\n\nAlways provide environment variable fallback and validate before API calls:\n\n```typescript\n\u002F\u002F ✅ Automatic environment variable fallback\nconst apiKey = config.apiKey ?? process.env.YDC_API_KEY;\n\n\u002F\u002F ✅ Check API key in execute function\nexecute: async (params) => {\n  if (!apiKey) {\n    throw new Error('YDC_API_KEY is required');\n  }\n  const response = await callApi(...);\n}\n```\n\n### Response Format\n\nAlways return raw API response for maximum flexibility:\n\n```typescript\n\u002F\u002F ✅ Return raw API response\nexecute: async (params) => {\n  const response = await fetchSearchResults({\n    searchQuery: params,\n    YDC_API_KEY: apiKey,\n    getUserAgent,\n  });\n\n  return response;  \u002F\u002F Raw response for maximum flexibility\n}\n\n\u002F\u002F ❌ Don't format or transform responses\nreturn {\n  text: formatResponse(response),\n  data: response,\n};\n```\n\n**Why raw responses?**\n- Maximum flexibility for AI SDK to process results\n- No information loss from formatting\n- AI SDK handles presentation layer\n- Easier to debug (see actual API response)\n\n### Tool Descriptions\n\nWrite descriptions that guide AI behavior:\n\n```typescript\n\u002F\u002F ✅ Clear guidance for AI model\ndescription: 'Search the web for current information, news, articles, and content using You.com. Returns web results with snippets and news articles. Use this when you need up-to-date information or facts from the internet.'\n\n\u002F\u002F ❌ Too brief\ndescription: 'Search the web'\n```\n\n## Additional Resources\n\n* Package README: https:\u002F\u002Fgithub.com\u002Fyoudotcom-oss\u002Fdx-toolkit\u002Ftree\u002Fmain\u002Fpackages\u002Fai-sdk-plugin\n* Vercel AI SDK Docs: https:\u002F\u002Fai-sdk.dev\u002Fdocs\n* You.com API: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\n","# Integrate AI SDK with You.com Tools\n\nInteractive workflow to add You.com tools to your Vercel AI SDK application using `@youdotcom-oss\u002Fai-sdk-plugin`.\n\n## Workflow\n\n1. **Ask: Package Manager**\n   * Which package manager? (npm, bun, yarn, pnpm)\n   * Install package using their choice:\n     ```bash\n     npm install @youdotcom-oss\u002Fai-sdk-plugin\n     # or bun add @youdotcom-oss\u002Fai-sdk-plugin\n     # or yarn add @youdotcom-oss\u002Fai-sdk-plugin\n     # or pnpm add @youdotcom-oss\u002Fai-sdk-plugin\n     ```\n\n2. **Ask: Environment Variable Name**\n   * Using standard `YDC_API_KEY`?\n   * Or custom name? (if custom, get the name)\n   * Have they set it in their environment?\n   * If NO: Guide them to get key from https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\n\n3. **Ask: Which AI SDK Functions?**\n   * Do they use `generateText()`?\n   * Do they use `streamText()`?\n   * Both?\n\n4. **Ask: Existing Files or New Files?**\n   * EXISTING: Ask which file(s) to edit\n   * NEW: Ask where to create file(s) and what to name them\n\n5. **For Each File, Ask:**\n   * Which tools to add?\n     - `youSearch` (web search)\n     - `youExpress` (AI agent)\n     - `youContents` (content extraction)\n     - Multiple? (which combination?)\n   * Using `generateText()` or `streamText()` in this file?\n   * Which AI provider model? (to determine if stopWhen needed)\n\n6. **Reference Integration Examples**\n\n   See \"Integration Examples\" section below for complete code patterns:\n   * generateText() - Basic text generation with tools\n   * streamText() - Streaming responses with web frameworks (Next.js, Express, React)\n\n7. **Update\u002FCreate Files**\n\n   For each file:\n   * Reference integration examples (generateText or streamText based on their answer)\n   * Add import for selected tools\n   * If EXISTING file: Find their generateText\u002FstreamText call and add tools object\n   * If NEW file: Create file with example structure\n   * Tool invocation pattern based on env var name:\n     - Standard `YDC_API_KEY`: `youSearch()`\n     - Custom name: `youSearch({ apiKey: process.env.CUSTOM_NAME })`\n   * Add selected tools to tools object\n   * If streamText + Anthropic: Add stopWhen parameter\n\n## Integration Examples\n\n### generateText() - Basic Text Generation\n\n**Environment Variables Setup:**\n```typescript\nimport { anthropic } from '@ai-sdk\u002Fanthropic';\nimport { generateText } from 'ai';\nimport { youContents, youExpress, youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\n\u002F\u002F Reads YDC_API_KEY from environment automatically\nconst result = await generateText({\n  model: anthropic('claude-sonnet-4-5-20250929'),\n  tools: {\n    search: youSearch(),\n  },\n  prompt: 'What are the latest developments in quantum computing?',\n});\n\nconsole.log(result.text);\n```\n\n**Multiple Tools:**\n```typescript\nconst result = await generateText({\n  model: anthropic('claude-sonnet-4-5-20250929'),\n  tools: {\n    search: youSearch(),      \u002F\u002F Web search with citations\n    agent: youExpress(),      \u002F\u002F AI answers with web context\n    extract: youContents(),   \u002F\u002F Content extraction from URLs\n  },\n  prompt: 'Research quantum computing and summarize the key papers',\n});\n```\n\n**Custom API Key:**\n```typescript\nconst result = await generateText({\n  model: anthropic('claude-sonnet-4-5-20250929'),\n  tools: {\n    search: youSearch({ apiKey: 'your-custom-key' }),\n  },\n  prompt: 'Your prompt here',\n});\n```\n\n**Complete Example:**\n```typescript\nimport { anthropic } from '@ai-sdk\u002Fanthropic';\nimport { generateText } from 'ai';\nimport { youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\nconst main = async () => {\n  try {\n    const result = await generateText({\n      model: anthropic('claude-sonnet-4-5-20250929'),\n      tools: {\n        search: youSearch(),\n      },\n      maxSteps: 5,\n      prompt: 'What are the latest developments in quantum computing?',\n    });\n\n    console.log('Generated text:', result.text);\n    console.log('\\nTool calls:', result.steps.flatMap(s => s.toolCalls));\n  } catch (error) {\n    console.error('Error:', error);\n    process.exit(1);\n  }\n};\n\nmain();\n```\n\n### streamText() - Streaming Responses\n\n**Basic Streaming with stopWhen Pattern:**\n```typescript\nimport { anthropic } from '@ai-sdk\u002Fanthropic';\nimport { streamText, type StepResult } from 'ai';\nimport { youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\n\u002F\u002F CRITICAL: Always use stopWhen for Anthropic streaming\n\u002F\u002F Anthropic's SDK requires explicit stop conditions\nconst stepCountIs = (n: number) => (stepResult: StepResult\u003Cany>) =>\n  stepResult.stepNumber >= n;\n\nconst result = streamText({\n  model: anthropic('claude-sonnet-4-5-20250929'),\n  tools: { search: youSearch() },\n  stopWhen: stepCountIs(3),  \u002F\u002F Required for Anthropic\n  prompt: 'What are the latest AI developments?',\n});\n\n\u002F\u002F Consume stream\nfor await (const chunk of result.textStream) {\n  process.stdout.write(chunk);\n}\n```\n\n**Next.js Integration (App Router):**\n```typescript\n\u002F\u002F app\u002Fapi\u002Fchat\u002Froute.ts\nimport { anthropic } from '@ai-sdk\u002Fanthropic';\nimport { streamText, type StepResult } from 'ai';\nimport { youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\nconst stepCountIs = (n: number) => (stepResult: StepResult\u003Cany>) =>\n  stepResult.stepNumber >= n;\n\nexport async function POST(req: Request) {\n  const { prompt } = await req.json();\n\n  const result = streamText({\n    model: anthropic('claude-sonnet-4-5-20250929'),\n    tools: { search: youSearch() },\n    stopWhen: stepCountIs(5),\n    prompt,\n  });\n\n  return result.toDataStreamResponse();\n}\n```\n\n**Express.js Integration:**\n```typescript\n\u002F\u002F server.ts\nimport express from 'express';\nimport { anthropic } from '@ai-sdk\u002Fanthropic';\nimport { streamText, type StepResult } from 'ai';\nimport { youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\nconst app = express();\napp.use(express.json());\n\nconst stepCountIs = (n: number) => (stepResult: StepResult\u003Cany>) =>\n  stepResult.stepNumber >= n;\n\napp.post('\u002Fapi\u002Fchat', async (req, res) => {\n  const { prompt } = req.body;\n\n  const result = streamText({\n    model: anthropic('claude-sonnet-4-5-20250929'),\n    tools: { search: youSearch() },\n    stopWhen: stepCountIs(5),\n    prompt,\n  });\n\n  res.setHeader('Content-Type', 'text\u002Fplain; charset=utf-8');\n  res.setHeader('Transfer-Encoding', 'chunked');\n\n  for await (const chunk of result.textStream) {\n    res.write(chunk);\n  }\n\n  res.end();\n});\n\napp.listen(3000);\n```\n\n**React Client (with Next.js):**\n```typescript\n\u002F\u002F components\u002FChat.tsx\n'use client';\n\nimport { useChat } from 'ai\u002Freact';\n\nexport default function Chat() {\n  const { messages, input, handleInputChange, handleSubmit } = useChat({\n    api: '\u002Fapi\u002Fchat',\n  });\n\n  return (\n    \u003Cdiv>\n      {messages.map(m => (\n        \u003Cdiv key={m.id}>\n          \u003Cstrong>{m.role}:\u003C\u002Fstrong> {m.content}\n        \u003C\u002Fdiv>\n      ))}\n\n      \u003Cform onSubmit={handleSubmit}>\n        \u003Cinput value={input} onChange={handleInputChange} \u002F>\n        \u003Cbutton type=\"submit\">Send\u003C\u002Fbutton>\n      \u003C\u002Fform>\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n**Complete Streaming Example:**\n```typescript\nimport { anthropic } from '@ai-sdk\u002Fanthropic';\nimport { streamText, type StepResult } from 'ai';\nimport { youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\nconst stepCountIs = (n: number) => (stepResult: StepResult\u003Cany>) =>\n  stepResult.stepNumber >= n;\n\nconst main = async () => {\n  try {\n    const result = streamText({\n      model: anthropic('claude-sonnet-4-5-20250929'),\n      tools: {\n        search: youSearch(),\n      },\n      stopWhen: stepCountIs(3),\n      prompt: 'What are the latest AI developments?',\n    });\n\n    \u002F\u002F Stream to stdout\n    console.log('Streaming response:\\n');\n    for await (const chunk of result.textStream) {\n      process.stdout.write(chunk);\n    }\n    console.log('\\n\\nDone!');\n  } catch (error) {\n    console.error('Error:', error);\n    process.exit(1);\n  }\n};\n\nmain();\n```\n\n## Tool Invocation Patterns\n\nBased on env var name from step 2:\n\n**Standard YDC_API_KEY:**\n```typescript\nimport { youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\ntools: {\n  search: youSearch(),\n}\n```\n\n**Custom env var:**\n```typescript\nimport { youSearch } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\nconst apiKey = process.env.THEIR_CUSTOM_NAME;\n\ntools: {\n  search: youSearch({ apiKey }),\n}\n```\n\n**Multiple tools with standard env var:**\n```typescript\nimport { youSearch, youExpress, youContents } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\ntools: {\n  search: youSearch(),\n  agent: youExpress(),\n  extract: youContents(),\n}\n```\n\n**Multiple tools with custom env var:**\n```typescript\nimport { youSearch, youExpress, youContents } from '@youdotcom-oss\u002Fai-sdk-plugin';\n\nconst apiKey = process.env.THEIR_CUSTOM_NAME;\n\ntools: {\n  search: youSearch({ apiKey }),\n  agent: youExpress({ apiKey }),\n  extract: youContents({ apiKey }),\n}\n```\n\n## Available Tools\n\n### youSearch\nWeb and news search - model determines parameters (query, count, country, etc.)\n\n### youExpress\nAI agent with web context - model determines parameters (input, tools)\n\n### youContents\nWeb page content extraction - model determines parameters (urls, format)\n\n## Key Integration Patterns\n\nThe examples above demonstrate:\n* Import statements (AI SDK + provider + You.com tools)\n* Env var validation (optional for new files)\n* Tool configuration based on env var\n* generateText\u002FstreamText usage with tools\n* Result handling (especially textStream destructuring for streamText)\n* Anthropic streaming pattern (stopWhen: stepCountIs(3))\n* Web framework integration (Next.js, Express, React)\n\n## Implementation Checklist\n\nFor each file being updated\u002Fcreated:\n\n- [ ] Import added for selected tools\n- [ ] If custom env var: Variable declared with correct name\n- [ ] tools object added to generateText\u002FstreamText\n- [ ] Each selected tool invoked correctly:\n  - Standard env: `toolName()`\n  - Custom env: `toolName({ apiKey })`\n- [ ] If streamText: Destructured `const { textStream } = ...`\n- [ ] If Anthropic + streamText: Added `stopWhen: stepCountIs(3)`\n\nGlobal checklist:\n\n- [ ] Package installed with their package manager\n- [ ] Env var set in their environment\n- [ ] All files updated\u002Fcreated\n- [ ] Ready to test\n\n## Common Issues\n\n**Issue**: \"Cannot find module @youdotcom-oss\u002Fai-sdk-plugin\"\n**Fix**: Install with their package manager\n\n**Issue**: \"YDC_API_KEY (or custom name) environment variable is required\"\n**Fix**: Set in their environment (get key: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys)\n\n**Issue**: \"Tool execution fails with 401\"\n**Fix**: Verify API key is valid\n\n**Issue**: \"Incomplete or missing response\"\n**Fix**: If using streamText, increase the step count. Start with 3 and iterate up as needed (see README troubleshooting)\n\n**Issue**: \"textStream is not iterable\"\n**Fix**: Destructure: `const { textStream } = streamText(...)`\n\n**Issue**: \"Custom env var not working\"\n**Fix**: Pass to each tool: `youSearch({ apiKey })`\n\n## Advanced: Tool Development Patterns\n\nFor developers creating custom AI SDK tools or contributing to @youdotcom-oss\u002Fai-sdk-plugin:\n\n### Tool Function Structure\n\nEach tool function follows this pattern:\n\n```typescript\nexport const youToolName = (config: YouToolsConfig = {}) => {\n  const apiKey = config.apiKey ?? process.env.YDC_API_KEY;\n\n  return tool({\n    description: 'Tool description for AI model',\n    inputSchema: ZodSchema,\n    execute: async (params) => {\n      if (!apiKey) {\n        throw new Error('YDC_API_KEY is required');\n      }\n\n      const response = await callApiUtility({\n        params,\n        YDC_API_KEY: apiKey,\n        getUserAgent,\n      });\n\n      \u002F\u002F Return raw API response for maximum flexibility\n      return response;\n    },\n  });\n};\n```\n\n### Input Schemas Enable Smart Queries\n\nAlways use schemas from `@youdotcom-oss\u002Fmcp`:\n\n```typescript\n\u002F\u002F ✅ Import from @youdotcom-oss\u002Fmcp\nimport { SearchQuerySchema } from '@youdotcom-oss\u002Fmcp';\n\nexport const youSearch = (config: YouToolsConfig = {}) => {\n  return tool({\n    description: '...',\n    inputSchema: SearchQuerySchema,  \u002F\u002F Enables AI to use all search parameters\n    execute: async (params) => { ... },\n  });\n};\n\n\u002F\u002F ❌ Don't duplicate or simplify schemas\nconst MySearchSchema = z.object({ query: z.string() });  \u002F\u002F Missing filters!\n```\n\n**Why this matters:**\n- Rich schemas enable AI to use advanced query parameters (filters, freshness, country, etc.)\n- AI can construct more intelligent queries based on user intent\n- Prevents duplicating schema definitions across packages\n- Ensures consistency with MCP server schemas\n\n### API Key Handling\n\nAlways provide environment variable fallback and validate before API calls:\n\n```typescript\n\u002F\u002F ✅ Automatic environment variable fallback\nconst apiKey = config.apiKey ?? process.env.YDC_API_KEY;\n\n\u002F\u002F ✅ Check API key in execute function\nexecute: async (params) => {\n  if (!apiKey) {\n    throw new Error('YDC_API_KEY is required');\n  }\n  const response = await callApi(...);\n}\n```\n\n### Response Format\n\nAlways return raw API response for maximum flexibility:\n\n```typescript\n\u002F\u002F ✅ Return raw API response\nexecute: async (params) => {\n  const response = await fetchSearchResults({\n    searchQuery: params,\n    YDC_API_KEY: apiKey,\n    getUserAgent,\n  });\n\n  return response;  \u002F\u002F Raw response for maximum flexibility\n}\n\n\u002F\u002F ❌ Don't format or transform responses\nreturn {\n  text: formatResponse(response),\n  data: response,\n};\n```\n\n**Why raw responses?**\n- Maximum flexibility for AI SDK to process results\n- No information loss from formatting\n- AI SDK handles presentation layer\n- Easier to debug (see actual API response)\n\n### Tool Descriptions\n\nWrite descriptions that guide AI behavior:\n\n```typescript\n\u002F\u002F ✅ Clear guidance for AI model\ndescription: 'Search the web for current information, news, articles, and content using You.com. Returns web results with snippets and news articles. Use this when you need up-to-date information or facts from the internet.'\n\n\u002F\u002F ❌ Too brief\ndescription: 'Search the web'\n```\n\n## Additional Resources\n\n* Package README: https:\u002F\u002Fgithub.com\u002Fyoudotcom-oss\u002Fdx-toolkit\u002Ftree\u002Fmain\u002Fpackages\u002Fai-sdk-plugin\n* Vercel AI SDK Docs: https:\u002F\u002Fai-sdk.dev\u002Fdocs\n* You.com API: https:\u002F\u002Fyou.com\u002Fplatform\u002Fapi-keys\n",{"name":5,"license":14,"metadata":23,"description":7,"compatibility":28},{"author":24,"version":25,"category":26,"keywords":27},"youdotcom-oss","1.0.0","sdk-integration","vercel,vercel-ai-sdk,ai-sdk,you.com,integration,anthropic,openai,web-search,content-extraction,livecrawl,citations","Requires Node.js 18+ and npm\u002Fbun\u002Fyarn\u002Fpnpm","main","54afe4b75ed2eb8f0feabb2f5b57dfa4bcbb3c44",".agents\u002Fskills\u002Fydc-ai-sdk-integration","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal","https:\u002F\u002Fgithub.com\u002Fmeghal86","2026-05-17 14:11:28",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add meghal86\u002Fstacksignal --skill ydc-ai-sdk-integration",{"tool":41,"command":42},"bunx","bunx skills add meghal86\u002Fstacksignal --skill ydc-ai-sdk-integration",{"tool":44,"command":45},"pnpm","pnpm dlx skills add meghal86\u002Fstacksignal --skill ydc-ai-sdk-integration","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fydc-ai-sdk-integration\u002FSKILL.md",true,[49],{"path":50,"resourceType":51,"resourceTypeDesc":52,"sizeBytes":53,"sourceHtmlUrl":54},"_meta.json","REFERENCE","参考文档",324,"https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fydc-ai-sdk-integration\u002F_meta.json",[56,64,72,80,88,95],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":60,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":18},"01M78XH0FRP65NYEDHF2BT7NB1","zvukogram","Text-to-Speech via Zvukogram API with SSML support. Use when you need to generate speech from text, create podcasts, voice notifications, or work with audio. Supports speed control, stress marks, English word transcription, and audio fragment merging.","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzvukogram\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzvukogram\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":68,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":18},"01M78XEND5ASXYB6MN8AQQGJAF","zohomail","Zoho Mail API integration with managed OAuth. Send, receive, and manage emails, folders, and labels.\nUse this skill when users want to send emails, read messages, manage folders, or work with email labels in Zoho Mail.\nFor other third party apps, use the api-gateway skill (https:\u002F\u002Fclawhub.ai\u002Fbyungkyu\u002Fapi-gateway).\nRequires network access and valid Maton API key.","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzohomail\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzohomail\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":76,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":18},"01M78XEBBV3C6DRZFAJXP6RDKS","zoho-recruit","Zoho Recruit API integration with managed OAuth. Manage candidates, job openings, interviews, and recruitment workflows.\nUse this skill when users want to read, create, update, or search recruitment data like candidates, job openings, interviews, and applications in Zoho Recruit.\nFor other third party apps, use the api-gateway skill (https:\u002F\u002Fclawhub.ai\u002Fbyungkyu\u002Fapi-gateway).\nRequires network access and valid Maton API key.","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-recruit\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-recruit\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":84,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":18},"01M78XE5CQG75DZWYSKGXFR99T","zoho-people","Zoho People API integration with managed OAuth. Manage employees, departments, designations, attendance, and leave.\nUse this skill when users want to read, create, update, or query HR data like employees, departments, designations, and forms in Zoho People.\nFor other third party apps, use the api-gateway skill (https:\u002F\u002Fclawhub.ai\u002Fbyungkyu\u002Fapi-gateway).\nRequires network access and valid Maton API key.","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-people\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-people\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":91,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":18},"01M78XDZKMZAJYFJJFT7MR5ZN2","zoho-mail","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-mail\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-mail\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":99,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":18},"01M78XDST8JK0WVDA1F3VPNWXD","zoho-inventory","Zoho Inventory API integration with managed OAuth. Manage items, sales orders, invoices, purchase orders, bills, contacts, and shipments.\nUse this skill when users want to read, create, update, or delete inventory items, sales orders, invoices, purchase orders, bills, or other inventory records in Zoho Inventory.\nFor other third party apps, use the api-gateway skill (https:\u002F\u002Fclawhub.ai\u002Fbyungkyu\u002Fapi-gateway).\nRequires network access and valid Maton API key.","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-inventory\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmeghal86\u002Fstacksignal\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzoho-inventory\u002FSKILL.md",[],[]]