OAA PROTOCOL
OAA Sentinel · Coinbase AgentKit
Check a token before your agent swaps.
A free AgentKit action provider. Your agent reads OAA Sentinel risk grades from the Sentinel Guard contract on Base. No API key, no wallet, no gas. Every grade is also an EAS attestation on Base.
sentinel_gradeLatest grade A to F, score 0–100, check time and EAS attestation link.
sentinel_is_safepasses: true or false for a minimum score and a maximum age (default 70 and 7 days).
Use it
import { AgentKit } from "@coinbase/agentkit";
import { sentinelActionProvider } from "./sentinel"; // copy the two files below into ./sentinel
const agentkit = await AgentKit.from({
walletProvider,
actionProviders: [sentinelActionProvider(), /* your other providers */],
});
Tip for your agent prompt: “Before swapping into a token on Base, call sentinel_is_safe. If it does not pass, ask the user first.”
sentinelActionProvider.ts
import { z } from "zod";
import { createPublicClient, http, type Address } from "viem";
import { base } from "viem/chains";
import { ActionProvider, CreateAction, type Network } from "@coinbase/agentkit";
import { SentinelGradeSchema, SentinelIsSafeSchema } from "./schemas";
/** OAA Sentinel Guard on Base mainnet: on-chain registry of Sentinel token risk grades (free to read). */
export const SENTINEL_GUARD_ADDRESS: Address = "0xa9B233ca4D8b4fd788A9Effb8c83065020eBC7Cf";
const GUARD_ABI = [
{
type: "function", name: "gradeOf", stateMutability: "view",
inputs: [{ name: "token", type: "address" }],
outputs: [{ name: "grade", type: "bytes1" }, { name: "score", type: "uint8" }, { name: "checkedAt", type: "uint64" }, { name: "uid", type: "bytes32" }],
},
{
type: "function", name: "isSafe", stateMutability: "view",
inputs: [{ name: "token", type: "address" }, { name: "minScore", type: "uint8" }, { name: "maxAge", type: "uint64" }],
outputs: [{ name: "", type: "bool" }],
},
] as const;
export interface SentinelActionProviderConfig {
/** Optional Base RPC URL. Defaults to the public Base RPC. */
rpcUrl?: string;
}
/**
* SentinelActionProvider lets an AgentKit agent read OAA Sentinel token risk grades
* from the Sentinel Guard contract on Base before it swaps, lists or launches a token.
* Read-only: no wallet, no gas, no payment. Information only, not financial advice.
*/
export class SentinelActionProvider extends ActionProvider {
private readonly client;
constructor(config: SentinelActionProviderConfig = {}) {
super("oaa_sentinel", []);
this.client = createPublicClient({ chain: base, transport: http(config.rpcUrl) });
}
@CreateAction({
name: "sentinel_grade",
description: `Reads the latest OAA Sentinel risk grade (A to F, score 0-100) of a token on Base from the on-chain Sentinel Guard.
Use it before buying or swapping into an unknown token. If the token was never graded, tell the user to run a free check at https://sentinel.oaap.si.
The result is information only, not financial advice.`,
schema: SentinelGradeSchema,
})
async sentinelGrade(args: z.infer<typeof SentinelGradeSchema>): Promise<string> {
try {
const [grade, score, checkedAt, uid] = await this.client.readContract({
address: SENTINEL_GUARD_ADDRESS, abi: GUARD_ABI, functionName: "gradeOf", args: [args.tokenAddress as Address],
});
if (checkedAt === 0n) {
return JSON.stringify({ token: args.tokenAddress, graded: false, note: "No on-chain Sentinel grade yet. Run a free check at https://sentinel.oaap.si/?token=" + args.tokenAddress });
}
const letter = String.fromCharCode(parseInt(grade.slice(2, 4), 16));
const hasUid = !/^0x0+$/.test(uid);
return JSON.stringify({
token: args.tokenAddress,
graded: true,
grade: letter,
score,
checkedAt: new Date(Number(checkedAt) * 1000).toISOString(),
attestation: hasUid ? "https://base.easscan.org/attestation/view/" + uid : null,
guard: SENTINEL_GUARD_ADDRESS,
disclaimer: "Automatic checks of public on-chain data. Not an audit, not financial advice.",
});
} catch (e) {
return `Error reading the Sentinel Guard: ${e instanceof Error ? e.message : String(e)}`;
}
}
@CreateAction({
name: "sentinel_is_safe",
description: `Checks on-chain whether a token on Base passes OAA Sentinel: it must have a grade with at least minScore (default 70) that is not older than maxAgeDays (default 7).
Returns passes=true or false. Use it as a guard before a swap. If it does not pass, do not swap without asking the user.
The result is information only, not financial advice.`,
schema: SentinelIsSafeSchema,
})
async sentinelIsSafe(args: z.infer<typeof SentinelIsSafeSchema>): Promise<string> {
try {
const passes = await this.client.readContract({
address: SENTINEL_GUARD_ADDRESS, abi: GUARD_ABI, functionName: "isSafe",
args: [args.tokenAddress as Address, args.minScore, BigInt(args.maxAgeDays) * 86400n],
});
return JSON.stringify({ token: args.tokenAddress, passes, minScore: args.minScore, maxAgeDays: args.maxAgeDays, details: "https://sentinel.oaap.si/?token=" + args.tokenAddress });
} catch (e) {
return `Error reading the Sentinel Guard: ${e instanceof Error ? e.message : String(e)}`;
}
}
/** The Sentinel Guard lives on Base mainnet. */
supportsNetwork = (network: Network) => network.chainId === "8453" || network.networkId === "base-mainnet";
}
export const sentinelActionProvider = (config?: SentinelActionProviderConfig) => new SentinelActionProvider(config);
schemas.ts
import { z } from "zod";
/** Input for sentinel_grade */
export const SentinelGradeSchema = z
.object({
tokenAddress: z
.string()
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid token address")
.describe("The ERC-20 token contract address on Base"),
})
.strip()
.describe("Read the latest OAA Sentinel risk grade of a Base token from the on-chain Sentinel Guard");
/** Input for sentinel_is_safe */
export const SentinelIsSafeSchema = z
.object({
tokenAddress: z
.string()
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid token address")
.describe("The ERC-20 token contract address on Base"),
minScore: z.number().int().min(0).max(100).default(70).describe("Minimum Sentinel score (0-100) to count as safe"),
maxAgeDays: z.number().int().min(0).max(365).default(7).describe("Maximum age of the grade in days (0 = any age)"),
})
.strip()
.describe("Check on-chain whether a Base token passes OAA Sentinel before a swap or listing");
Good to know
- Network: Base mainnet. Guard:
0xa9B233ca4D8b4fd788A9Effb8c83065020eBC7Cf - Token never graded? Run a free check at sentinel.oaap.si and the grade is recorded on-chain.
- Tested with @coinbase/agentkit 0.10. Needs
viemandzodv3.
Automatic checks of public on-chain data. Not an audit and not financial advice. MIT License · OAA Team · oaap.si