diff --git a/autogen/agentchat/conversable_agent.py b/autogen/agentchat/conversable_agent.py index 1c875da84694..87845f910d17 100644 --- a/autogen/agentchat/conversable_agent.py +++ b/autogen/agentchat/conversable_agent.py @@ -627,6 +627,8 @@ def generate_code_execution_reply( # if no code blocks are found, continue for i in range(min(len(messages), last_n_messages)): message = messages[-(i + 1)] + if not message["content"]: + continue code_blocks = extract_code(message["content"]) if len(code_blocks) == 1 and code_blocks[0][0] == UNKNOWN: continue