CrewAI¶
agent_airlock.integrations.crewai is the canonical adapter for
CrewAI. It is the v0.7.2 promotion
of the previously example-only CrewAI integration to adapter-shipped
and closes issue #5
(opened 2026-03-14).
Why an adapter (not just @Airlock())¶
CrewAI v1.14.4 (2026-04-30) added native MCP server support and a
litellm SSTI bump — that's the floor where the tool-call surface
this adapter binds to became stable. With one wrap_crew(crew,
policy=...) call, every Agent's tool registry and every task-level
Task(tools=[...]) override is walked and Airlock-decorated. Users
no longer have to remember the @framework_decorator over
@Airlock() rule themselves.
Install¶
The extra pins crewai>=1.14.4,<2.0. v1.14.4 is the floor because
that's the release that introduced native MCP server support — older
versions wire MCP through a different surface and would silently
mis-wire. The v1.14.5a1 / a2 alpha cycle is supported but not the
floor; operators on the alpha track should pin manually.
Quickstart¶
from agent_airlock.integrations.crewai import CrewAIAdapter
from agent_airlock.policy import STRICT_POLICY
from crewai import Agent, Crew, Task
from crewai.tools import tool
@tool("Search Tool")
def search(query: str) -> str:
return f"Results for: {query}"
researcher = Agent(role="Researcher", goal="Investigate", tools=[search])
crew = Crew(agents=[researcher], tasks=[Task(description="...", agent=researcher)])
# wrap_crew walks every Agent's tools (and any Task(tools=[...]) overrides).
adapter = CrewAIAdapter()
adapter.wrap_crew(crew, policy=STRICT_POLICY)
# Now every tool call routes through the configured policy.
result = crew.kickoff()
What the adapter does¶
-
Walks
crew.agentsand for eachAgent, walksagent.tools(CrewAI'sBaseToolregistry). For an@tool-built tool the user function (func) is replaced with theAirlock(policy=...)-wrapped version, which coversrun,arunand the structured-tool path an agent uses; for aBaseToolsubclass it is_run. The wrapper carries the tool's name, soSecurityPolicy.allowed_tools/denied_toolslists target the tool rather than its method, and the tool's signature, so strict validation and ghost-argument stripping have parameters to check. -
Walks
crew.tasksfor task-levelTask(tools=[...])overrides — these win overAgent.toolsat runtime, so they need wrapping too. -
Guards the tools CrewAI adds at run time: delegation tools (
allow_delegation), MCP tools (agent.mcps), platform tools (agent.apps), code-execution, multimodal, memory and input-file tools, and the skill loader. None exists when the crew is walked. On the crew and agents it is given (only them), the adapter wraps the methods that hand CrewAI the final tool list and walks what they return:Crew._prepare_tools(every crew task, the hierarchical manager's delegation tools included),Crew.copy(the copieskickoff_for_eachandtrainrun) andAgent._add_skill_loader_tool(the last step before a task orAgent.kickoffparses its tools). Where those methods are missing, an agent configured to receive such tools gets aUserWarningnaming them. Until 0.10.28 these tools ran outside Airlock. -
Pins
SUPPORTED_CREWAI_VERSIONS(listed in the module) — running a version outside this set emits aUserWarning(no hard fail). Update the tuple once a new release has been smoke-tested against the adapter. -
wrap_agent(agent, policy=...)is also exposed as a single-agent shortcut for the standalone-researcher pattern where you don't have aCrewyet.
Honest scope¶
- The adapter does not import
crewaiat module load — passing a stub crew (any object with anagentsortoolsattribute) works without the extra installed. This is what the test suite uses. - Real CrewAI objects (whose
__module__starts withcrewai.*) do trigger the import check. If the extra is missing, the adapter raisesCrewAIMissingErrorwith a clear install hint. crewaiis heavy (pullslitellm,chromadb,embedchain); kept strictly opt-in via the[crewai]extra.- CrewAI validates arguments against the tool's
args_schemabefore the call, in lax mode, so a coercible value such as"5"for anintarrives converted (verified on 1.15.22). Airlock's strict check applies to what CrewAI hands the tool. - The example-only path (
examples/crewai_integration.py) remains documented and still works —@Airlock()over a raw@tool-decorated callable is supported.
Closes¶
- #5 — Add CrewAI native integration module (opened 2026-03-14)
Primary sources¶
- CrewAI v1.14.4 release (2026-04-30) — native MCP server support floor
- CrewAI v1.14.5a1 release (2026-05-01) — alpha
- CrewAI v1.14.5a2 release (2026-05-04) — alpha
- Cross-link to legacy decorator-only path:
examples/crewai_integration.py