88 / 108 · 03 Agentic Testing Architectures · Multi-Agent Communication Protocols← prev⊞ allnext →☰ Read as one page
12.3Error Propagation
When one agent fails, the system must handle it gracefully. There are three strategies:
Strategy 1: Skip and Continue
async def run_pipeline(self, modules: list[str]):
for module in modules:
try:
analysis = await self.code_analyzer.analyze(module)
tests = await self.test_generator.generate(analysis)
results = await self.test_runner.run(tests)
if results.has_failures:
fixed = await self.test_fixer.fix(tests, results)
results = await self.test_runner.run(fixed)
except AgentTimeoutError as e:
self.log.warning(f"Agent timeout on {module}: {e}")
self.dead_letter_queue.append(module) # Retry later
continue
except Exception as e:
self.log.error(f"Unexpected failure on {module}: {e}")
self.alert_human(module, e) # Escalate
continue
Use when: Modules are independent. Failure on one should not block others.
Strategy 2: Fail Fast
async def run_pipeline(self, modules: list[str]):
for module in modules:
try:
analysis = await self.code_analyzer.analyze(module)
tests = await self.test_generator.generate(analysis)
results = await self.test_runner.run(tests)
except AgentBudgetExceeded as e:
self.log.error(f"Budget exceeded on {module}: {e}")
break # Stop processing ALL modules
Use when: A budget or rate limit error means continuing will fail anyway.
Strategy 3: Fallback Agents
async def analyze_with_fallback(self, module: str):
"""Try the primary analyzer, fall back to a simpler one."""
try:
return await self.primary_analyzer.analyze(module)
except AgentTimeoutError:
self.log.warning(f"Primary analyzer timed out, using fallback")
return await self.fallback_analyzer.analyze(module)
Use when: You have a simpler, faster agent that produces lower-quality but acceptable results.