guard()
guard() wraps a tool so Kelhe scores the action before it runs. There is one
adapter per framework; the call shape is the same, except LangGraph and AutoGen
take a shared AgentContext.
from kelhe.adapters.openai_agents import guard # OpenAI Agents
from kelhe.adapters.langgraph import guard, AgentContext # LangGraph
from kelhe.adapters.crewai import guard # CrewAI
from kelhe.adapters.autogen import guard, AgentContext # AutoGen
| Framework | Call | Notes |
|---|---|---|
| OpenAI Agents | guard(kelhe, func) | Returns a FunctionTool. |
| CrewAI | guard(kelhe, tool) | Function or BaseTool; scoped by tool name. |
| LangGraph | guard(kelhe, func, context=ctx) | Create one AgentContext, then ctx.bind(agent). |
| AutoGen | guard(kelhe, tool, context=ctx) | Create one AgentContext, then ctx.bind(agent). |
All adapters accept name= and description= to override what the model sees.
The tool's behavior is never changed — Kelhe only runs a check immediately
before it executes. See the per-framework guides under Getting started.