OpenAI

Verified interview challenge

Refactor a chat bot system

Improve a working chat service's structure while keeping its conversations exactly consistent.

Unlock with Full Access

The challenge

A working chat service keeps its bot logic and state inside one function. The bots interact through away messages, meeting commands and a running tally of reactions, with a defined order for replies.

Refactor the service into bot classes, then replace direct bot coupling with a synchronous event bus. Users should see the same conversation throughout, so changes to structure must preserve command handling, shared behaviour and the order in which effects occur.

What you'll practise

  • Behaviour preservation

    Separate structural changes from changes users would see in the conversation.

  • Event-driven coordination

    Replace direct bot dependencies while retaining ordering and state semantics.

Your coding workspacePreview
Current partFurther parts unlock as you progress
solution.pyPython 3.13
# Build on your implementation

# Run checks for the current part

# Full starter code included
Current-part checks

Run your code to see results.

The complete sequence, starter code and checks are included with Full Access.