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). Each tool's_run(orfunc) callable is replaced with theAirlock(policy=...)-wrapped version. Tools are re-tagged soSecurityPolicy.allowed_tools/denied_toolslists target the tool's name, not its method name. -
Walks
crew.tasksfor task-levelTask(tools=[...])overrides — these win overAgent.toolsat runtime, so they need wrapping too. -
Pins
SUPPORTED_CREWAI_VERSIONS = ("1.14.4", "1.14.5a1", "1.14.5a2")— 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.- 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