Vercel AI SDK agents and Dome
Keep your TypeScript agent, and govern every call it makes. The AI SDK is TypeScript, and so is the change. Create its OpenAI provider with the Gateway as baseURL and load tools with its MCP client. generateText, streamText and your stop conditions stay as written. The server holds one Dome key and no provider keys.
Dome governs every tool and model callin Vercel AI SDK.
Your loop stays as it is
generateText, streamText, and stop conditions are unchanged, and only the provider and the tool set change.
Tools from the Gateway
The AI SDK's MCP client loads tools from the Gateway's endpoint. The agent sees only the tools it is granted.
Keys stay on the server
The app holds one Dome key and no provider credentials. Every call lands in the audit trail against the agent.
Vercel AI SDK on Domein two changes.
Point createOpenAI at the Gateway's /v1 endpoint and createMCPClient at its /mcp endpoint, leaving the agent loop untouched.
Install the packages
The AI SDK, its OpenAI provider and its MCP client.
shellnpm install ai @ai-sdk/openai @ai-sdk/mcpLoad tools from the Gateway
createMCPClient over HTTP returns the tools this agent is granted, ready to pass to generateText.
typescriptimport { createMCPClient } from "@ai-sdk/mcp"; const mcp = await createMCPClient({ transport: { type: "http", url: `${GATEWAY_URL}/mcp`, headers: { Authorization: `Bearer ${DOME_AGENT_KEY}` }, },});const tools = await mcp.tools();Call models through the Broker
Use the OpenAI provider on chat completions, set the Gateway as its base URL, and name a pool as the model.
typescriptimport { createOpenAI } from "@ai-sdk/openai"; const broker = createOpenAI({ baseURL: `${GATEWAY_URL}/v1`, apiKey: DOME_AGENT_KEY });const model = broker.chat("claude-opus-5-5");
One agent,end to end.
A server-side generateText loop points the OpenAI provider at the Broker and loads the Gateway's tools with createMCPClient, so keys never reach the browser.
researcher
Answer questions about the code
generateText steps through the GitHub tools until it has an answer. The Gateway decides each tool call, and the Broker routes each model call.
typescript
import { createOpenAI } from "@ai-sdk/openai";import { createMCPClient } from "@ai-sdk/mcp";import { generateText, isStepCount } from "ai";
// Model: a pool on the Broker, through the OpenAI-compatible endpointconst broker = createOpenAI({ baseURL: `${GATEWAY_URL}/v1`, apiKey: DOME_AGENT_KEY });
// Tools: whatever this agent is granted on the Gatewayconst mcp = await createMCPClient({ transport: { type: "http", url: `${GATEWAY_URL}/mcp`, headers: { Authorization: `Bearer ${DOME_AGENT_KEY}` }, },});
try { const { text } = await generateText({ model: broker.chat("claude-opus-5-5"), tools: await mcp.tools(), stopWhen: isStepCount(10), system: "Answer questions about the code. Search before you answer.", prompt: "Where is rate limiting handled?", }); console.log(text);} finally { await mcp.close();}Bringing it alltogether.
Connecting Vercel AI SDK agents to tools, models, and identity in Dome completes a governed agent application.
Acting for
Agent
Vercel AI SDKRuntime
Control point
GatewayEvery call decided and audited
RulesGuardsQuotas
Tools
Models
Common questionsabout Vercel AI SDK.
More of whatDome works with.
Model
Claude Fable
Fable 5.1 from Anthropic and Amazon Bedrock in one failover pool, open to one group and capped by quota.
Provider
Anthropic
The Claude API behind the Model Broker: the key held in Dome, every call authorized, metered and audited.
MCP server
GitHub
The GitHub MCP server behind the Tool Gateway, with rules that decide each call on its owner and repository.
Identity
Okta
Okta tokens verified on every agent call, so rules and audit name the person each agent acted for.
Client
Claude Code
Claude Code on a Dome Gateway with per-developer sign-in, rules on every tool call, and audit by name.
Agent service
TinyFish
TinyFish's web agents behind the Tool Gateway, with rules that decide each run on the site it targets.
Talk with ourFDE team.
Or start free, and register your first agent in minutes. Connect it through a gateway, give it rules, and see every call it makes in one audit trail.
Talk with our FDE team
Our engineers design, build and run governed agents for the part of your business you want to change. You see what they deliver.
Agent frameworks and runtimes: govern agents without a rewrite
Build agents on the framework you already use. Dome governs their tool and model calls without a rewrite.