autogen icon indicating copy to clipboard operation
autogen copied to clipboard

[Issue]: Raising error outside localhost (unable to load configuration from)

Open RodrigoOSiqueira opened this issue 2 years ago • 3 comments

Describe the issue

I'm making tests locally and everything works like a charm, but after making a deploy I started to see the following error: unable to load configuration from.

Here's my core logic:

    def send_message(self, input: CartanoInput) -> CartanoOutput:
        config_list = self._build_config_list()

        assistant = AssistantAgent(
            "assistant",
            llm_config={"config_list": config_list},
            human_input_mode="NEVER",
            max_consecutive_auto_reply=1,
            system_message=self._build_system_message(),
        )

        user_proxy = UserProxyAgent(
            "user_proxy",
            code_execution_config={"work_dir": "coding.py", "use_docker": False},
            human_input_mode="NEVER",
            max_consecutive_auto_reply=2,
        )

        message = self._build_user_proxy_message(input)
        response = user_proxy.initiate_chat(
            assistant,
            message=message,
        )
        print(f"UP_RESPONSE: {response}")

        if response and response.summary:
            output_with_exitcode_0 = response.summary.replace("exitcode: 0 (execution succeeded)\nCode output: ", "")
            if "exitcode: 1" in output_with_exitcode_0:
                output_with_exitcode_1 = response.summary.replace("exitcode: 1 (execution failed)\nCode output: ", "")

            return (
                CartanoOutput(cartano_message=output_with_exitcode_0)
                if output_with_exitcode_0
                else CartanoOutput(cartano_message=output_with_exitcode_1)
            )
        else:
            return CartanoOutput(cartano_message="Sorry we couldn't process your request. Please try again later.")

Basically the idea of the project is feed the AssistantAgent with an API doc, then it will create the request for the UserProxyAgent to call it. I can see the logs of the conversation between the agents, but when UPA tries to run the code that error is raised.

Steps to reproduce

No response

Screenshots and logs

Full conversation between agents:

What is the number of stakeholders? This is the header {***}. This is the https host: ***

assistant (to user_proxy):

To obtain the number of stakeholders for your corporation with ID 7, I will make a request to the appropriate endpoint based on your provided information. The response will contain the total count of stakeholders.

import requests

# Define the headers for your request
headers = {
    ***
}

# Endpoint to get the number of stakeholders
url = "***"

# Making the GET request
response = requests.get(url, headers=headers)

# Parsing the response
if response.status_code == 200:
    data = response.json()
    print(f"The number of stakeholders is: {data['count']}")
else:
    print("Failed to fetch the data, status code:", response.status_code)

Execute this Python script to make a request to the endpoint and obtain the number of stakeholders. Please note that because we're accessing a test domain (app.foiled-wildebeest.test.carta.rocks), the actual request may only work within a specific setup or VPN if it's a domain used for internal testing purposes.


EXECUTING CODE BLOCK 0 (inferred language is python)... user_proxy (to assistant):

exitcode: 1 (execution failed) Code output: unable to load configuration from


Additional Information

No response

RodrigoOSiqueira avatar Apr 17 '24 15:04 RodrigoOSiqueira

This looks like something in the generated code. Have you tried running the generated code directly?

ekzhu avatar Apr 17 '24 17:04 ekzhu

So, if I get this right, the Ai generats a python code that needs to be run to fetch the users, but this code execution is failing on a dependency import. Could it be that the dependencies are not being properly installed before running the code?

MarceloCSaad avatar Apr 18 '24 15:04 MarceloCSaad

I tried to run the code via shell and that worked! So that's not a problem with the code generated at all.

RodrigoOSiqueira avatar Apr 19 '24 13:04 RodrigoOSiqueira