Short, framework-specific recipes for Eve, Mastra, Claude Agent SDK, OpenAI Agents SDK, LangGraph JS, LangChain Python, and the Vercel AI SDK.
What these guides cover
These recipes put one Guard helper on one framework surface. They do not replace the framework overviews. Use them when the question is where the deny sits: Eve inbound and connection approval, Mastra processors and beforeToolCall, Claude UserPromptSubmit and PreToolUse, OpenAI Agents before run() and authored invoke, LangGraph JS before invoke and ToolNode, or LangChain Python and Vercel AI SDK authored tools.
Risks
Signature checks treated as content screens
Remote MCP tools with no local execute
Permission callbacks that the runtime can skip
Double-wrapping the same authored tool
Control priorities
Inbound screening on the channel or submitted prompt
Connection approval before Eve calls the host
beforeToolCall or PreToolUse for tools you did not wrap
One helper per surface so the guard is not double-called
Recommended reading order
Read the matching framework security guide in AI Security first. Then start with inbound screening, and the connection or unwrapped-tool recipe if the host call is the risk.
Screen inbound HTTP and channel text, gate tools and MCP before the side effect, and treat observe-only hooks as a diary. Budgets, local PII, and prompt-injection checks sit on those same two boundaries.
Screen user text with a direct guard() before run(). Wrap authored tool() with guardTool. needsApproval and hosted requireApproval are HITL, not policy. Hosted tools, MCP, and handoffs are not deny points.
Screen user text with a direct guard() call before run(). There is no guardInbound. On DENY do not call run(). Direct guard() fails open; gate hasFailedOpen() if the site must fail closed.
Screen inbound text with guard() before graph.invoke or in the first node. guardTool wraps authored tool(). guardToolNode wraps ToolNode in place for unwrapped and MCP tools. interrupt() is HITL, not policy.
MCP and unwrapped tools execute inside ToolNode. Graph hooks and HITL pauses cannot stop tool.invoke. guardToolNode is the gate. Wrap the node in place; a copy leaves the original unguarded.
Use guard_action on a callable, guard_tool on a BaseTool (arcjet[langchain]), or ArcjetMiddleware plus ToolPolicy on create_agent (arcjet[langchain-agents]). ArcjetCaptureHandler cannot deny.
Wrap tool() with guardTool, create a run context with createAgentContext, and pass aiToolsContext on generateText. The wrapped tool must have execute and cannot already declare contextSchema.
needsApproval, hosted requireApproval, and LangGraph interrupt() park a call for a person. They are not a remote allow or deny. Same trap as Eve user-approval, Mastra requireApproval, and Claude canUseTool.