{"record":{"id":"a0e638711bb33ad2","repo":"mastra-ai/mastra","slug":"toaisdkformat-has-been-deprecated-please-use-to","errorCode":null,"errorMessage":"toAISdkFormat() has been deprecated. Please use toAISdkStream() instead.\n\nMigration:\n  import { toAISdkFormat } from \"@mastra/ai-sdk\";\n  // Change to:\n  import { toAISdkStream } from \"@mastra/ai-sdk\";\n\nThe function signature remains the same.","messagePattern":"toAISdkFormat\\(\\) has been deprecated\\. Please use toAISdkStream\\(\\) instead\\.\n\nMigration:\n  import (.+?) from \"@mastra/ai-sdk\";\n  // Change to:\n  import (.+?) from \"@mastra/ai-sdk\";\n\nThe function signature remains the same\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client-sdks/ai-sdk/src/to-ai-sdk-format.ts","lineNumber":16,"sourceCode":"/**\n * @deprecated Use `toAISdkStream` instead. This function has been renamed for clarity.\n *\n * @example\n * ```typescript\n * // Old (deprecated):\n * import { toAISdkFormat } from '@mastra/ai-sdk';\n * const stream = toAISdkFormat(agentStream, { from: 'agent' });\n *\n * // New:\n * import { toAISdkStream } from '@mastra/ai-sdk';\n * const stream = toAISdkStream(agentStream, { from: 'agent' });\n * ```\n */\nexport function toAISdkFormat(): never {\n  throw new Error(\n    'toAISdkFormat() has been deprecated. Please use toAISdkStream() instead.\\n\\n' +\n      'Migration:\\n' +\n      '  import { toAISdkFormat } from \"@mastra/ai-sdk\";\\n' +\n      '  // Change to:\\n' +\n      '  import { toAISdkStream } from \"@mastra/ai-sdk\";\\n\\n' +\n      'The function signature remains the same.',\n  );\n}\n","sourceCodeStart":1,"sourceCodeEnd":25,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/client-sdks/ai-sdk/src/to-ai-sdk-format.ts#L1-L25","documentation":"toAISdkFormat was removed and replaced by toAISdkStream in @mastra/ai-sdk. The old export now always throws this deprecation error with migration instructions; the function signature is unchanged, so only the name needs updating.","triggerScenarios":"Calling toAISdkFormat(agentStream, { from: 'agent' }) anywhere in app code after upgrading to a @mastra/ai-sdk version where the export was deprecated; importing the old name from autocomplete or older docs/snippets.","commonSituations":"Upgrading @mastra/ai-sdk without following the codemod/changelog; copy-pasted tutorial code written against the old API; TypeScript types don't flag it because the export still exists (typed as never).","solutions":["Rename the call from toAISdkFormat to toAISdkStream; arguments stay the same.","Update the import to: import { toAISdkStream } from '@mastra/ai-sdk'.","Search the codebase for toAISdkFormat to catch all call sites.","Follow the migration note in the @mastra/ai-sdk changelog for the release you upgraded to."],"exampleFix":"// before\nimport { toAISdkFormat } from '@mastra/ai-sdk';\nconst uiStream = toAISdkFormat(agentStream, { from: 'agent' });\n// after\nimport { toAISdkStream } from '@mastra/ai-sdk';\nconst uiStream = toAISdkStream(agentStream, { from: 'agent' });","handlingStrategy":"try-catch","validationCode":"import * as aiSdk from '@mastra/ai-sdk';\nif (!('toAISdkStream' in aiSdk)) throw new Error('Upgrade @mastra/ai-sdk');","typeGuard":null,"tryCatchPattern":"let uiStream;\ntry {\n  uiStream = toAISdkStream(agentStream, { from: 'agent' });\n} catch (e) {\n  if (e instanceof Error && e.message.includes('deprecated')) {\n    uiStream = toAISdkStream(agentStream, { from: 'agent' });\n  } else throw e;\n}","preventionTips":["Grep for removed API names after each @mastra/ai-sdk upgrade.","Follow changelogs/codemods for renamed exports.","Avoid importing deprecated exports; prefer the current documented API."],"tags":["deprecation","breaking-change","client-sdk","migration"],"backgroundTag":"deprecated-api-removed","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}