langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
46.36k stars 6.54k forks source link

[CAN BE A BIG THING FOR DIFY] Is it possible to have crew ai or autogen like feature where agents/bots which we create with different roles communicate together and solve one problem or given case together #2315

Closed HakaishinShwet closed 7 months ago

HakaishinShwet commented 7 months ago

Self Checks

1. Is this request related to a challenge you're experiencing?

Not and issue but giving idea for very USEFUL AND POWERFUL thing for this awesome project

2. Describe the feature you'd like to see

The feature i am talking about is what makes autogen and crewai special as with help of there special feature of making multi bots/agents communicate together and maybe use different api/models to solve one task/issue together is PRETTY BIG THING and it makes the best use of multiple bots which we can also create with dify too thankfully but to truly harness the true power of multiple bots with multi roles we must make them capable to think as expert individual in particular thing(with help of system message) and work TOGETHER as individual experts of something and solve one specific issue/case together which involves deep thinking(in that case multiple different agents with different expertise can give best solution/idea) instead of directly using one bot which wont think much and will give insta response which is not something which we want(You all can see videos on crew ai and autogen if you were busy in development and didnt know about it to get better idea of what i am saying)and because of that autogen and crew ai like foss projects were build where we want better and perfectly planned detailed answer on many complex cases like for example -

this is not my example but just to help you understand this whole thing better i am taking one medium post example you can read better with this link ("https://webcache.googleusercontent.com/search?q=cache:https://medium.com/@mayaakim/crewai-a-team-of-ai-agents-that-work-together-for-you-4cc9d24e0857")

I want an agent that browse the internet, another one that can write blog posts (with at least 10 paragraphs) and a critic agent that checks and makes sure that standards that I’ve defined are met

explorer = Agent( role='Senior Researcher', goal='Find and explore the most exciting projects and companies in AI and machine learning in 2024', backstory="""You are and Expert strategist that knows how to spot emerging trends and companies in AI, tech and machine learning. You're great at finding interesting, exciting projects in Open Source/Indie Hacker space. You look for exciting, rising new github ai projects that get a lot of attention. """, verbose=True, allow_delegation=False, tools=[search_tool] )

writer = Agent( role='Senior Technical Writer', goal='Write engaging and interesting blog post about latest AI projects using simple, layman vocabulary', backstory="""You are an Expert Writer on technical innovation, especially in the field of AI and machine learning. You know how to write in engaging, interesting but simple, straightforward and concise. You know how to present complicated technical terms to general audience in a fun way by using layman words.""", verbose=True, allow_delegation=True )

critic = Agent( role='Expert Writing Critic', goal='Provide feedback and criticize blog post drafts. Make sure that the tone and writing style is compelling, simple and concise', backstory="""You are an Expert at providing feedback to the technical writers. You can tell when a blog text isn't concise, simple or engaging enough. You know how to provide helpful feedback that can improve any text. You know how to make sure that text stays technical and insightful by using layman terms. """, verbose=True, allow_delegation=True )

after these agents created as expert in different things then Let’s define 3 tasks as well that each of the agents will execute:

task_report = Task( description="""Use and summarize scraped data from subreddit LocalLLama to make a detailed report on the latest rising projects in AI. Your final answer MUST be a full analysis report, text only, ignore any code or anything that isn't text. The report has to have bullet points and with 5-10 exciting new AI projects and tools. Write names of every tool and project. Each bullet point MUST contain 3 sentences that refer to one specific ai company, product, model or anything you found on subreddit LocalLLama. Use ONLY scraped data from LocalLLama to generate the report. """, agent=explorer, )

task_blog = Task( description="""Write a blog article with text only and with a short but impactful headline and at least 10 paragraphs. Blog should summarize the report on latest ai tools found on localLLama subreddit. Style and tone should be compelling and concise, fun, technical but also use layman words for the general public. Name specific new, exciting projects, apps and companies in AI world. Don't write "Paragraph [number of the paragraph]:", instead start the new paragraph in a new line. Write names of projects and tools in BOLD. ALWAYS include links to projects/tools/research papers. """, agent=writer, )

task_critique = Task( description="""Identify parts of the blog that aren't written concise enough and rewrite and change them. Make sure that the blog has engaging headline with 30 characters max, and that there are at least 10 paragraphs. Blog needs to be rewritten in such a way that it contains specific names of models/companies/projects but also explanation of WHY a reader should be interested to research more. Always include links to each paper/ project/company """, agent=critic, )

so after we execute code with crew ai these agents will work together and 1.searches the internet for latest AI projects and trends 2.writes a blog post about it

  1. and improves the text in the blog if it fails to meet some standards according to the task we have assigned and will give the best possible blog.(Please do read from above mentioned link of medium in detail to get best idea as in that with tools which are also there in dify now thankfully can help to make this process much better, i am not pasting more stuff here because i guess this much is enough for getting basic understanding :-))

Hope to see this awesome feature asap :-)) crew ai can i guess can help you in best possible way as it is foss solution with good documentation for implementing this. atlas thanks again devs for Dify :-))

3. How will this feature improve your workflow or experience?

:-))

4. Additional context or comments

No response

5. Can you help us with this feature?

dosubot[bot] commented 7 months ago

🤖

Hello again, @HakaishinShwet! It's great to see you bringing such innovative ideas to the table.

Thank you for your detailed suggestion, HakaishinShwet. Your idea of having multiple agents with different roles working together to solve a problem is indeed a powerful concept. This kind of collaborative AI system can potentially lead to more efficient and effective solutions.

Based on the current architecture of dify, it is possible to create multiple bots/agents with different roles. This is done using the AgentExecutor class, which initializes different types of agents based on the PlanningStrategy specified in the AgentConfiguration. Each of these agents can be considered as a bot with a different role. For example, the AutoSummarizingStructuredChatAgent might be used for structured chat applications, while the AutoSummarizingOpenAIFunctionCallAgent might be used for applications that require function calls. The MultiDatasetRouterAgent and StructuredMultiDatasetRouterAgent might be used for routing tasks in multi-dataset environments. You can find more details about this in the api/core/agent/agent_executor.py file.

As for the communication between different agents/bots, dify uses a context-based approach to handle communication between different components, which could include different agents/bots. This is done using the React Context API, which allows for passing data through the component tree without having to pass props down manually at every level. You can find more details about this in the web/app/components/base/chat/chat/context.tsx file.

However, the current implementation does not provide specific details on how different agents/bots communicate with each other to solve a problem collaboratively. This is a complex problem that involves not only the communication between agents but also the coordination and management of tasks among them. It would require a significant amount of work to implement this feature, including designing a new architecture for multi-agent collaboration, developing new algorithms for task allocation and coordination, and testing the system to ensure its effectiveness and efficiency.

While this feature is not currently available in dify, your suggestion is valuable and could be considered for future development. I recommend keeping an eye on the dify repository for updates. If this feature is implemented in the future, it will be included in the release notes.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

VincePotato commented 7 months ago

Thanks for your suggestion! Dify already supports single-agent(Agent assistant) last month, but we're also keeping an eye on the development of multi-agent like crew ai and autogen as you mentioned. However, we've noticed that the maturity level of multi-agent might not be there yet. There are still quite a few issues, including the stability of the agents' reasoning and their communication with each other. We might wait a bit longer to see some solid use cases before moving forward. But still, really appreciate your useful feedback. If you have further ideas, feel free to keep the conversation going.

HakaishinShwet commented 7 months ago

@VincePotato yeah i know Dify supports single agent stuff and that is the reason why i wanted this project to bring the max capabilties of multiple single agents which can work together to solve single problem which requires deep understanding from multiple expert point of view of bots/agents and then provide perfect/practical solution which can be seriously used by us. I also have seen that many times result are not that great with crewai/autogen but still sometimes we do get very great results too and results you know very well that many times it depend on what user provides as a prompt [Prompt engineering is the REAL DEAL which not many are able to master and this creates real issue in proper solution generation and i have seen plus experienced alot, as AI has vast knowledge base but we as a user are unable to provide proper detailed prompt which ai can understand effectively and generate best possible solution according to our needs + it depends on models too like gpt 4 generates sometimes generates text more than what we want and use difficult english words plus over explain things and i personally and many have seen gpt 3.5 sometimes does give better and easy solution compared to gpt 4 plus we can talk alot on this and it wont end haha but my major point which i hope you get is that neither AI models are perfect but they are in max case still awesome tbh but in max case because of prompt engineering we dont get better or expected results,i have studied and seen alot of things regarding prompt plus how single prompt as system message can jail break gpt 3.5 and 4 and we generate uncensored or illegal things too(i have tested myself too to see the real power of it just for testing purpose only )if we want too but i am telling you this not promote such things but to show how powerful and capable prompt and as system message can be powerful and completely break every rules and regulations set by companies] . if the person gives proper explanation for what he wants and create bots with better system message which are not short but sufficient to generate view from real expert point of view, i believe will give much better results that user expected from crewai and autogen like solutions BECAUSE THEY JUST LET MULTIPLE AGENTS COMMUNICATE AND GENERATE SOLUTION TOGETHER, MAX THINGS HAVE TO BE DONE BY AI MODEL AND PROMPT ENGINEERING ONLY AT THE END. SO THEY JUST PROVIDE CAPABILITY SO I BELIEVE ITS PRETTY AWESOME AND MUCH NEEDED SOLUTION TO BE INTEGRATED WITH DIFY. i hope you get my point that max things depend on system message/prompt of agents plus in what way he ask and in what way he wants task to be done and temperature,p and n values of models also matter in best possible text generation.So its not project fault but rather prompt and some incapabilties of current ai models and above mentioned reasons for generation of poor solution so i believe you can test what i said in practical and give better prompts and temperature and other values and command well and test with different models be it open source mixtral which btw gave very good results too and some proprietary solutions like chatgpt and gemini and you will 101% see the difference.

github-actions[bot] commented 7 months ago

Close due to it's no longer active, if you have any questions, you can reopen it.

pascalwhoop commented 6 months ago

Just going to second this push. While the agent engines may be unstable, the idea of a multi agent collaboration is surely something that can already be established. If we then swamp out the model API underlying the agent's reasoning mechanism, fine. But the framework itself can already be refined and put in place

crazywoola commented 6 months ago

@pascalwhoop Have you try the 0.6.0-preview release?

daigo38 commented 4 months ago

@crazywoola Was this feature added in 0.6.0?