Cloudflare Agents
Govern a Cloudflare Agent's tools with AxioRank. The Agents SDK uses Vercel AI SDK tools, so the AxioRank Vercel adapter guards them with no rewrite.
Cloudflare's Agents SDK runs its LLM
calls through the Vercel AI SDK (streamText / generateText), and its tools
are ordinary AI SDK tools (tool({ description, inputSchema, execute })). So the
AxioRank Vercel AI SDK adapter guards them directly:
there is no Cloudflare-specific package to install.
Install
npm install @axiorank/sdkGuard your agent's tools
Wrap the tools before you hand them to streamText, inside your AIChatAgent's
onChatMessage. An Agent exposes this.env, so build the client there:
import { AIChatAgent } from "agents/ai-chat-agent";
import { streamText } from "ai";
import { AxioRank } from "@axiorank/sdk";
import { guardTools } from "@axiorank/sdk/vercel";
export class ChatAgent extends AIChatAgent<Env> {
async onChatMessage(onFinish) {
const axio = new AxioRank({ apiKey: this.env.AXIORANK_KEY }); // axr_live_...
return streamText({
model,
messages: this.messages,
tools: guardTools(this.tools, axio, { onDeny: "return" }),
onFinish,
});
}
}Every tool call the agent proposes is now scored for leaked secrets, PII,
destructive operations, prompt injection, and egress, checked against your
policy, and written to the audit log before it runs. On a deny,
onDeny: "return" hands the model a short, readable refusal it can recover from;
onDeny: "throw" fails the tool step instead.
Same adapter, two runtimes
This is the exact @axiorank/sdk/vercel adapter used outside Workers. If your
agent uses generateText instead of streamText, guard the tools the same
way before the call.
Next steps
- Vercel AI SDK adapter: the adapter this reuses.
- Content-inspection engine: what each call is scored against.
- Gateway API: the HTTP contract behind every adapter.