localmTUTS
FollowFollowSubscribe
💻Video + Code Examples·11 mins

A2A with CrewAI

Build a loan validation crew using CrewAI's role-based agent model — a Compliance Analyst runs checks while a Senior Underwriter synthesises the verdict. The entire crew is wrapped as a single A2A endpoint powered by Kimi-K2-Thinking.

A2A with CrewAI · 11 mins
Instructor:Welcome back to LocalM Tuts. I am Nilay Parikh. This is Lesson 11 of 16, A2A with CrewAI. Last time we combined A2A with LangGraph ReAct agent, and it used MCP for tools, A2A for agent communication. If you want to watch this as a standalone video, find the complete course playlist below in the description and follow along. There is also links for examples and interactive page in description which might come useful. Loan validation crew with 2 agents, a Compliance Analyst that runs the hard and soft checks, and a
Instructor:Senior Underwriter that synthesizes the results as a verdict. The CrewAI orchestrates them sequentially, and the A2A client sees the one agent. CrewAI's opaque execution is a perfect match for A2A. The protocol says callers don't need to know the agent's internals. With CrewAI, the internals are an entire crew running, but the A2A agent just sees it as one endpoint. Let's see this in action. Install the dependencies, configure the credentials, and start the crew server on port 10,004 and watch how
Instructor:it works sequentially. You can also pause the video and try it yourself. Lesson 11 practical session. A2A server wrapping with CrewAI. Orchestrator agent, same architecture: server Orchestrator client in the orchestrator here we are using CrewAI. Server is implemented by A2A because CrewAI does not by default offer an A2A interface, so we are using the A2A orchestrator. It is CrewAI, and then we have client as pure A2A implementation, and we are
Instructor:using the common loan data and the validation rule. I got the server up and running. I just run the server and let's see how does the client. process the loan data. Sorry. See here, it is using skill pre-screening. Dismiss. B Overwhelming for short sessions. But it is important, no one needs to know all the frameworks. But I'm just showing as a 2 as capability as we know. Many teams in past we have worked
Instructor:with microservices or the service oriented architecture with polyglot systems. Agents are all about polyglot architecture. Various teams in different horizontal and vertical can create agents differently based on their needs, based on what what frameworks would suit them best. And this is why A2A is important. It is irrespective of the framework. It can. It can provide end to end horizontal integration. So it is good to understand how various SDKs can be connected via A2A. And have a broad aspect of it. Ah,
Instructor:and again, as I said in the past lessons and comments, that if you are new to abstract thinking, abstract programming, especially in agent work, you might find it overwhelming. I would strongly recommend going again and again through the tutorial. Read the interactive page. There is very good theory, simplified code, you will understand what it is doing. And overall it will help you to build a very good long-term understanding of A2A. I don't expect that. The understanding of A2A would
Instructor:be very quick and straightforward unless you have experience in service-oriented architecture, microservices, and complex system designing. Then yes, it might feel straightforward to you. But don't be disheartened if it takes a couple of attempts, there is nothing wrong in it. It should take, because meaningful understanding is always better than just having a sense of false and pretend understanding, that yes we know, but sometimes it is very hard. But even see here, now it has
Instructor:processed, and look at the detail it is providing. It's a nuance of various SDKs that it is generating very well. Underwriting condition, risk flags and all sort of things. For example, if you see what what if we compare it with what this LangGraph did? LangGraph did not create this compensating factor, underwriting conditions so well. Where here you see, CrewAI did very well, and that's because the crew works with a very different architecture inside and that helps us to understand that it's not always about.
Instructor:What models we use? It's not always about what. What architecture we use, but the frameworks also do matter a lot, especially if you are just trying to get the if you are just trying to get the out of the box capabilities. And therefore I said for various applications you will find that different agent frameworks work better. And there is nothing wrong instead of. fixing yourself on one architecture of agent framework. We should fix ourselves with A2A, which is interoperable, and then let the
Instructor:best agent framework work for the use case it is designed for. And that's a better way to deal with change than using one. And basically trying to restrict ourselves in that sense is we restrict our choices. Restricting choices in AI is actually mostly going to backfire in most of the cases. We should not spend, we should not build. Every problem with different solution architecture, but I think we should be OK to handle couple of different variations and SDKs based on the use case and use case, use case
Instructor:and individual married cases. But as I said, CrewAI does very differently than LangChain or LangGraph works differently in other scenarios and the same way if we use Microsoft Agent framework, the Microsoft Agent Framework works slightly differently. It does not provide underwriter conditions or that comprehensive risk flag as CrewAI. AI. So its its a very mature framework. And it shows the way it handles. Also, different frameworks handle tokens differently, so you might find the one particular framework can
Instructor:have excessive use of token, providing very in depth understanding and explanation, while the other framework may be using far less tokens. So this is where the real. Vo. Assessment, scientific data driven assessment will come and when I will, when I will build. Or when I will record the agent. not A2A, but 100% on agent frameworks, I will discuss how I make decisions on which agent should shoot what kind of requirement and that might be very interesting conversation forward. But I
Instructor:think this is done or it is doing the last one. You can see it taking a little bit more time, that means it is generating more token. So let's see if how the token works. So if you open the tokens it has spiked up a little bit, so. has spiked up literate so. Unfortunately they can't validate on individual request by request basis. I have not got that. Just let me refresh it to refresh this page and see how it works. So you can see like it's going. Probably need to, uh, find a
Instructor:better matrix for it, but yes, they do differ. Okay, I'm gonna just stop there. Assuming everything around up, you can see the risk flag and everything working bundle fully well. Umm, and it did deny Bob. So let's see, Bob should be denied. Ah, yes, he should be declined, absolutely. So that's brilliant and look at the detailed reasoning it has provided and risk flags. Fine, so. I leave it here by generally it should be light they so this is the wrong. I think
Instructor:this is the last one which failed. Yeah, but it should be like this Weekly a I. Weight detail one. Alright then I will see you in the next session. You have wrapped a multi-agent crew as a single A2A endpoint. The orchestrator from Lesson 8 can call this crew directly like it calls any other agent. It proves that A2A makes framework choice invisible. Thanks for watching this lesson. In the next lesson we will try with OpenAI Agents SDK. And A2A wrapping. You find The next video link in the description
Instructor:below and I'll see you there.
Learning Objectives5
  • Define CrewAI agents with roles, goals, and tool classes (BaseTool subclasses)
  • Create tasks with expected output specifications and agent assignments
  • Compose a Crew with sequential process execution
  • Build a CrewAIExecutor to wrap the Crew as an A2A server
  • Compare CrewAI's role-based approach to other frameworks in the course

Run the Lesson 11 Example

0/5

Clone the examples repository

git clone https://github.com/nilayparikh/tuts-agentic-ai-examples.git
cd tuts-agentic-ai-examples/a2a/lessons/11-crewai

Set up the virtual environment

cd ../../
python -m venv .venv
.venv/Scripts/Activate.ps1
pip install -r requirements.txt

Configure environment variables

# _examples/.env
AZURE_OPENAI_ENDPOINT, AZURE_AI_API_KEY, AZURE_AI_MODEL_DEPLOYMENT_NAME=Kimi-K2-Thinking

Start the A2A server

cd lessons/11-crewai/src
python server.py

Run the A2A client

cd lessons/11-crewai/src
python client.py
nilayparikh/tuts-agentic-ai-examples/tree/main/a2a/lessons/11-crewaiGitHub

Complete source code for this lesson.

github.com/nilayparikh/tuts-agentic-ai-examples/tree/main/a2a/lessons/11-crewai
Q&A

Q & A

Q

Why use CrewAI's BaseTool classes instead of simple functions?

CrewAI tools are Pydantic models with name, description, and _run() method. This gives you type validation, consistent error handling, and automatic schema generation for the LLM.

Q

What's the difference between sequential and hierarchical process?

Sequential runs tasks in order — each agent gets the previous agent's output. Hierarchical introduces a manager agent that dynamically routes tasks. Sequential is predictable; hierarchical is more flexible.

Q

Why is opaque execution a good match for A2A?

A2A's design principle is that callers do not need to know an agent's internals. CrewAI's multi-agent crew is the perfect example — the client sees one endpoint, whether there is one agent or ten inside.

Q

Can you mix models within a CrewAI crew?

Yes. Each CrewAgent can use a different model via its llm parameter. You could use a reasoning model for the Underwriter and a faster model for the Analyst.