autogen
                                
                                 autogen copied to clipboard
                                
                                    autogen copied to clipboard
                            
                            
                            
                        [Issue]: no docs on how to catch executor exceptions (or if possible in "speaker_selection_method")
Describe the issue
When UserProxyAgent runs code generated by a "coder" agent it throws an exception when it is invalid code. How can we catch such exceptions (preferably in the speaker_selection_method function) so that we can let the previous agent (coder) retry?
Steps to reproduce
try the sample code on page https://microsoft.github.io/autogen/docs/topics/groupchat/customized_speaker_selection
when the code is not correct the chain fails and does not recover
Screenshots and logs
No response
Additional Information
No response
Sry for being lazy and not reading well, but changing this line:
    ...
    elif last_speaker is executor:
        if messages[-1]["content"] == "exitcode: 1":
            # retrieve --(execution failed)--> retrieve
            return coder
    ...
to:
    ...
    elif last_speaker is executor:
        if messages[-1]["content"].startswith("exitcode: 1"):
            # retrieve --(execution failed)--> retrieve
            return coder
    ...
is surely helping out, as the latest version is obviously verbose and also prints the output...
PR welcomes! We can add a test case for this.