From dc7d79b6acb346971552ee310810bfd4215ce174 Mon Sep 17 00:00:00 2001 From: ThoughtProof Date: Sat, 21 Mar 2026 22:19:46 +0100 Subject: [PATCH 1/2] feat: add ThoughtProof reasoning verification action provider Adds ThoughtProofActionProvider with verify_reasoning action. Runs adversarial multi-model critique before high-stakes agent actions. Returns ALLOW or HOLD with confidence score and key objections. --- .../agentkit/src/action-providers/index.ts | 1 + .../thoughtproof/constants.ts | 1 + .../action-providers/thoughtproof/index.ts | 2 + .../action-providers/thoughtproof/schemas.ts | 17 ++++ .../thoughtproofActionProvider.ts | 78 +++++++++++++++++++ 5 files changed, 99 insertions(+) create mode 100644 typescript/agentkit/src/action-providers/thoughtproof/constants.ts create mode 100644 typescript/agentkit/src/action-providers/thoughtproof/index.ts create mode 100644 typescript/agentkit/src/action-providers/thoughtproof/schemas.ts create mode 100644 typescript/agentkit/src/action-providers/thoughtproof/thoughtproofActionProvider.ts diff --git a/typescript/agentkit/src/action-providers/index.ts b/typescript/agentkit/src/action-providers/index.ts index e95ce5e5b..0002397de 100644 --- a/typescript/agentkit/src/action-providers/index.ts +++ b/typescript/agentkit/src/action-providers/index.ts @@ -25,6 +25,7 @@ export * from "./opensea"; export * from "./spl"; export * from "./superfluid"; export * from "./sushi"; +export * from "./thoughtproof"; export * from "./truemarkets"; export * from "./twitter"; export * from "./wallet"; diff --git a/typescript/agentkit/src/action-providers/thoughtproof/constants.ts b/typescript/agentkit/src/action-providers/thoughtproof/constants.ts new file mode 100644 index 000000000..a3161b78d --- /dev/null +++ b/typescript/agentkit/src/action-providers/thoughtproof/constants.ts @@ -0,0 +1 @@ +export const THOUGHTPROOF_API_BASE_URL = "https://api.thoughtproof.ai"; diff --git a/typescript/agentkit/src/action-providers/thoughtproof/index.ts b/typescript/agentkit/src/action-providers/thoughtproof/index.ts new file mode 100644 index 000000000..4afe7b9fc --- /dev/null +++ b/typescript/agentkit/src/action-providers/thoughtproof/index.ts @@ -0,0 +1,2 @@ +export { ThoughtProofActionProvider, thoughtproofActionProvider } from "./thoughtproofActionProvider"; +export { VerifyReasoningSchema } from "./schemas"; diff --git a/typescript/agentkit/src/action-providers/thoughtproof/schemas.ts b/typescript/agentkit/src/action-providers/thoughtproof/schemas.ts new file mode 100644 index 000000000..23caa6c38 --- /dev/null +++ b/typescript/agentkit/src/action-providers/thoughtproof/schemas.ts @@ -0,0 +1,17 @@ +import { z } from "zod"; + +export const VerifyReasoningSchema = z + .object({ + claim: z + .string() + .describe("The claim, decision, or action to verify (e.g. 'Swap 100 USDC for TOKEN_X at market price')"), + stakeLevel: z + .enum(["low", "medium", "high", "critical"]) + .describe("The stakes of the decision. Use 'high' or 'critical' for transactions above $1000 or irreversible actions."), + domain: z + .enum(["financial", "security", "legal", "medical", "general"]) + .optional() + .describe("The domain of the claim. Defaults to 'financial' for DeFi actions."), + }) + .strip() + .describe("Input schema for verifying a reasoning claim before executing an action"); diff --git a/typescript/agentkit/src/action-providers/thoughtproof/thoughtproofActionProvider.ts b/typescript/agentkit/src/action-providers/thoughtproof/thoughtproofActionProvider.ts new file mode 100644 index 000000000..a92a4d5f2 --- /dev/null +++ b/typescript/agentkit/src/action-providers/thoughtproof/thoughtproofActionProvider.ts @@ -0,0 +1,78 @@ +import { z } from "zod"; +import { ActionProvider } from "../actionProvider"; +import { CreateAction } from "../actionDecorator"; +import { VerifyReasoningSchema } from "./schemas"; +import { THOUGHTPROOF_API_BASE_URL } from "./constants"; + +/** + * ThoughtProofActionProvider is an action provider for reasoning verification. + * Runs adversarial multi-model critique (Claude + Grok + DeepSeek) on any claim + * before the agent executes it. Returns ALLOW or HOLD with a signed attestation. + * + * Uses x402 micropayments on Base (USDC). No API key required. + * Docs: https://thoughtproof.ai/skill.md + */ +export class ThoughtProofActionProvider extends ActionProvider { + constructor() { + super("thoughtproof", []); + } + + /** + * Verifies a claim or decision using adversarial multi-model reasoning. + * Call this before executing high-stakes or irreversible actions. + * + * @param args - The verification parameters (claim, stakeLevel, domain) + * @returns Verification result with verdict (ALLOW/HOLD), confidence, and objections + */ + @CreateAction({ + name: "verify_reasoning", + description: + "Verify a claim or decision using adversarial multi-model reasoning before executing. " + + "Returns ALLOW or HOLD with confidence score and key objections. " + + "Use before irreversible actions, large transactions, or high-stakes decisions.", + schema: VerifyReasoningSchema, + }) + async verifyReasoning(args: z.infer): Promise { + try { + const response = await fetch(`${THOUGHTPROOF_API_BASE_URL}/v1/check`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + claim: args.claim, + stakeLevel: args.stakeLevel ?? "medium", + domain: args.domain ?? "financial", + }), + }); + + if (!response.ok) { + return `ThoughtProof verification failed: HTTP ${response.status}. Proceed with caution.`; + } + + const data = await response.json(); + const verdict = data.verdict ?? "UNCERTAIN"; + const confidence = data.confidence ?? 0; + const objections = data.objections ?? []; + + if (verdict === "ALLOW") { + return ( + `✅ ThoughtProof: ALLOW (confidence: ${confidence}%)\n` + + (objections.length > 0 ? `Minor concerns: ${objections.join("; ")}` : "No objections raised.") + ); + } else { + return ( + `🚫 ThoughtProof: HOLD — do not proceed.\n` + + `Confidence: ${confidence}%\n` + + `Objections:\n${objections.map((o: string) => `- ${o}`).join("\n")}` + ); + } + } catch (error) { + return `🚫 ThoughtProof: HOLD — verification service unavailable (${error}). Do not proceed until reasoning can be verified.`; + } + } + + supportsNetwork = () => true; +} + +export const thoughtproofActionProvider = () => new ThoughtProofActionProvider(); From 439d67a66fbfb464f00239f3ac18f735db376c31 Mon Sep 17 00:00:00 2001 From: ThoughtProof Date: Tue, 24 Mar 2026 20:11:10 +0100 Subject: [PATCH 2/2] fix: update verdicts to v2.0 (ALLOW/BLOCK/UNCERTAIN, remove HOLD) --- .../thoughtproof/thoughtproofActionProvider.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/typescript/agentkit/src/action-providers/thoughtproof/thoughtproofActionProvider.ts b/typescript/agentkit/src/action-providers/thoughtproof/thoughtproofActionProvider.ts index a92a4d5f2..66e076c83 100644 --- a/typescript/agentkit/src/action-providers/thoughtproof/thoughtproofActionProvider.ts +++ b/typescript/agentkit/src/action-providers/thoughtproof/thoughtproofActionProvider.ts @@ -7,7 +7,7 @@ import { THOUGHTPROOF_API_BASE_URL } from "./constants"; /** * ThoughtProofActionProvider is an action provider for reasoning verification. * Runs adversarial multi-model critique (Claude + Grok + DeepSeek) on any claim - * before the agent executes it. Returns ALLOW or HOLD with a signed attestation. + * before the agent executes it. Returns ALLOW, BLOCK, or UNCERTAIN with a signed attestation. * * Uses x402 micropayments on Base (USDC). No API key required. * Docs: https://thoughtproof.ai/skill.md @@ -22,13 +22,13 @@ export class ThoughtProofActionProvider extends ActionProvider { * Call this before executing high-stakes or irreversible actions. * * @param args - The verification parameters (claim, stakeLevel, domain) - * @returns Verification result with verdict (ALLOW/HOLD), confidence, and objections + * @returns Verification result with verdict (ALLOW/BLOCK/UNCERTAIN), confidence, and objections */ @CreateAction({ name: "verify_reasoning", description: "Verify a claim or decision using adversarial multi-model reasoning before executing. " + - "Returns ALLOW or HOLD with confidence score and key objections. " + + "Returns ALLOW, BLOCK, or UNCERTAIN with confidence score and key objections. " + "Use before irreversible actions, large transactions, or high-stakes decisions.", schema: VerifyReasoningSchema, }) @@ -60,15 +60,15 @@ export class ThoughtProofActionProvider extends ActionProvider { `✅ ThoughtProof: ALLOW (confidence: ${confidence}%)\n` + (objections.length > 0 ? `Minor concerns: ${objections.join("; ")}` : "No objections raised.") ); - } else { + } else if (verdict === "BLOCK") { return ( - `🚫 ThoughtProof: HOLD — do not proceed.\n` + + `🚫 ThoughtProof: BLOCK — do not proceed.\n` + `Confidence: ${confidence}%\n` + `Objections:\n${objections.map((o: string) => `- ${o}`).join("\n")}` ); } } catch (error) { - return `🚫 ThoughtProof: HOLD — verification service unavailable (${error}). Do not proceed until reasoning can be verified.`; + return `🚫 ThoughtProof: BLOCK — verification service unavailable (${error}). Do not proceed until reasoning can be verified.`; } }