Multi-agent collaboration
6.2.6· AI-ML › AI Agents & Tool Use
Multi-agent Collaboration Kya Hai?
Key distinctions:
- vs. Single agent with tools: Ek agent tools ko sequentially call karta hai; multi-agent ka matlab hai multiple reasoning loops jo parallel ya turn-based hote hain
- vs. Ensemble models: Ensembles predictions ko statistically combine karte hain; agents explicit communication ke through coordinate karte hain
- vs. Hierarchical agents: Flat (peers) ya hierarchical (manager-worker) ho sakta hai, lekin collaboration ka matlab hai information exchange, sirf top-down commands nahi
Collaboration Kyun Emerge Hoti Hai: First Principles Derivation
Shuru karte hain task complexity se. Ek complex task ke liye capabilities chahiye (jaise web search, code execution, image analysis, domain reasoning).
Single-agent approach: Ek agent ke paas hona chahiye:
Problem: Jaise-jaise badhta hai, agent ki context window, training data requirements, aur reasoning complexity explode ho jaati hai. Prompts unwieldy ho jaate hain, aur agent focus khone lagta hai.
Multi-agent approach: Capabilities ko partition karo:
Har agent specialize karta hai: .
Coordination cost: Agents ko communicate karna padta hai. Maano = messages exchanged. Total cost:
Multi-agent kab better hai?
Yeh tab hota hai jab:
- Specialization gain: kyunki har ka task simpler hai, context focused hai, aur apne domain mein performance better hai
- Parallelization: Multiple simultaneously kaam kar sakte hain, latency reduce hoti hai:
- Communication overhead low hai: dominate nahi karta (well-defined interfaces, efficient messaging)
Emergent behavior ki derivation: Har agent ki ek policy hoti hai jo uski local observation par conditioned hoti hai. Joint behavior:
Emergent behavior tab arise hota hai jab joint policy aaise outcomes achieve karti hai jo koi individual akele produce nahi kar sakta, information sharing aur action coordination ke through.
Collaboration Patterns
1. Debate / Adversarial
- Structure: Do ya zyada agents opposing positions lete hain, argue karte hain, refine karte hain
- Kyun: Confirmation bias reduce hoti hai, reasoning mein weak points surface hote hain
- Example: Agent A ek solution propose karta hai, Agent B critique karta hai, Agent C synthesize karta hai
- Formula: Iterative refinement
2. Parallel with Aggregation
- Structure: Multiple agents same problem ko independently solve karte hain, results aggregate hote hain
- Kyun: Robustness badhti hai (majority voting), diverse reasoning paths explore hote hain
- Example: Teen agents code generate karte hain, majority vote ya best-of-N lete hain
- Formula:
3. Sequential Pipeline
- Structure: Agent ka output ko jaata hai jo ko deta hai, aur aage
- Kyun: Har agent ek transformation stage mein specialize karta hai
- Example: Researcher → Coder → Tester → Documenter
- Formula: Risk: Error propagation—agar fail karta hai, toh saare downstream agents corrupted input dekhte hain.
4. Dynamic Coordination (Manager-Worker)
- Structure: Manager agent current state ke basis par worker agents ko subtasks delegate karta hai
- Kyun: Adaptive—manager re-plan kar sakta hai jaise results aate hain
- Example: Manager "build a web app" ko frontend, backend, database subtasks mein todhta hai, specialists ko assign karta hai
- Formula: Manager ek task queue aur assignment function maintain karta hai:
5. Peer-to-peer Negotiation
- Structure: Agents directly communicate karte hain, resources negotiate karte hain, central authority ke bina consensus tak pahunchte hain
- Kyun: Centralized se better scale hota hai (koi bottleneck nahi), lekin conflict resolution protocols ki zaroorat hoti hai
- Example: Traffic control ke liye multi-agent reinforcement learning—har intersection agent apne neighbors ke saath signal timing negotiate karta hai
Worked Example 1: Software Development Team
Task: E-commerce product data ke liye Python web scraper banana.
Agents:
- Planner: Task ko subtasks mein todhta hai
- Coder: Implementation code likhta hai
- Tester: Tests likhta aur run karta hai
- Reviewer: Code quality review karta hai, improvements suggest karta hai
Step-by-step:
-
Planner task receive karta hai:
User: "Scrape Amazon product listings for laptops under $1000"Yeh step kyun? Vague task ko concrete, implementable units mein decompose karna zaroori hai.
Planner output karta hai:
Subtasks: 1. Research Amazon's HTML structure for product listings 2. Write scraper with requests + BeautifulSoup 3. Handle pagination and rate limiting 4. Parse product: name, price, rating 5. Save to CSV6. Write unit tests -
Coder subtask 2 receive karta hai: Yeh step kyun? Implementation mein specialist planning ke saath juggling kiye bina code quality par focus kar sakta hai.
Coder likhta hai:
import requests from bs4 import BeautifulSoup def scrape_amazon(url, max_price=1000): response = requests.get(url, headers={'User-Agent': '...'}) soup = BeautifulSoup(response.content, 'html.parser') products = [] for item in soup.select('.s-result-item'): price = parse_price(item) if price and price <= max_price: products.append({...}) return products -
Tester code receive karta hai: Yeh step kyun? Alag agent ensure karta hai ki tests implementation details ke bias se free hon. Tester likhta hai:
def test_scrape_amazon(): mock_html = '<div class="s-result-item">...</div>' # Mock requests, verify parsing assert len(scrape_amazon(mock_url)) > 0Tests run karta hai, report karta hai: "Parse function missing price field par fail hoti hai."
-
Reviewer code + test results receive karta hai: Yeh step kyun? Fresh eyes woh issues pakadti hain jo coder aur tester miss kar gaye (jaise security, maintainability).
Reviewer suggest karta hai:
- "Network failures ke liye error handling add karo"
- "Rate limiting avoid karne ke liye requests ke beech delay use karo"
-
Coder feedback ke basis par iterate karta hai, Tester re-run karta hai, Reviewer approve karta hai.
Emergent outcome: Ek akele agent ki tulna mein higher quality code, kyunki har agent ne specialized scrutiny laaya.
Worked Example 2: Research Paper Analysis
Task: "5 recent papers on multi-agent RL ke key contributions summarize karo."
Agents:
- Searcher: Relevant papers dhundta hai (tool: web search)
- Reader (×5): Har ek ek paper depth mein padhta hai
- Synthesizer: Findings ko coherent summary mein combine karta hai
Step-by-step:
-
Searcher arXiv query karta hai, 5 paper PDFs return karta hai. Parallel readers kyun? 5 papers sequentially padhna slow hai; parallel agents latency 50 minutes se 10 minutes par le aate hain.
-
Readers (parallel mein):
- Reader1: "Paper A cooperative games ke liye ek naya credit assignment method introduce karta hai..."
- Reader2: "Paper B agent communication ke liye graph neural networks apply karta hai..."
- ...
-
Synthesizer 5 summaries receive karta hai: Alag synthesizer kyun? Readers apne paper ki taraf biased hote hain; synthesizer ke paas common themes, contradictions, aur gaps identify karne ke liye full context hota hai.
Synthesizer output karta hai:
**Common theme**: Saare papers non-stationarity se struggle karte hain (agents ki policies change hoti hain, ID assumption violate hoti hai). **Novel contributions**: - Paper A: Centralized training, decentralized execution (CTDE) - Paper B: Communication via learned embeddings **Contradictions**: Paper C claim karta hai full decentralization zaroori hai, lekin Paper D dikhata hai ki CTDE practice mein better perform karta hai.
Emergent outcome: Nuanced synthesis jo koi akela agent produce nahi kar sakta tha bina saare papers padhe, jo context limits exceed kar deta.
Communication Mechanisms
Agents messages ke through communicate karte hain. Design space:
-
Natural language: Flexible, interpretable, lekin ambiguous Pro: LMs directly samajhte hain. Con: Parsing failures, verbose.
-
Structured (JSON/YAML): Explicit schema, machine-parsable
{ "from": "AgentA", "to": "AgentB", "action": "analyze_data", "params": {"file": "X", "method": "regression"} }Pro: Reliable, testable. Con: Upfront schema design ki zaroorat hai.
-
Shared memory: Agents ek common state mein read/write karte hain (jaise ek database, ek shared document) Pro: Kaafi agents tak scale karta hai (N² message passing nahi). Con: Concurrency issues, locking ki zaroorat.
-
Blackboard architecture: Central "blackboard" jahan agents partial solutions post karte hain, doosre padhte hain aur unpar build karte hain Yeh kyun kaam karta hai: Agents ko decouple karta hai—yeh jaanna zaroori nahi ki aur kaun kaam kar raha hai, bas blackboard check karo.
Latency analysis: Agar har agent seconds reasoning mein leta hai aur messages seconds lete hain:
- Sequential pipeline: Total time
- Parallel with aggregation: Total time (saare agents simultaneously chalte hain)
- Dynamic coordination: Total time (n rounds of feedback)
Common Mistakes
Active Recall Flashcards
#flashcards/ai-ml
Multi-agent collaboration kya hai? :: Multiple autonomous agents jinke paas specialized capabilities hain, jo messages exchange karke aur actions coordinate karke complex problems solve karne ke liye saath kaam karte hain jo koi akela agent nahi kar sakta.
Multi-agent collaboration ek akele agent se zyada efficient kab hoti hai?
Paanch common multi-agent collaboration patterns kya hain?
Debate pattern mein opposing agents output quality kyun improve karte hain?
Sequential pipeline architecture mein main risk kya hai?
Blackboard architecture agents ko kaise decouple karta hai?
Parallel multi-agent execution with aggregation ki time complexity kya hai?
Bahut zyada agents performance kyun hurt karte hain?
Multi-agent systems mein teen conflict resolution strategies kya hain?
Pipeline mein error propagation kaise rokein?
Multi-agent systems mein emergent behavior kya hai?
Multi-agent systems ke liye do communication mechanisms batao.
Recall Samjho Jaise Main 12 Saal Ka Hoon: Team Project
Socho tum ek bada school science project kar rahe ho—ek working model volcano banana. Tum yeh sab akele kar sakte ho: research karo ki volcanoes kaise kaam karte hain, materials kharido, structure banao, "lava" chemicals mix karo, paint karo, report likho. Lekin isme bahut time lagega aur shayad kuch galat ho jaye kyunki tum har cheez mein expert nahi ho.
Uski jagah, tum ek team banate ho:
- Alex chemistry pasand karta hai—vinegar-baking soda reaction handle karta hai
- Jordan building mein great hai—pahaad construct karta hai
- Taylor artistic hai—use realistically paint karta hai
- Tum coordinate karte ho aur report likhte ho
Tum sab ek doosre se baat karte ho: "Hey Alex, hume kitna vinegar chahiye?" "Jordan, crater opening 5 cm wide banao taaki lava bahar aaye." Saath kaam karke, tum jaldi finish karte ho aur volcano amazing dikhta hai—kaafi better kisi ek akele insaan ke kaam se. Multi-agent collaboration AI ke liye same idea hai: ek huge AI ke badlaye jo sab kuch karne ki koshish kare (aur confuse ho jaye), tum multiple specialized AIs rakhte ho—ek research karta hai, ek code likhta hai, ek test karta hai, ek review karta hai. Woh messages pass karke "baat" karte hain, aur final result better hota hai kyunki har AI ne woh kiya jo woh best karta hai.
Connections
- 6.2.01-What-are-AI-agents: Foundation—multi-agent agents ke multiple instances hain
- 6.2.02-Perception-action-cycle: Multi-agent system mein har agent apna khud ka perception-action loop chalata hai
- 6.2.05-Agent-tool-use: Multi-agent ko agents ki "doosre agents ko tools ke roop mein" use karne ke roop mein dekha ja sakta hai
- 6.3.01-Prompt-engineering-for-agents: Har agent ko effective prompts chahiye; manager agents ko meta-prompting chahiye
- Ensemble-methods: Aggregation ke saath parallel multi-agent model ensembles ke similar hai lekin explicit reasoning ke saath
- Distributed-systems: Multi-agent distributed computing se concepts borrow karta hai—consensus, coordination, fault tolerance
- Game-theory: Peer-to-peer negotiation equilibrium ke liye game-theoretic principles use karta hai
- Reinforcement-learning: Multi-agent RL study karta hai ki agents dusre learning agents ki presence mein policies kaise seekhte hain
Last updated: 2026-07-01 | Next: 6.2.07-Agent-memory-systems