microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
30.41k stars 4.43k forks source link

[Issue]: Human Input Mode behavior different in python vs .net #3163

Closed rakshitha-yalamanchili-5 closed 6 days ago

rakshitha-yalamanchili-5 commented 1 month ago

Describe the issue

I have noticed a difference in Autogen's behavior in python vs dotnet.

A chat between agents in python always asks user feedback for user proxy agent where user can choose to continue or provide feedback

Chat in dotnet does not ask for user input despite user input mode is set to always when tool execution is involved. Assistantagent returns tool function call and userproxyagent executes the tool without asking for user input. Why is this behavior different?

Steps to reproduce

  1. python sample assistant = AssistantAgent( "assistant", llm_config={"config_list": [{"model": "", "api_key": "", "api_type":"", "base_url":"", "api_version":""}]}, system_message= "You are a useful AI assistant. For coding tasks, only use the functions you have been provided with. Return TERMINATE when your task is done" ) user_proxy = UserProxyAgent( "userproxyagent1", is_termination_msg=lambda msg: msg.get("content") is not None and "TERMINATE" in msg["content"], code_execution_config={"executor": executor} ) register_function( calculator, caller=assistant,
    executor=user_proxy, name="calculator",
    description="A simple calculator",
    ) This chat between above agents always asks user feedback for user proxy agent where user can choose to continue or provide feedback

  2. Following is code in dotnet:

var agent = new AssistantAgent( name: "assistant", systemMessage: "You are a useful AI assistant. For coding tasks, only use the functions you have been provided with. Return TERMINATE when your task is done", llmConfig: new ConversableAgentConfig { Temperature = 0, ConfigList = new[] { gpt35Config, }, FunctionContracts = [tools.CalculatorFunctionContract] } ).RegisterPrintMessage();

var userProxyAgent = new UserProxyAgent( name: "user", humanInputMode: HumanInputMode.ALWAYS, functionMap: new Dictionary<string, Func<string, Task>> { { tools.CalculatorFunctionContract.Name, tools.CalculatorWrapper }, } ).RegisterPrintMessage(); The above code, does not ask for user input despite user input mode is set to always when tool execution is involved. Assistantagent returns tool function call and userproxyagent executes the tool without asking for user input. Why is this behavior different?

Screenshots and logs

No response

Additional Information

No response

LittleLittleCloud commented 1 month ago

Hi, this is because in AutoGen.Net, the human input is processed after function call.

To keep the same behavior with AutoGen, we can update the ConversableAgent by

LittleLittleCloud commented 6 days ago

close due to won't fix