From a1d831f69d1001705de1cdab5bdf12fd1ff4657f Mon Sep 17 00:00:00 2001 From: Rodrigo Barona Date: Tue, 20 Oct 2026 01:04:44 +0100 Subject: [PATCH] Dato Agent: add Vercel AI Gateway as a provider Let a project use models on its Vercel plan, with a short recommended list and the rest of the tool-capable catalog available on request. Co-authored-by: Cursor --- dato-agent/README.md | 4 +- dato-agent/src/entrypoints/AgentFrame.tsx | 6 +- .../src/entrypoints/ConfigScreen.test.tsx | 65 ++- dato-agent/src/entrypoints/ConfigScreen.tsx | 305 ++++++++--- dato-agent/src/lib/agentRuntime.test.ts | 5 +- dato-agent/src/lib/agentRuntime.ts | 510 +++++++++++++++--- .../src/lib/anthropicAgentRuntime.test.ts | 159 ++++++ dato-agent/src/lib/changeSummary.test.ts | 8 + dato-agent/src/lib/changeSummary.ts | 131 ++++- dato-agent/src/lib/config.test.ts | 51 ++ dato-agent/src/lib/config.ts | 146 ++++- dato-agent/src/lib/conversations.ts | 6 +- dato-agent/src/lib/providerModels.test.ts | 132 +++++ dato-agent/src/lib/providerModels.ts | 308 ++++++++++- dato-agent/src/lib/unsafeDispatchJournal.ts | 6 +- dato-agent/src/lib/vercelGateway.test.ts | 29 + dato-agent/src/lib/vercelGateway.ts | 26 + 17 files changed, 1691 insertions(+), 206 deletions(-) create mode 100644 dato-agent/src/lib/vercelGateway.test.ts create mode 100644 dato-agent/src/lib/vercelGateway.ts diff --git a/dato-agent/README.md b/dato-agent/README.md index 954a4f11..5df55a91 100644 --- a/dato-agent/README.md +++ b/dato-agent/README.md @@ -12,12 +12,14 @@ For now, use it only on a sandbox or test project, never on production or on a p ## Setup -1. A project administrator picks OpenAI or Anthropic in the plugin settings, adds the provider API key and chooses a model. +1. A project administrator picks OpenAI, Anthropic, or Vercel AI Gateway in the plugin settings, adds the provider API key and chooses a model. 2. Each user connects their own DatoCMS account. When asked which projects to authorize, select only the project where the plugin is installed. 3. Open **Agent (Beta)** or the record sidebar and describe what you need. The provider API key is shared by the whole project. Each user's DatoCMS connection and recent chats are stored in their browser. +Vercel AI Gateway uses an API key from **Vercel → AI Gateway → API keys**. Requests are billed to that team's AI Gateway credits, or to bring-your-own provider keys configured on the gateway. The model list starts with a short recommended set (Claude Sonnet 5.5 by default, plus Opus, Haiku, GPT, Gemini, and Grok options). **Show all tool-capable models** reveals the rest of the catalog. Models that are not Claude are translated through the gateway's Anthropic Messages API, so tool calls work the same way, but zero data retention depends on the model: only models marked ZDR on every route keep that guarantee. Fast mode selects the model's `-fast` variant when the catalog publishes one. + ## Permissions The agent can never do more than the user's role allows. On top of that, the access level chosen when connecting DatoCMS applies (**Only read content** blocks every write), and the plugin's **Read Only** setting turns off all agent writes for everyone. diff --git a/dato-agent/src/entrypoints/AgentFrame.tsx b/dato-agent/src/entrypoints/AgentFrame.tsx index d739546b..e2b0657e 100644 --- a/dato-agent/src/entrypoints/AgentFrame.tsx +++ b/dato-agent/src/entrypoints/AgentFrame.tsx @@ -3572,6 +3572,10 @@ export default function AgentFrame(props: AgentFrameProps) { }, model: activeModel(props.config), modelMaxOutputTokens: activeModelMaxOutputTokens(props.config), + modelReasoningEfforts: + props.config.provider === 'vercel' + ? props.config.vercelModelReasoningEfforts + : undefined, reasoningEffort: activeReasoningEffort(props.config), fastMode: activeFastMode(props.config), readOnly: props.config.readOnly, @@ -4178,7 +4182,7 @@ export default function AgentFrame(props: AgentFrameProps) { ); const injectHostContext = Boolean( hostContext && - (turn.provider === 'anthropic' || + (turn.provider !== 'openai' || !previousResponseId || conversationRef.current.hostContextFingerprint !== hostContext.fingerprint), diff --git a/dato-agent/src/entrypoints/ConfigScreen.test.tsx b/dato-agent/src/entrypoints/ConfigScreen.test.tsx index c9b3aefd..be245c5f 100644 --- a/dato-agent/src/entrypoints/ConfigScreen.test.tsx +++ b/dato-agent/src/entrypoints/ConfigScreen.test.tsx @@ -39,6 +39,18 @@ type Option = { value: string; }; +function selectableOptions( + options: ReadonlyArray