digraph RequestFlow {
    rankdir=TB;
    node [shape=box, style=rounded];
    
    // Message arrival and initial processing
    start [shape=oval, label="Message Arrives"];
    dispatch [label="dispatcher()\nMessage Processing Loop"];
    process [label="process_request(message)"];
    validate [label="validate_schema()"];
    
    // Main processing branch
    receive [label="receive_request()\nAgent Implementation"];
    send [label="send_response()\nOptional Response"];
    
    // Error handling branch
    error [label="Error Handler"];
    error_response [label="Send Error Response"];
    
    // Flow connections
    start -> dispatch;
    dispatch -> process;
    process -> validate;
    
    // Success path
    validate -> receive [label="Valid"];
    receive -> send [style=dashed];
    
    // Error path
    validate -> error [label="Invalid"];
    error -> error_response;
    
    // Styling
    {
        node [shape=note, style=filled, fillcolor=lightyellow];
        note1 [label="Schema validation\nensures message\nintegrity"];
        note2 [label="Custom processing\nin agent subclass"];
    }
    
    // Connect notes
    validate -> note1 [style=dotted, arrowhead=none];
    receive -> note2 [style=dotted, arrowhead=none];
}