Skip to content
Agentic Control Plane

CrewAI A2A Delegation in Production: Setup, Permissions and Audit

David Crowe David Crowe · · 7 min read
crewai a2a delegation governance tutorial
Share X HN LinkedIn

CrewAI added agent-to-agent (A2A) delegation. Its A2A docs describe agents that “autonomously choose between local execution and remote delegation based on task requirements.” One crew can hand work to another crew over HTTP.

This guide covers the setup, then what to add so you know who asked for what. The CrewAI code is a sketch from when this was written (April 2026). Package and class names change, so check CrewAI’s docs before you copy it.

Quick install for tool checks

pip install crewai acp-crewai

Wrap each tool with @governed and bind the end user’s JWT on each request. Every tool call is then checked against your workspace policy for that user before it runs, and logged under that user’s name.

from crewai.tools import tool
from acp_crewai import governed, install_crew_hooks, set_context

@tool("web_search")
@governed("web_search")
def web_search(query: str) -> str:
    """Search the web."""
    return my_search(query)

# per request: bind the user, then run the crew
set_context(user_token=bearer_token)
crew = Crew(agents=[researcher, writer], tasks=[...])
install_crew_hooks(crew)   # logs handoffs between agents too
crew.kickoff()

@governed has to sit closer to the function than @tool. Tools outside this pattern are not checked. The CrewAI integration guide has the full reference.

What CrewAI A2A does

There are two sides.

  1. A2A server. Wrap a crew or single agent so other crews can call it over HTTP. You set the endpoint, auth, response model and max turns.
  2. A2A client. Give an agent the ability to delegate to remote A2A servers.

The agent’s LLM decides whether to do a task itself or delegate it. CrewAI handles discovery, auth (bearer tokens, OAuth), response models, timeouts and retries.

CrewAI leaves three things to you: whether a delegation should be allowed, what the delegated agent may do once it accepts, and how to audit the whole chain. That’s reasonable. A2A is transport, the way HTTP is transport.

Step 1: build a basic A2A crew

Server side, the agent you expose:

# server_crew.py
from crewai import Agent, Crew, Task
from crewai_a2a import A2AServerConfig, expose_as_a2a_server
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(model="claude-sonnet-4-6")

researcher = Agent(
    role="Market researcher",
    goal="Summarize recent moves in a given market segment",
    backstory="You're a senior analyst. Be precise; cite sources.",
    tools=[web_search, hn_search],
    llm=llm,
)

server_crew = Crew(
    agents=[researcher],
    tasks=[Task(description="{topic}", expected_output="A 200-word brief.", agent=researcher)],
)

config = A2AServerConfig(
    endpoint="/a2a/researcher",
    auth={"type": "bearer", "token": os.environ["A2A_SHARED_SECRET"]},
    max_turns=10,
)

app = expose_as_a2a_server(server_crew, config)   # FastAPI app
# uvicorn server_crew:app --host 0.0.0.0 --port 8000

Client side, an orchestrator that delegates to it:

# client_crew.py
from crewai import Agent, Crew, Task
from crewai_a2a import A2AClientConfig

researcher_a2a = A2AClientConfig(
    endpoint="https://internal-research.example.com/a2a/researcher",
    auth={"type": "bearer", "token": os.environ["A2A_SHARED_SECRET"]},
    timeout=60,
    max_turns=10,
)

orchestrator = Agent(
    role="Strategy analyst",
    goal="Produce strategy memos backed by fresh research",
    tools=[],
    a2a_clients={"researcher": researcher_a2a},
    llm=ChatOpenAI(model="claude-sonnet-4-6"),
)

writer = Agent(role="Writer", goal="Turn analysis into a polished memo", llm=llm)

Crew(
    agents=[orchestrator, writer],
    tasks=[
        Task(description="Research the MCP gateway market", agent=orchestrator),
        Task(description="Write a 400-word brief", agent=writer),
    ],
).kickoff()

Run it. The orchestrator’s LLM decides to hand the research to the remote researcher, CrewAI does the HTTP round trip, and the writer turns the result into a memo.

This works. What you can’t yet answer is who triggered it, what the researcher was allowed to do, and whether anything went outside policy.

Step 2: check the tools

Get an API key from cloud.agenticcontrolplane.com. Then wrap the tools on each crew as in the short version above.

Before a wrapped tool runs, ACP checks your workspace policy, the user’s scopes, rate limits and PII detection. It answers allow, deny or redact.

  • Deny or ask. The wrapped function returns tool_error: <reason>. CrewAI treats that as the tool’s output, so the model sees why and can change course. An ask doesn’t show as a prompt here. It arrives as a block. You approve it on the Approvals page or from the approval email, then the call is retried.
  • Allow. Your tool runs. ACP then scans the output for PII, and if policy says redact, the redacted text replaces the output.

install_crew_hooks(crew) records handoffs between agents (sequential task passes and CrewAI’s coworker delegation) as Agent.Handoff events in the same log. That’s how you see the chain.

Everything shows up in Activity: the end user’s identity, the tool name, the decision and the reason, the session, and any PII found. Your CrewAI calls sit next to Claude Code and Cursor calls from the same person.

Step 3: set limits per agent

Open Policies in the console. For each agent type you can set, per tier (interactive, subagent, background, api):

  • allow or deny
  • a rate limit in calls per minute
  • what to do with PII: detect, redact or block

Agent profiles can also carry a budget cap and a maximum delegation depth. Child keys minted for a delegated agent can only narrow what the parent could do, and ACP rejects a delegation cycle. Check the agent-to-agent page for how that works today and which of it applies to a CrewAI crew. I haven’t verified automatic enforcement of those limits on every CrewAI A2A hop, so test your own chain before you rely on it.

Step 4: production habits

  • Separate workspaces for dev and prod. Use a different key for each, so a dev experiment can’t touch prod limits.
  • Export the log. Activity exports to CSV, so your SIEM can pull it in.
  • Know the failure mode. If the gateway can’t be reached within 5 seconds, acp-crewai lets the tool run and logs the decision as fail-open. Raise the timeout with configure(timeout_s=10) if latency is the cause. If you need it to stop instead, that’s a design decision to make now, not during an outage.
  • Keep production credentials out of the tools’ reach wherever you can. Policy narrows what a tool does. It is not a substitute for least privilege.

Where CrewAI ends and ACP starts

Concern CrewAI A2A ACP
Transport, auth, retries between agents Yes No
Discovery and capability negotiation Yes No
Whether to delegate The agent’s LLM decides No
Whether a tool call is allowed, per user No Yes, on wrapped tools
Rate limits and PII handling No Yes, on wrapped tools
One log of calls and handoffs, under the human’s name No Yes, with @governed and install_crew_hooks

CrewAI moves the work between agents. ACP checks the tool calls and keeps the record.

Next

Questions about wiring this up for your stack? Get in touch or start a workspace.

Running coding agents? ACP records each tool call its hook sees and makes the dangerous shell commands (a force-push, destructive SQL, curl | sh) wait for you. One command, free up to 5 agents:

macOS · Linux · WSL
curl -fsSL https://agenticcontrolplane.com/install.sh | bash
Windows · PowerShell
irm https://agenticcontrolplane.com/install.ps1 | iex

What the installer writes  ·  Getting started

Share X HN LinkedIn
Get the next data drop
What agents actually cost, new tool-surface captures, and the occasional incident post-mortem — sent when we publish something worth your inbox, not on a schedule. Unsubscribe anytime.
Share: Twitter LinkedIn
Related posts

← back to blog