Guides · Framework integrations
Framework integrations
Guard the tools of an existing agent — Vercel AI SDK, LangChain, LangGraph, OpenAI Agents, CrewAI, AutoGen, Semantic Kernel, LlamaIndex — without rebuilding it.
Wrap an agent's tools (or install a filter) and every tool call the model makes goes through GebSecure:
model proposes a tool call
→ authorize (policy + risk, POST /v1/authorize) DENY → tool error for the model
→ approval if required (wait / raise / LangGraph interrupt) rejected → tool error for the model
→ run the original tool
→ inspect untrusted output (POST /v1/inspect: injection + DLP) BLOCK → output withheld
→ redact credentials from the output
→ result to the modelEvery integration is a thin layer over one framework-agnostic core built on the official SDKs. The agent holds only its own GebSecure credentials; secrets for the systems the tools call never enter model context.
| Framework | Language | Package / module | Hook point | Tested version |
|---|---|---|---|---|
| Any agent | TypeScript | @gebsecure/integrations-core |
ToolGuard.wrap / guardTool |
— |
| Any agent | Python | gebsecure_integrations |
ToolGuard.run / @guard_tool |
— |
| Vercel AI SDK | TypeScript | @gebsecure/vercel-ai |
tool.execute |
ai 7.0.126 |
| LangChain.js | TypeScript | @gebsecure/langchain |
guarded DynamicStructuredTool |
@langchain/core 1.2.13 |
| LangGraph.js | TypeScript | @gebsecure/langgraph |
guarded ToolNode + interrupts |
@langchain/langgraph 1.4.18 |
| OpenAI Agents SDK (JS) | TypeScript | @gebsecure/openai-agents |
FunctionTool.invoke |
@openai/agents 0.18.0 |
| OpenAI Agents SDK | Python | gebsecure_integrations.openai_agents |
FunctionTool.on_invoke_tool |
openai-agents 0.22.3 |
| LangChain | Python | gebsecure_integrations.langchain |
guarded StructuredTool |
langchain-core 1.6.6 |
| LangGraph | Python | gebsecure_integrations.langgraph |
guarded ToolNode + interrupts |
langgraph 1.2.12 |
| CrewAI | Python | gebsecure_integrations.crewai |
guarded BaseTool |
crewai 1.15.23 |
| AutoGen (AgentChat) | Python | gebsecure_integrations.autogen |
guarded BaseTool |
autogen-agentchat 0.7.5 |
| Semantic Kernel | Python | gebsecure_integrations.semantic_kernel |
function-invocation filter | semantic-kernel 1.44.1 |
| LlamaIndex | Python | gebsecure_integrations.llamaindex |
guarded AsyncBaseTool |
llama-index-core 0.14.25 |
Tutorials: TypeScript frameworks · Python frameworks.
Behaviour (identical in every integration)#
| GebSecure outcome | What the model sees | Tool runs? |
|---|---|---|
ALLOW |
the tool's (inspected, redacted) output | yes |
DENY |
a tool error: GebSecure denied tool "x" (action … on …): <reason>. … do not retry it. |
no |
APPROVAL_REQUIRED, mode wait (default) |
nothing yet — the call blocks while a human decides; then the output, or "approval … was rejected" | after approval |
APPROVAL_REQUIRED, mode raise |
Tool "x" requires human approval (approval apr_…) … retry after approval; the identical retry runs once approved |
after approval and retry |
APPROVAL_REQUIRED, LangGraph |
the graph interrupts (gebsecure.approval_required) and resumes after the decision |
after resume |
inspection BLOCK (or FLAG with blockOnFlag) |
The output of tool "x" was withheld by GebSecure: likely prompt injection … |
yes, output withheld |
inspection FLAG |
the output; the agent is now tainted, so its write, delete and admin actions need approval for a while | yes |
inspection SANITIZE / DLP mask |
the sanitized or masked content | yes |
| GebSecure unreachable | … could not authorize it (connection_error) … — fail closed |
no |
- Authorization request.
actionandresourceare strings or functions of the arguments (resource defaults totool:<name>);contextis the tool arguments with credential-looking keys and values redacted, plus_gebsecure: {tool, framework}. Requests are deterministic, so an approval (bound to the exact snapshot) is consumed by exactly the approved call. - Approval consumption. After approval the guard authorizes again with
approvalId; the server checks the requester, snapshot hash and expiry and consumes it. Denials still win. - Untrusted output (
inspectOutput). Sent to/v1/inspectwith asource(web,email,document,rag,mcp_response,tool_output) andorigin; inspection failures fail closed. - Redaction. GebSecure tokens (
gsk_,gsa_,gsd_), common provider keys (OpenAI, Anthropic, GitHub, Slack, AWS), bearer tokens, JWTs, PEM private keys andpassword=-style pairs are removed from the authorization context, from outputs and from every error message. - Tracing. One W3C
traceparentper tool call, shared by authorize, approval polling and inspection. - Delegation.
guard.delegate({...})issues a one-timegsd_token; the delegate runsguard.withDelegation(token)(Python:with_delegation). Hand the token over out of band, never through model context. - Strict by default.
guardTools(...),guard_tools(...)and the Semantic Kernel filter refuse to leave a tool without a policy unlessstrict: false/unguarded="allow".
Packaging#
- TypeScript: one npm package per framework (framework packages are peer dependencies), each a thin layer over
@gebsecure/integrations-core. - Python: one distribution,
gebsecure-integrations(Python ≥ 3.10), with one module and one extra per framework —pip install "gebsecure-integrations[langgraph]". Framework imports are lazy. CrewAI (openai<3) and the OpenAI Agents SDK (openai>=3) cannot share an environment.
Tests#
Unit suites use the real framework libraries and the official SDK pointed at an in-process fake gateway; no LLM
key is needed. Live suites run against a real api, gateway and worker started by
integrations/scripts/live-stack.ts:
npx vitest run --config integrations/typescript/vitest.config.ts
npx tsx integrations/scripts/live-stack.ts run -- npx vitest run --config integrations/typescript/vitest.config.tsThe examples on the next two pages use the policies the live stack deploys:
| Action | Policy |
|---|---|
demo:weather.read, demo:web.fetch |
permit |
demo:notes.write |
permit (a write: needs approval once the agent is tainted) |
demo:files.delete |
forbid |
demo:payments.transfer |
require approval (role owner) + permit |