Content
# Agent collaboration using MCP and A2A with CrewAI and LangGraph
## Overview
This document contains the implementation details of two-three different agents, pertained to different domains, for example one agent for financial tasks and another one for HR related tasks to work together and complete a user action. These agents will be defined in completely different agent frameworks, with access to a set of different tools (tied to the agent directly or connected through remote MCP servers), memory, and other related agent primitives (human in the loop, human on the loop, tracing, observability, etc). The purpose of this is to have two specialized and scalable micro agents, integrated through an orchestrator. The rest of this design document contains the use case, the system components, user workflow and implementation details.
## Use case
The implementation design consists of two domain-specific micro agents:
1. **Financial agent**: This agent is designated for payroll and salary estimations. It maintains local functions that it has locally access to and then an MCP server for other domain specific tools. These local functions contain functionalities such as:
1. Computing gross pay, deductions (with tax and benefits), net pay (hourly, annually).
2. It also integrates with shared remote MCP tools such as up to data tax information, benefits, ensuring consistency across organization.
2. **HR agent**: This agent manages leave-and vacation tracking functionality.
1. Locally, it provides tools to calculate the remaining vacation days for a user, schedules and carry over balances.
2. Through MCP, it has access to a central employee directory service to validate employee IDs, pull standardized leave policy parameters, allowing it to enforce company wide rules without duplicating data.
### High level components to this agent design
This specialized micro agent architecture where these domain specific agents communicate while collaborating tasks that consist of the following in this system:
1. **Multi agents**: 2 domain specific agents built on LangGraph and CrewAI
2. **An orchestrator** that routes user requests, this can be another agent.
3. **Communication protocols**: There are two communication protocols that will be followed for this:
1. MCP: This is for agent to tool communication
2. A2A: For agent to agent communication. This is how the agents from different domains/frameworks will interact with each other.
### User journey & Tool implementation details
Let’s walk through the implementation flow:
1. **User Request & Orchestrator Setup**
1. **User Request**: The user sends a POST to the orchestrator endpoint with the question “What will my paycheck be if I take next week off?” including their Okta access token in the Authorization header. Okta Developer
2. **JWT Validation**: The orchestrator uses Okta’s JWT Verifier to confirm the token’s signature.
2. **Agent Discovery & Initial MCP Calls**
1. Service Discovery: The orchestrator will access some sort of agent registry/gateway to get access to the available agents that can help with the task. In this case, the orchestrator will pick on the HR and financial agents to help with this task.
3. HR Agent Processing (In CrewAI)
1. MCP-Hosted Lookups: Upon receiving the call, the HR Agent invokes the MCP-hosted EmployeeDirectoryService to validate the employeeId and LeavePolicyService to fetch current accrual and carry-over rules. Need to think more on this
2. Local Computation: It then runs its local getRemainingVacationDays logic—applying accrual schedules, historical leave logs, and blackout rules—to compute vacationDaysLeft.
3. Return to Orchestrator: The HR Agent returns a JSON-RPC response { "vacationDaysLeft": 8 } over the same SSE/HTTP channel.
View more on the employee details here: HR Leave Management System: Database Design & Data Generation.
This agent should use basic primitives such as memory (using Mem0) and tracing observability.