CrewAI
GatewayCrewTool, a CrewAI BaseTool with no local function. Give crews gateway-enforced tools with typed arguments and optional approval waiting.
GatewayCrewTool is a CrewAI BaseTool whose _run sends the call through AgentShield's authorize and execute. Every tool a crew uses is checked by policy, can be held for approval, and is audited.
Install
python -m pip install ./sdk/python ./integrations/crewai # also installs crewai>=0.100Give a crew gateway tools
from agentshield_crewai import ToolSpec, gateway_crew_tools
from agentshield_sdk import Client
from crewai import Agent
client = Client(gateway="http://127.0.0.1:8081", agent_id=AGENT_ID,
organization_id=ORGANIZATION_ID, seed=SEED)
tools = gateway_crew_tools(client, [
ToolSpec(
name="fetch_page",
description="Fetch a public web page over HTTPS.",
tool_name="http.request",
operation="http.get",
parameters={"type": "object", "properties": {"query": {"type": "object"}}},
approval_timeout=300,
),
])
researcher = Agent(
role="Researcher",
goal="Summarize public repository activity",
backstory="You read public data and report facts.",
tools=tools,
)ToolSpec is the same agentshield_sdk.tools.ToolSpec the LangChain integration uses, with the same fields and the same JSON results for every outcome.
Typed arguments
CrewAI shows the model a Pydantic model of the arguments. args_model(spec) builds it from the spec's JSON Schema:
| JSON Schema type | Python type |
|---|---|
string | str |
integer | int |
number | float |
boolean | bool |
object | dict |
array | list |
| other | Any |
Required properties are required fields; others default to None. Unknown arguments are refused (extra="forbid"). Optional fields the model leaves out arrive as None and are not sent to the gateway, so they do not change the argument hash.
Avoid number parameters
A number property becomes a Python float, and the SDK's canonical encoder rejects floats. Declare decimal inputs as string or integer in the spec.
No local functions
The constructor takes only a client and a spec, and raises TypeError for anything else. _run accepts keyword arguments only. No local function can be attached.
Identity per crew
A crew agent's AgentShield identity is the agent whose seed the client signs with. When crews need different permissions, give each crew its own registered agent and agent policy, and construct a separate client for each.
Requirements
crewai 0.100 or newer.
Implementation references
Was this page helpful?
LangChain
GatewayTool, a LangChain BaseTool with no local function. Every call goes through AgentShield authorize and execute, with optional waiting for approval.
Model Context Protocol (MCP)
Expose gateway-enforced tools to any MCP host over stdio with GatewayMCPServer. Tools are names; every tools/call goes through AgentShield.