Skip to content

flue-guardChecks for Flue agent tools

Decide who may call a tool before it runs, never run a side effect twice, and keep a log you can verify.

In thirty seconds ​

Flue's own guidance says "a tool's parameters are model-selected inputs, not an authorization boundary." The model writes the arguments. Your application knows who the caller is. flue-guard compares the two on every call, and writes the result to a log.

ts
import * as v from "valibot";
import { govern } from "flue-guard";

declare const accounts: {
  ownedBy(accountId: string, actorId: string): Promise<boolean>;
  sendResetLink(accountId: string): Promise<void>;
};

const gov = govern({ audit: "audit.jsonl" });

export const resetPassword = gov.tool({
  name: "reset_password",
  description: "Send a password reset link.",
  parameters: v.object({ accountId: v.string() }),
  sideEffect: true,
  // Only the owner of the account may reset it.
  authorize: (a, ctx) => accounts.ownedBy(a.accountId, ctx.actor.id),
  // A retry of the same reset returns the first result instead of sending again.
  idempotency: { key: (a) => `reset:${a.accountId}` },
  execute: async (a) => {
    await accounts.sendResetLink(a.accountId);
    return "Sent.";
  },
});

Start with the tutorial. In five minutes you get a refused call and a log you verify yourself.