
परियोजना परिचय
यह परियोजना दिखाती है कि AG2 फ्रेमवर्क (पूर्व में AutoGen) का उपयोग करके MCP (Model Context Protocol) का समर्थन करने वाला एक बुद्धिमान एजेंट कैसे बनाया जाए, और मानकीकृत संचार के लिए A2A (Agent2Agent) प्रोटोकॉल के माध्यम से संचार कैसे करे।
इस परियोजना की मुख्य विशेषताओं में शामिल हैं:
- MCP टूल एकीकरण: MCP प्रोटोकॉल के माध्यम से विभिन्न बाहरी उपकरणों और क्षमताओं तक पहुंच
- YouTube उपशीर्षक प्रसंस्करण: YouTube वीडियो उपशीर्षक डाउनलोड और विश्लेषण के लिए विशेषज्ञ बुद्धिमान एजेंट
- A2A प्रोटोकॉल समर्थन: मानकीकृत अंतर-एजेंट संचार इंटरफेस प्रदान करता है
- रियल-टाइम स्ट्रीमिंग प्रसंस्करण: कार्य निष्पादन के दौरान रियल-टाइम स्थिति अपडेट का समर्थन करता है
- क्रॉस-फ्रेमवर्क संगतता: विभिन्न एजेंट फ्रेमवर्क के बीच अंतरसंचालनीयता का प्रदर्शन करता है
चलाने का तरीका
1. कोड क्लोन करें
git clone https://github.com/sing1ee/a2a-mcp-ag2-sample.git
cd a2a-mcp-ag2-sample
2. पर्यावरण सेटअप
वर्चुअल वातावरण बनाने और निर्भरताएं स्थापित करने के लिए uv पैकेज मैनेजर का उपयोग करें:
# वर्चुअल वातावरण बनाएं
uv venv
# वर्चुअल वातावरण सक्रिय करें और निर्भरताएं सिंक करें
uv sync
3. पर्यावरण चर सेट करें
एक .env फ़ाइल बनाएं और अपनी OpenAI API कुंजी जोड़ें:
echo "OPENAI_API_KEY=your_api_key_here" > .env
4. MCP YouTube टूल स्थापित करें
uv tool install git+https://github.com/sparfenyuk/mcp-youtube
5. एजेंट चलाएं
# डिफ़ॉल्ट कॉन्फ़िगरेशन के साथ चलाएं
uv run .
# कस्टम होस्ट और पोर्ट
uv run . --host 0.0.0.0 --port 8080
6. डिबगिंग और परीक्षण
डिबगिंग के लिए A2A Inspector देखें। A2A Inspector एक शक्तिशाली उपकरण है जो विशेष रूप से A2A एप्लिकेशन डिबगिंग के लिए डिज़ाइन किया गया है, जो आपकी मदद कर सकता है:
- अंतर-एजेंट संचार की निगरानी करना
- A2A प्रोटोकॉल संदेशों का निरीक्षण करना
- कार्य निष्पादन प्रवाह को डिबग करना
- एजेंट प्रतिक्रिया प्रारूपों को मान्य करना
उदाहरण उपयोग
एजेंट शुरू करने के बाद, आप YouTube उपशीर्षक कार्यक्षमता का परीक्षण करने के लिए निम्नलिखित अनुरोध भेज सकते हैं:
Summarize this video: https://www.youtube.com/watch?v=kQmXtrmQ5Zg
परियोजना प्रवाह अनुक्रम आरेख
sequenceDiagram
participant Client as A2A Client
participant Server as A2A Server
participant Agent as AG2 Agent
participant MCP as MCP Server
participant YouTube as YouTube MCP Tool
Client->>Server: Send task request
Server->>Agent: Forward query to AG2 agent
Note over Server,Agent: Real-time status updates (streaming)
Agent->>MCP: Request available tool list
MCP->>Agent: Return tool definitions
Agent->>Agent: LLM decides to use YouTube tool
Agent->>MCP: Send tool execution request
MCP->>YouTube: Call YouTube subtitle download tool
YouTube->>YouTube: Download video subtitles
YouTube->>MCP: Return subtitle data
MCP->>Agent: Return tool execution result
Agent->>Agent: LLM processes subtitle data and generates response
Agent->>Server: Return complete response
Server->>Client: Respond with task result
तकनीकी आर्किटेक्चर
मुख्य घटक
- YoutubeMCPAgent: AG2 AssistantAgent पर आधारित मुख्य एजेंट कार्यान्वयन
- AG2AgentExecutor: कार्य निष्पादन और इवेंट क्यू को संभालने वाला A2A प्रोटोकॉल एडाप्टर
- MCP टूल एकीकरण: stdio क्लाइंट के माध्यम से MCP सर्वर से जुड़ता है
- A2A सर्वर: मानकीकृत एजेंट संचार इंटरफेस प्रदान करता है
मुख्य विशेषताएं
- प्रतिक्रिया मॉडल: संरचित आउटपुट सुनिश्चित करने के लिए Pydantic मॉडल का उपयोग करता है
- असिंक्रोनस प्रसंस्करण: समवर्ती कार्य प्रसंस्करण और स्ट्रीमिंग प्रतिक्रियाओं का समर्थन करता है
- त्रुटि हैंडलिंग: पूर्ण त्रुटि कैप्चर और रिकवरी तंत्र
- टूल पंजीकरण: MCP उपकरणों का गतिशील पंजीकरण और प्रबंधन
सारांश
AI एजेंट उत्पादों के तीव्र विकास और प्रसार के साथ, बाजार में LangGraph, CrewAI, AG2 आदि जैसे अधिक से अधिक एजेंट फ्रेमवर्क और समाधान उभरे हैं। प्रत्येक फ्रेमवर्क के अपने अनूठे फायदे और लागू परिदृश्य हैं, लेकिन यह अंतरसंचालनीयता में चुनौतियां भी लाता है।
A2A प्रोटोकॉल का महत्वपूर्ण महत्व:
- मानकीकृत संचार: A2A प्रोटोकॉल अंतर-एजेंट संचार के लिए एक सार्वभौमिक भाषा के रूप में कार्य करता है, विभिन्न फ्रेमवर्क के बीच बाधाओं को समाप्त करता है
- पारिस्थितिकी तंत्र अंतर्संबंध: विभिन्न तकनीकी स्टैक के एजेंटों को निर्बाध रूप से सहयोग करने में सक्षम बनाता है, एक अधिक शक्तिशाली AI पारिस्थितिकी तंत्र का निर्माण करता है
- एकीकरण लागत में कमी: डेवलपर्स को अब प्रत्येक फ्रेमवर्क के लिए अलग एडाप्टर विकसित करने की आवश्यकता नहीं है, सिस्टम एकीकरण की जटिलता को काफी कम करता है
- नवाचार को बढ़ावा देना: मानकीकृत प्रोटोकॉल के माध्यम से, डेवलपर्स प्रोटोकॉल अनुकूलन के बजाय एजेंट क्षमताओं में सुधार पर ध्यान केंद्रित कर सकते हैं
- भविष्य की स्केलेबिलिटी: जटिल मल्टी-एजेंट सिस्टम निर्माण के लिए एक ठोस आधार रखता है
यह परियोजना दिखाती है कि A2A प्रोटोकॉल AI एजेंट पारिस्थितिकी तंत्र को जोड़ने वाला एक महत्वपूर्ण पुल बनेगा, पूरे उद्योग को अधिक खुली और अंतर्संबंधित दिशा में ले जाएगा।
Related Articles
Explore more content related to this topic
A2A vs MCP Protocol Relationship: In-Depth Community Discussion Analysis
Comprehensive analysis of A2A vs MCP protocol relationship based on GitHub community discussions. Explores design philosophy differences, ecosystem maturity, and practical guidance for choosing between agent-to-agent communication vs tool standardization approaches.
AgentMaster Multi-Agent Conversational Framework - Multimodal Information Retrieval System Based on A2A and MCP Protocols
AgentMaster is a next-generation multi-agent conversational framework jointly developed by Stanford University and George Mason University, pioneering the integration of A2A and MCP protocols in a single system. It supports multimodal inputs including text, images, and audio, automatically decomposes complex tasks through coordinator agents, and implements various functions such as SQL queries, information retrieval, and image analysis with excellent performance and user-friendliness.
A2A MCP: Predicting the Winner in AI Protocol Evolution
Comprehensive comparative analysis of A2A MCP protocols. Deep dive into A2A MCP technical architecture, implementation approaches, and ecosystem advantages. Analyzing competitive landscape of A2A MCP in interoperability, scalability, and market adoption, predicting future development of A2A MCP.
A2A MCP Integration
Step-by-step guide to A2A and MCP integration using Python SDK. Build AI agents with OpenRouter, featuring server-client communication and tool discovery.
A2A vs MCP vs AG-UI
An in-depth analysis of AG-UI, MCP, and A2A protocols, exploring their characteristics, technical implementations, and application scenarios, and how they work together to build a complete AI agent communication ecosystem.