The Agentic Deadlock
Difficulty: HARDID: agent-deadlock-detect
The Scenario
You have built a Multi-Agent System (MAS) to book flights:
- BookingAgent: Finds flights and asks PaymentAgent to pay.
- PaymentAgent: Needs an Invoice ID before paying.
- BookingAgent: Cannot generate Invoice ID until payment is confirmed.
The Loop:
- BookingAgent: "Please pay."
- PaymentAgent: "I need an Invoice ID first."
- BookingAgent: "I cannot generate ID until you pay."
- PaymentAgent: "I need an Invoice ID first."
They are polite, functional, and stuck forever.
The Goal
Implement a Deadlock Detector:
- Track the conversation hash (or state history).
- Detect Semantic Repetition: If the same exchange happens 3 times, intervene.
- Circuit Break: Raise a
DeadlockErrorto stop the madness.
Requirements:
- Implement
run_multi_agent_system(agent_a, agent_b). - Maintain a history of interactions.
- If a circular pattern is detected, stop execution.
solution.py
Loading...
⚠️ Do not include PII or secrets in your code.
SYSTEM_LOGS
5/5
// Waiting for execution trigger...
PREVIEW MODE — SOLVE PREVIOUS MISSIONS TO UNLOCK