@ory/vercel-ai has 1,035 recorded weekly downloads on npm, an increase of 26.2% over the past 30 days, ranking #2059 of 3,247 tracked listings.
About @ory/vercel-ai
@ory/vercel-ai
Ory Agent Security for the Vercel AI SDK.
Wraps your tools so every call is authorized against Ory Permissions, audited, and tied to
the user → agent identity — built on @ory/argus.
npm install @ory/vercel-ai
import { generateText } from "ai";
import { withOry } from "@ory/vercel-ai";
const result = await generateText({
model,
tools: withOry({ search, sendEmail }), // gate every tool's execute()
prompt: "…",
});
The Vercel AI SDK has no global before-tool hook — enforcement lives at the tool boundary, so
withOry wraps each tool's execute. On the first call it runs the Ory session gates; on
each call it authorizes the tool and records activity. In enforce mode a denied
tool throws OryDenialError, surfacing to the model as a tool error (ai v5+; see below);
in observe mode (default) the tool runs and a permission.observe_deny activity event is recorded.
Tools without an execute (provider-defined) pass through untouched.
Derive the permission subject from per-call context with subjectFromOptions. A non-empty
return value takes precedence over the client's user principal and env overrides for that
call — this is how multi-user servers attribute each request to its own acting user. When it
returns undefined/empty, resolution falls back to the principal / env chain:
withOry(tools, { subjectFromOptions: (o) => o?.experimental_context?.userId });
MCP tools
Tools from an @ai-sdk/mcp client are gated as
MCP tools — Agent Security checks McpServer:<server> and McpTool:<server>:<tool> and
resolves the reported server name to its catalog entry — when the server can be named. Name
it in one of two ways:
import { createMCPClient } from "@ai-sdk/mcp";
// 1. List the server's tools under `mcpServers`, optionally with its url, command, or args,
// which are hashed into fingerprints so the server is recognized whatever it is named.
const github = await createMCPClient({ transport: { type: "http", url: githubUrl } });
const githubTools = await github.tools();
const tools = withOry(
{ search, ...githubTools },
{ mcpServers: { github: { tools: githubTools, url: githubUrl } } },
);
// 2. Or give the client a `clientName`: its tools carry it as `metadata.clientName`.
const linear = await createMCPClient({ clientName: "linear", transport: { type: "http", url: linearUrl } });
withOry({ ...(await linear.tools()) });
mcpServers matches tools by identity, so pass the same tool objects you spread into
withOry. Each call checks the server's own tool name (metadata.toolName). A client left on
the default clientName (ai-sdk-mcp-client) and not listed under mcpServers cannot be
attributed to a server, so its tools are gated as native tools under their tool-map key.
This package depends only on @ory/argus — not the ai package; tools are duck-typed.
Use ai v5 or newer: from v5 a tool that throws becomes a tool-error result the model
receives, so an enforced deny reaches the model with its reason. On ai v4 a thrown deny
aborts the whole generateText/streamText call with ToolExecutionError instead (the tool
is still blocked, but the model never sees why). Credentials come from the shared
~/.config/ory-agent-plugins/config.json.
Description from the npm listing.
- ory
- vercel
- ai-sdk
- authorization
- agent
- ai
- permissions
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (592)Similar npm AI SDKs plugins
All 20 @ory/vercel-ai alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@ory/vercel-ai. First seen Oct 16, 2026; last successful collection Nov 23, 2026. See the methodology.