Documentation
AI SDK
Use the thin inline AI SDK helper when you want Milkey tools as native AI SDK tool objects.
Overview
The AI SDK surface is intentionally thin and inline-focused. It returns native AI SDK tool objects and leaves the rest of the application architecture alone.
This is the best path when your app already uses AI SDK primitives and you want Milkey to feel like just another provider-native tool source.
Recommended
Recommended default: inline
Supported modes
inline, auto
Helpers
- milkey.aiSdk.tools(...)
- milkey.aiSdk.resolveMode(...)
- milkey.aiSdk.capabilities
Examples
Full GitHub example
Use the complete provider example in the SDK repo when you want the full runnable file with imports, env handling, and a realistic integration shape. Open the GitHub example.
examples/ai-sdk-inline.ts
import { generateText } from "ai"import { openai } from "@ai-sdk/openai"import { milkey } from "@milkeyskills/sdk" const milkeyClient = milkey.createClient({ baseUrl: process.env.MILKEY_BASE_URL!, apiKey: process.env.MILKEY_API_KEY!,}) const result = await generateText({ model: openai(process.env.OPENAI_MODEL ?? "gpt-5"), prompt: "Find the best Milkey skill for PostgreSQL query optimization.", tools: milkey.aiSdk.tools({ client: milkeyClient, mode: "inline", allowedTools: ["resolve-skill"], }),}) console.log(result.text)Edge cases and production notes
- AI SDK support is intentionally not advertised as a hosted MCP path. Keep it framed as an inline helper surface.
- The helper returns tool objects keyed by provider-safe aliases and executes Milkey calls inside `execute`.
Watch for these edges
- Hosted mode is not currently a supported public path for AI SDK.
- If a caller passes non-object input to `execute`, the helper safely normalizes it to an empty object before calling Milkey.