AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Getting TypeError: read_webpage() got multiple values for argument 'url' when passing a URL to AutoGPT Agent.

Open Satyam97 opened this issue 1 year ago • 0 comments

⚠️ Search for existing issues first ⚠️

  • [X] I have searched the existing issues, and there is no existing issue for my problem

Which Operating System are you using?

MacOS

Which version of AutoGPT are you using?

Latest Release

Do you use OpenAI GPT-3 or GPT-4?

GPT-3.5

Which area covers your issue best?

Commands

Describe your issue.

I have an agent up and running in my local. I followed the setup guide and have the latest forked master running on my local. When I pass a URL to my agent to set the context, I am encountering an error. That error has already been addressed in this issue: https://github.com/Significant-Gravitas/AutoGPT/issues/6483

Even after making this change I encountered another error: TypeError: read_webpage() missing 1 required positional argument: 'task_id'

Cause:

    async def run_action(
        self, task_id: str, action_name: str, *args: Any, **kwds: Any
    ) -> Any:
        """
        This method runs a specified action with the provided arguments and keyword arguments.

        The agent is passed as the first argument to the action. This allows the action to access and manipulate
        the agent's state as needed.

        Args:
            task_id (str): The ID of the task that the action is being run for.
            action_name (str): The name of the action to run.
            *args: Variable length argument list.
            **kwds: Arbitrary keyword arguments.

        Returns:
            Any: The result of the action execution.

        Raises:
            Exception: If there is an error in running the action.
        """
        try:
            action = self.abilities[action_name]
            return await action(self.agent, *args, **kwds)
        except Exception:
            raise

Here in run_action method task id is not sent to action function call, and read_webpage method requires task id as an argument leading to this issue.

Here is the update code:

async def run_action(
     self, task_id: str, action_name: str, *args: Any, **kwds: Any
 ) -> Any:
     """
     This method runs a specified action with the provided arguments and keyword arguments.

     The agent is passed as the first argument to the action. This allows the action to access and manipulate
     the agent's state as needed.

     Args:
         task_id (str): The ID of the task that the action is being run for.
         action_name (str): The name of the action to run.
         *args: Variable length argument list.
         **kwds: Arbitrary keyword arguments.

     Returns:
         Any: The result of the action execution.

     Raises:
         Exception: If there is an error in running the action.
     """
     try:
         action = self.abilities[action_name]
         return await action(self.agent, task_id, *args, **kwds)
     except Exception:
         raise

Post this agent can set context correctly and we receive the message

I will visit the provided webpage, extract information if necessary, and provide an answer in the requested format.

Upload Activity Log Content

No response

Upload Error Log Content

Traceback (most recent call last): File "/Users/satyam/backendProjects/AutoGPT/autogpts/falcon/forge/sdk/routes/agent_protocol.py", line 358, in execute_agent_task_step step = await agent.execute_step(task_id, step) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/satyam/backendProjects/AutoGPT/autogpts/falcon/forge/agent.py", line 183, in execute_step output = await self.abilities.run_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/satyam/backendProjects/AutoGPT/autogpts/falcon/forge/actions/registry.py", line 184, in run_action return await action(self.agent, *args, **kwds) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/satyam/backendProjects/AutoGPT/autogpts/falcon/forge/actions/registry.py", line 58, in call return self.method(*args, **kwds) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/satyam/backendProjects/AutoGPT/autogpts/falcon/forge/actions/web/web_selenium.py", line 101, in wrapper return func(*args, url=sanitize_url(url), **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: read_webpage() missing 1 required positional argument: 'task_id'

Satyam97 avatar Feb 14 '24 09:02 Satyam97