All integrations
Claude Tool Use
Intercept Anthropic Claude tool_use blocks and route sensitive actions through Cheqpoint before executing them.
Install
npm install @cheqpoint/sdk @anthropic-ai/sdknpm install @cheqpoint/sdk @anthropic-ai/sdk
Full agentic loop with Cheqpoint approval
TypeScript
import Anthropic from "@anthropic-ai/sdk";
import { CheqpointClient } from "@cheqpoint/sdk";
const client = new Anthropic();
const cheqpoint = new CheqpointClient({ apiKey: process.env.CHEQPOINT_API_KEY! });
const SENSITIVE_TOOLS = ["process_refund", "transfer_funds", "delete_record"];
async function runAgent(userMessage: string) {
const messages: Anthropic.MessageParam[] = [{ role: "user", content: userMessage }];
while (true) {
const response = await client.messages.create({
model: "claude-opus-4-6",
max_tokens: 4096,
tools: yourTools,
messages,
});
if (response.stop_reason === "end_turn") {
return response.content;
}
const toolUseBlocks = response.content.filter(b => b.type === "tool_use");
const toolResults: Anthropic.ToolResultBlockParam[] = [];
for (const block of toolUseBlocks) {
if (block.type !== "tool_use") continue;
let result: unknown;
if (SENSITIVE_TOOLS.includes(block.name)) {
const approval = await cheqpoint.checkpoint({
action: block.name,
summary: `Claude wants to call ${block.name}`,
details: block.input as Record<string, unknown>,
riskLevel: "high",
});
if (approval.status !== "APPROVED") {
result = { error: `Action not approved: ${approval.decisionNote ?? "rejected"}` };
} else {
result = await executeTool(block.name, block.input);
}
} else {
result = await executeTool(block.name, block.input);
}
toolResults.push({ type: "tool_result", tool_use_id: block.id, content: JSON.stringify(result) });
}
messages.push({ role: "assistant", content: response.content });
messages.push({ role: "user", content: toolResults });
}
}import Anthropic from "@anthropic-ai/sdk";
import { CheqpointClient } from "@cheqpoint/sdk";
const client = new Anthropic();
const cheqpoint = new CheqpointClient({ apiKey: process.env.CHEQPOINT_API_KEY! });
const SENSITIVE_TOOLS = ["process_refund", "transfer_funds", "delete_record"];
async function runAgent(userMessage: string) {
const messages: Anthropic.MessageParam[] = [{ role: "user", content: userMessage }];
while (true) {
const response = await client.messages.create({
model: "claude-opus-4-6",
max_tokens: 4096,
tools: yourTools,
messages,
});
if (response.stop_reason === "end_turn") {
return response.content;
}
const toolUseBlocks = response.content.filter(b => b.type === "tool_use");
const toolResults: Anthropic.ToolResultBlockParam[] = [];
for (const block of toolUseBlocks) {
if (block.type !== "tool_use") continue;
let result: unknown;
if (SENSITIVE_TOOLS.includes(block.name)) {
const approval = await cheqpoint.checkpoint({
action: block.name,
summary: `Claude wants to call ${block.name}`,
details: block.input as Record<string, unknown>,
riskLevel: "high",
});
if (approval.status !== "APPROVED") {
result = { error: `Action not approved: ${approval.decisionNote ?? "rejected"}` };
} else {
result = await executeTool(block.name, block.input);
}
} else {
result = await executeTool(block.name, block.input);
}
toolResults.push({ type: "tool_result", tool_use_id: block.id, content: JSON.stringify(result) });
}
messages.push({ role: "assistant", content: response.content });
messages.push({ role: "user", content: toolResults });
}
}