Communication shared workspace (filesystem) aur message passing (inter-agent prompts) ke zariye hoti hai.
Multi-agent kyun? Specialization quality improve karta hai (har agent apne role ke liye optimized hai) aur parallelism enable karta hai (multiple files ek saath edit hoti hain).
Cost: Task per multiple LM calls expensive ho sakti hain
Emerging solutions:
Hierarchical planning: Tasks ko subtasks mein todna taaki per-step complexity kam ho
Formal verification integration: Correctness prove karne ke liye theorem provers (Coq, Lean) use karna
Learned world models: Execution ke bina code behavior predict karna (faster iteration)
Recall 12 Saal ke Bacche ko Explain Karo
Imagine karo tum ek bahut smart robot se Lego castle banane ko kehte ho. Ek normal robot bas bricks ek pile mein dump kar deta hai (yahi code completion hai). Lekin ek code-generation agent alag hai:
Yeh tumhari instructions padhta hai ("ise tall banao drawbridge ke saath")
Yeh banana shuru karta hai, ek section at a time
Jab ek tower gir jaata hai (bug!), yeh dekhta hai ki kyun gira
Yeh ek baar phir try karta hai stronger base ke saath (debugging)
Jab tak castle perfectly nahi khada ho jaata tab tak karta rehta hai
Magic yeh hai ki robot apna kaam khud test kar sakta hai aur mistakes fix kar sakta hai—bilkul waise jaise tum Legos banate waqt karte ho! Yeh ek try ke baad give up nahi karta.
Code-generation agents one-shot generation ki jagah iterative loop kyun use karte hain?
Code generation mein high first-try failure rates hoti hain (30-70%). Iteration agent ko errors dekhne, issues debug karne, aur working solutions tak converge karne deta hai. Agar single-attempt success p=0.4 hai, to 5 iterations mein 1-(1-p)^5 se 92% success milti hai.
k independent attempts ke liye success probability ka formula derive karo jab per-attempt success rate p ho.
Ek attempt mein failure = (1-p). Saare k attempts mein failure = (1-p)^k (independence). Kam se kam ek mein success = complement = 1 - (1-p)^k.
State transitions ke liye agent loop equation kya hai?
State_t → Perception → Context_t → Planning → Action_t → Execution → State_{t+1}, jahan har state mein requirements R, code C_t, aur execution history H_t hoti hai.
Code agent execution mein history H_t mein kya hota hai?
Tuples {(c_i, o_i, e_i)} ka ek sequence jo pichle code snippets, unke outputs, aur error traces represent karta hai. Yeh agli iteration ke liye feedback provide karta hai.
Code agents test-driven development (TDD) kyun use karte hain?
1) Tests ambiguous requirements formalize karte hain, 2) Self-verification enable karte hain (agent apna kaam khud check karta hai), 3) Regression prevent karte hain (naya code purani functionality nahi todta).
Code generation ke liye pass@k metric kya hai?
Pass@k = E[1 - C(n-c,k)/C(n,k)], yeh probability hai ki n total samples mein se c correct wale k generated samples mein se kam se kam ek correct ho. Multiple attempts ke saath success rate measure karta hai.
BM25 exact keyword matches pakadti hai (e.g., function names). Embeddings semantic similarity pakadti hain (e.g., "authenticate" ≈ "login"). Hybrid score: BM25(f,q) + α·sim(e_f, e_q).
"IndexError: list index out of range" dekhne par agents kya common error recovery mistake karte hain?
Error message par overfitting karte hue blindly har jagah bounds checks add kar dena, bajay yeh trace karne ke ki index invalid kyun hai (aksar incorrect loop bounds ya pehle ki logic mein off-by-one errors hoti hain).
Complex projects ke liye multi-agent code systems single agents se zyada effective kyun hain?
Specialization quality improve karti hai (har agent architecture/implementation/testing/review ke liye optimized hai) aur parallelism enable karta hai (multiple files ek saath edit hoti hain). Agents shared workspace aur message passing ke zariye communicate karte hain.