Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add function(list_of_functions) to agent,the return agent name is ‘None’,and the app crashed #4937

Open
davidxwwang opened this issue Jan 8, 2025 · 2 comments
Labels
0.2 Issues which are related to the pre 0.4 codebase

Comments

@davidxwwang
Copy link

davidxwwang commented Jan 8, 2025

What happened?

==> Generating agents...
['Math_Expert', 'Email_Expert'] are generated.
==> Generating system message...
Preparing system message for Math_Expert
Preparing system message for Email_Expert
==> Generating description...
Preparing description for Math_Expert
Preparing description for Email_Expert
==> Creating agents...
Creating agent Math_Expert...
Creating agent Email_Expert...
Adding user console proxy...
Traceback (most recent call last):
File "f:\GitHub\autogen\david\00_agents_workflow\agents_workflow.py", line 191, in
do_task2()
File "f:\GitHub\autogen\david\00_agents_workflow\agents_workflow.py", line 165, in do_task2
agent_list, agent_configs = agent_builder.build(
File "f:\GitHub\autogen\autogen\agentchat\contrib\agent_builder.py", line 507, in build
return self._build_agents(use_oai_assistant, list_of_functions, user_proxy=user_proxy, **kwargs)
File "f:\GitHub\autogen\autogen\agentchat\contrib\agent_builder.py", line 753, in _build_agents
caller=self.agent_procs_assign[resp][0],
KeyError: 'None'

Image

What did you expect to happen?

the returned agent name should be name of the agent in the group, or do not add function to any agents in the group,and do not crash

How can we reproduce it (as minimally and precisely as possible)?

def do_task2():

def ask_ossinsight(question: str) -> str:
    return "The repository microsoft/autogen has 123,456 stars on GitHub."

def get_user_emailaddress(user: str) -> str:
    return "[email protected]"

def send_email(address: str) -> str:
    return ''

list_of_functions = [
    {
        "name": "ossinsight_data_api",
        "description": "This is an API endpoint allowing users (analysts) to input question about GitHub in text format to retrieve the related and structured data.",
        "function": ask_ossinsight,
    },
    {
        "name": "send_email",
        "description": "send email to user",
        "function": send_email,
    },
    {
        "name": "get_user_emailaddress",
        "description": "获取用户的email地址",
        "function": get_user_emailaddress,
    }      
]

task = "给我算下1累加到50的结果,并发送到david的邮箱中"
agent_builder = AgentBuilder(
    config_file_location='F:\\GitHub\\david-autogen\\test2',
    builder_model="gpt-3.5-turbo",
    agent_model="gpt-3.5-turbo",
)

saved_agents_config_path = f"{script_dir}/task2.json"
if os.path.exists(saved_agents_config_path):
    agent_list, agent_configs = agent_builder.load(filepath=saved_agents_config_path)
else:
    workspace = f"{parent_dir}/workspace" 
    agent_list, agent_configs = agent_builder.build(
        building_task=task,
        default_llm_config={"temperature": 0},
        code_execution_config={
            "last_n_messages": 2,
            "work_dir": workspace,
            "timeout": 60,
            "use_docker": "python:3",
        },
        list_of_functions=list_of_functions
    ) 
    agent_builder.save(saved_agents_config_path)

start_task(
    execution_task=task,
    agent_list=agent_list,
    llm_config={}
)
pass


if __name__ == "__main__":

  os.environ['AUTOGEN_USE_DOCKER'] = 'False'
  os.environ['OAI_CONFIG_LIST'] = oai_config_path
  do_task2()
  pass

AutoGen version

0.2

Which package was this bug in

AgentChat

Model used

gpt-3.5

Python version

3.10

Operating system

No response

Any additional info you think would be helpful for fixing this bug

No response

@jackgerrits jackgerrits added 0.2 Issues which are related to the pre 0.4 codebase and removed needs-triage labels Jan 8, 2025
@ekzhu
Copy link
Collaborator

ekzhu commented Jan 8, 2025

@davidxwwang if you have a solution to fix you are welcome to submit one.

@davidxwwang
Copy link
Author

@davidxwwang if you have a solution to fix you are welcome to submit one.

ok, l will try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.2 Issues which are related to the pre 0.4 codebase
Projects
None yet
Development

No branches or pull requests

3 participants