Integrations
Anthropic
Authorize Claude tool use through Lelu before execution. Works with the Anthropic SDK, Claude API tool_use blocks, and the Claude Agent SDK.
Installation
terminal
npm install lelu-agent-auth @anthropic-ai/sdk
Tool use with Claude
Claude returns tool_use blocks when it wants to call a tool. Pass the tool name to Lelu before dispatching.
agent.ts
import Anthropic from "@anthropic-ai/sdk";
import { createClient } from "lelu-agent-auth";
const claude = new Anthropic();
const lelu = createClient({ apiKey: process.env.LELU_API_KEY! });
const response = await claude.messages.create({
model: "claude-opus-4-5",
max_tokens: 1024,
tools,
messages,
});
for (const block of response.content) {
if (block.type !== "tool_use") continue;
const decision = await lelu.authorize({
tool: block.name,
context: JSON.stringify(block.input),
});
if (decision.decision === "deny") {
console.error(`Blocked: ${block.name} — ${decision.reason}`);
continue;
}
if (decision.decision === "human_review") {
await requestApproval(decision.requestId);
}
await executeTool(block.name, block.input);
}Claude Agent SDK
Use a pre-tool-call hook to intercept every tool invocation automatically.
agent.ts
import { Agent } from "@anthropic-ai/agent-sdk";
import { createClient } from "lelu-agent-auth";
const lelu = createClient({ apiKey: process.env.LELU_API_KEY! });
const agent = new Agent({
model: "claude-opus-4-5",
tools: [searchTool, writeTool, deleteRecordsTool],
hooks: {
beforeToolCall: async ({ tool, input }) => {
const decision = await lelu.authorize({ tool: tool.name });
if (decision.decision === "deny") {
return { abort: true, reason: decision.reason };
}
},
},
});Environment variables
.env
ANTHROPIC_API_KEY=sk-ant-... LELU_API_KEY=lelu_sk_...