Overview of Multi AI-Agent Systems
Use cases and verticals
Long tail use cases show general patterns:
- Research
- Analysis
- Summary
- Reporting
- Push to an existing systems
Then it goes with a description of the main elements of CrewAI that you can check from the first course
A new addition is the ability to create Agents and Tasks using yaml files.
Automate Project: Planning, Estimation and Allocation
Agents | Tasks |
---|---|
Project Planner | Task breakdown |
Estimation Analyst | Time Estimation |
Allocation Strategist | Resource allocation |
The output will be a project plan with tasks/allocations and milestones with the people responsible. Eventually we will be able to push the project to Trello or Jira.
It uses gpt-4o-mini for reduced costs.
It loads the agents and tasks with yaml files. For structured output it uses pydantic classes.
Internal and external integrations
Sometimes you will have integrations before calling the Crew, that is regular code.
The problem is when the crew needs to call external systems such as applications, cloud services or internal systems such as databases or internal apps. So they might be needing to search the internet or check a calendar or reply an email. They may also need to rag search, or run an sql query or trigger a side effect. Somtimes you will like to allow agents to write custom code.
Real time reaction and self healing capabilities. If the tool fails, the agents will be able to pick up the error and try differently.
Building progress report for project
Automates the progress report of a project
Agents | Tasks | Tools |
---|---|---|
Data collector | Understand project | |
Project Analyst | Analyze progress | Trello Tool |
Project Analyst | Compile report |
Complex crew setups
In this video the instructor shares how in this lesson we will talk about connecting multiple crews together using conditional logic, and when to pass information between crews.
ADD Screenshot of crews of agents
Say you want to research on different topics, these could be done in parallel, as the multiple sources dont depend on each other. For instance on a company and in an industry. Then you want to do some analysis using data from both rsearchers, using context attribute. Then you can do a summary. In the final full report we might want to take into account all analysis and summarization.
Flows unlocks many use cases. Flows allows you to have crews and executing python code before, during or after crew running.
Agentic sales pipeline
We will use flows to build and agentic sales pipleine. We are going to have lead information, enrich it, score it and then write an email for this lead.
We will be starting loading leads from a database with regular python. Then we weill use a Lead scoring crew. This crew will search information about this lead, is going to understand how to be scoring and how good of a match this is for the product and business youa are trying to sell them. Then we are going to save this data to another database which can be non-agentic python. Then we might want to have another crew devoted to write an email to the high scored leads. We will wrap all of this within a flow, that will go thorugh all the steps and it also has a state where it can store information that it can use during the flow execution or after the execution. The sales pipelines would be:
- Research a potential lead
- Score them given the person and company
- If a qualified lead then a proper initial email
We could create a diagram of this flow as follows:
The lead scoring crew will pass a highly structured output for the high score leads so the email writing crew is able to draft and optimize an email for engagement.
Intro to flows. Two functions:
- Listen
- Start
The start annotation will be the initial function, for instance pulling leads from a database.
Following the data fetching a new function for lead scoring will be listening to the fetch_leads start function. It also shows how the score_leads function is calling a kickoff_for_each of the fetched leads. The functions may also save information in a self.state variable.
You can plot flows to understand the flow execution plan.
For complex flows we may want to use annotations such as:
- and_: Waits for two functions to finish before executing the other.
- router: it allows you to choose different paths for the flow, executing different functions for each path
Performance optimization
Favor speed or quality, but we aim for consistency. Speed usually comes from smaller models, that are cheaper to run. In terms of quality, we usually use more capable models such as GPT.
In any case, we need consistency of the system in terms of speed or quality. crewAI incorporates the test command that allows to use a Judge LLM to evaluate and get a final report of the agents, the tasks and the scores. Note of the author: Watchout with this form of evaluating agents and LLMs, follow Hamel Hussain recommendations: Your AI Product Needs Evals
crewAI now also incorporate a train feature. When you hit train, the crew will run and for each task, it will stop and ask for feedback. Once you are doing writing feedback it will be fed to a judge LLM which will extract the specific feedback for each task and it will push that into the crew Memory. So in next rounds the agents will rely on memory to tune how they respond for each task.
Support data insight analysis
We will be using support data. We will be trying to answer:
- Who are the customers?
- Who is helping from our team?
- Issue types?
- Issue descriptions?
- Frustrations?
It will be able to plot visualizations of the data.
Agents and tasks included:
In this case, the crew will do:
- Go over a series of data from support
- Generate suggestions for improvements
- Organize the data into tabular insights
- Plot charts to visualize trends
- Write a full final report on the analysis
In this case it will be use GPT-4o as we need a powerful model to code and work. For the chart generation, it activates the allow_code_execution option.
When it is set to true, it isolates the code writing and execution in docker environment.
Now let’s test the crew by using gpt-4o as a judge.
After scoring the tasks, we might want to train it by providing feedback. Although they call it training, it seems a way to iterate your prompts, which then will be included in the memory. For instance, in the video they ask for better suggestions, include comparison results in tables and also integrate the plots at the end of the report.
Multi-model use cases
You can have agents powered by smaller models while other models can be powered by larger models or fine tuned models.
Content creation at scale
In this lecture we build a crew that writes content on trending topics so it will be using Serper to connect to the internet and also RAG for Web pages. It will also use Groq for really speedy market and data analyst agents.
Content creation at scale:
- Search for the latest news around a financial topic
- Search and analyze any market data around it
- Create content for social media
- Create a full blog post on the topic
- Review the blog to make sure it’s good