A BeforeToolCallEvent hook
Strands fires a hook before every tool call and lets the hook cancel it with a message. The hook asks Veridect; anything other than a greenlight cancels the tool with the verdict and the record id — the agent sees why, and so does the ledger.
Fail-closed by construction: the verdict starts as “unavailable” and only a parsed greenlight clears it; a timeout, a non-200 or a malformed body cancels the tool with the reason. Package the hook as a Strands Plugin and every agent on AgentCore Runtime picks it up with one line.
# strands_veridect.py import os, requests from strands import Agent from strands.hooks import BeforeToolCallEvent VERIDECT = os.environ["VERIDECT_URL"] HEADERS = {"Authorization": f"Bearer {os.environ['VERIDECT_API_KEY']}"} SCOPE = "may look up orders and may issue refunds up to $500 on existing orders" # this agent's configured authority — yours to set, never the model's def veridect_gate(event: BeforeToolCallEvent) -> None: verdict, record = "unavailable", "" # closed until proven open try: r = requests.post(f"{VERIDECT}/api/ai/consensus/pre-action", headers=HEADERS, timeout=60, json={ "action": event.tool_use["name"], "target": f"strands:{event.tool_use['name']}", "parameters": event.tool_use["input"], "callingAgent": event.agent.name, # the agent object Strands hands the hook — not a model output "callingAgentScope": SCOPE, "department": "customer_service", }) d = r.json() if r.status_code == 200 else {} verdict, record = d.get("verdict", "unavailable"), d.get("auditBundleId", "") except Exception: pass # network, timeout, parse: all stay closed if verdict != "greenlight": event.cancel_tool = f"Veridect {verdict} — record {record}" # explicit cancel; the model sees why agent = Agent(name="strands-support-agent", tools=[lookup_order, issue_refund]) agent.add_hook(veridect_gate) # event type inferred from the hint