The Agentic Deadlock

Difficulty: HARDID: agent-deadlock-detect

The Scenario

You have built a Multi-Agent System (MAS) to book flights:

  1. BookingAgent: Finds flights and asks PaymentAgent to pay.
  2. PaymentAgent: Needs an Invoice ID before paying.
  3. 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:

  1. Track the conversation hash (or state history).
  2. Detect Semantic Repetition: If the same exchange happens 3 times, intervene.
  3. Circuit Break: Raise a DeadlockError to 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