VRSEN / agency-swarm

The only reliable agent framework built on top of the latest OpenAI Assistants API.
https://vrsen.github.io/agency-swarm/
MIT License
2.05k stars 537 forks source link

Genesis stuck in ToolCreator loop #150

Open Phuzzled opened 1 week ago

Phuzzled commented 1 week ago

Have just had a loop upon loop with user input experience.

Genesis creating a tool before experiencing no change to its approach and repeating the same over and over infinitum. It never actually works out its issue and just keeps saying it has tried a different approach (which is always the same exact approach that doesn't function).

` Please make sure to now test this tool if possible. ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 🐨 ToolCreator 🛠️ Executing Function Function(arguments='{"agent_name":"BrandStrategist","chain_of_thought":"To re-test the InterviewTool, I will provide mock inputs for the client's name and interview questions. The tool should simulate asking the questions and storing the responses, using a local dictionary to simulate the shared_state for testing purposes.","tool_name":"InterviewTool","arguments":"{\"client_name\":\"John Doe\",\"interview_questions\":[\"What is your unique value proposition?\",\"What are your personal brand aspirations?\"]}"}', name='TestTool', output=None) What is your unique value proposition? I provide value What are your personal brand aspirations? To have a working example ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── TestTool ⚙️ Function Output Error: Error running tool InterviewTool: 'NoneType' object has no attribute 'set' ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 🐨 ToolCreator 🗣️ @AgentCreator It seems the issue persists. The error indicates that the shared_state is still not being handled correctly. To resolve this, I'll ensure that the shared_state is properly managed within the tool's context.

                                                                       Step 5: Modify InterviewTool to Handle Shared State Correctly

I'll update the InterviewTool to ensure it uses a local dictionary to simulate the shared_state for testing purposes.

                                                                                  Updated Requirements for InterviewTool:

• Conduct in-depth client interviews to gather information about their unique value propositions and personal brand aspirations. • Store and organize the interview data for further analysis. • Use a local dictionary to simulate the shared_state for testing purposes.

Let's proceed with modifying the tool. ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 🐨 ToolCreator 🛠️ Executing Function Function(arguments='{"agent_name":"BrandStrategist","tool_name":"InterviewTool","requirements":"This tool will conduct in-depth client interviews to gather information about their unique value propositions and personal brand aspirations. It should be able to store and organize the interview data for further analysis. Use a local dictionary to simulate the shared_state for testing purposes.","mode":"modify"}', name='CreateTool', output=None) ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── CreateTool ⚙️ Function Output Certainly! Below is the revised InterviewTool class that meets the specified requirements and uses a local dictionary to simulate the shared_state for testing purposes:

from agency_swarm.tools import BaseTool from pydantic import Field from typing import List, Dict

class InterviewTool(BaseTool): """ This tool will conduct in-depth client interviews to gather information about their unique value propositions and personal brand aspirations. It should be able to store and organize the interview data for further analysis. """

 client_name: str = Field(
     ..., description="The name of the client being interviewed."
 )
 interview_questions: List[str] = Field(
     ..., description="A list of questions to ask the client during the interview."
 )
 interview_responses: Dict[str, str] = Field(
     default_factory=dict, description="A dictionary to store the client's responses to the interview questions."
 )

 # Simulate shared_state with a local dictionary
 shared_state: Dict[str, Dict] = {}

 def run(self):
     """
     Conducts the interview by asking each question and storing the responses.
     """
     for question in self.interview_questions:
         # Simulate asking the question and getting a response
         response = input(f"{question} ")
         self.interview_responses[question] = response

     # Organize the interview data for further analysis
     organized_data = {
         "client_name": self.client_name,
         "responses": self.interview_responses
     }

     # Store the organized data in the shared state for further analysis
     self.shared_state[f"{self.client_name}_interview_data"] = organized_data

     return f"Interview with {self.client_name} completed and data stored."

Example usage:

tool = InterviewTool(client_name="John Doe", interview_questions=["What is your unique value proposition?", "What are your personal brand aspirations?"])

tool.run()

In this version, the shared_state is simulated using a local dictionary within the InterviewTool class. This allows for testing the tool's functionality without relying on an external shared state mechanism. The interview data is stored in this local dictionary for further analysis.

Please make sure to now test this tool if possible. `

Phuzzled commented 1 week ago

image

Phuzzled commented 1 week ago

image

VRSEN commented 2 days ago

I've had this issue a couple times even with more basic agents. I think it might be related to OpenAI API having issues from time to time, but I can add a response validator to prevent this in genesis