@@ -382,6 +382,53 @@ def test_termination():
382
382
assert len (groupchat .messages ) == 3
383
383
384
384
385
+ def test_next_agent ():
386
+ agent1 = autogen .ConversableAgent (
387
+ "alice" ,
388
+ max_consecutive_auto_reply = 10 ,
389
+ human_input_mode = "NEVER" ,
390
+ llm_config = False ,
391
+ default_auto_reply = "This is alice speaking." ,
392
+ )
393
+ agent2 = autogen .ConversableAgent (
394
+ "bob" ,
395
+ max_consecutive_auto_reply = 10 ,
396
+ human_input_mode = "NEVER" ,
397
+ llm_config = False ,
398
+ default_auto_reply = "This is bob speaking." ,
399
+ )
400
+ agent3 = autogen .ConversableAgent (
401
+ "sam" ,
402
+ max_consecutive_auto_reply = 10 ,
403
+ human_input_mode = "NEVER" ,
404
+ llm_config = False ,
405
+ default_auto_reply = "This is sam speaking." ,
406
+ )
407
+ agent4 = autogen .ConversableAgent (
408
+ "sally" ,
409
+ max_consecutive_auto_reply = 10 ,
410
+ human_input_mode = "NEVER" ,
411
+ llm_config = False ,
412
+ default_auto_reply = "This is sally speaking." ,
413
+ )
414
+
415
+ # Test empty is_termination_msg function
416
+ groupchat = autogen .GroupChat (
417
+ agents = [agent1 , agent2 , agent3 ], messages = [], speaker_selection_method = "round_robin" , max_round = 10
418
+ )
419
+
420
+ assert groupchat .next_agent (agent1 , [agent1 , agent2 , agent3 ]) == agent2
421
+ assert groupchat .next_agent (agent2 , [agent1 , agent2 , agent3 ]) == agent3
422
+ assert groupchat .next_agent (agent3 , [agent1 , agent2 , agent3 ]) == agent1
423
+
424
+ assert groupchat .next_agent (agent1 , [agent1 , agent3 ]) == agent3
425
+ assert groupchat .next_agent (agent3 , [agent1 , agent3 ]) == agent1
426
+
427
+ assert groupchat .next_agent (agent2 , [agent1 , agent3 ]) == agent3
428
+ assert groupchat .next_agent (agent4 , [agent1 , agent3 ]) == agent1
429
+ assert groupchat .next_agent (agent4 , [agent1 , agent2 , agent3 ]) == agent1
430
+
431
+
385
432
if __name__ == "__main__" :
386
433
# test_func_call_groupchat()
387
434
# test_broadcast()
@@ -390,4 +437,5 @@ def test_termination():
390
437
# test_speaker_selection_method()
391
438
# test_n_agents_less_than_3()
392
439
# test_agent_mentions()
393
- test_termination ()
440
+ # test_termination()
441
+ test_next_agent ()
0 commit comments