Agentic Design Patterns The core idea is for the AI to review its work for aspects such as correctness, style, and efficiency. Following this review, the AI is prompted to provide constructive criticism on how its own output could be improved. For instance, if an AI is asked to write code, a reflection step would involve asking the AI to check that code for errors or inefficiencies and suggest revisions. The AI can then potentially identify and fix mistakes, thereby improving its final output. 1. Reflection This process is part of a more circular, iterative workflow, contrasting with a simple start-to-finish approach. While a user can prompt the AI to perform this reflection, it is also possible to create another AI whose task is specifically to prompt the original AI to go through this reflection process, which is a step towards a multi-agent framework. 2. Tool Use The core idea behind Tool Use is to empower the AI to perform specific actions or access information beyond its core language model capabilities. By integrating tools, the AI can break down complex tasks into smaller, executable steps and leverage specialized functions. For instance, an AI tasked with providing information about a product might use a web search tool to find current reviews, or an AI planning a trip might use tools like Google Maps or Skyscanner. Web search tools (for gathering up-to-date information or reviews) Code execution tools (for performing calculations or generating code) Object detection tools (for analyzing images) Web generation tools Access to email or calendar systems (for scheduling or managing events) Specialized databases or APIs Examples of tools that can be integrated include: AI's ability to complete tasks accurately and effectively, often leading to much better results compared to simply asking the AI to generate an answer directly. 3. Planning and Reasoning Pre requisite for Multi Agent Design patterns 1. Single AI Agent A single AI agent is typically characterized by four key components: Task: This defines the specific objective or goal the agent is meant to achieve. Answer: This specifies the desired output or format of the result the agent should provide. Model: This refers to the underlying AI model (such as Anthropic Claude, GPT-4o mini, or others) that the agent utilizes for processing information and generating responses. Tools: These are specific capabilities or external resources the agent can access and use to help accomplish its task, such as web search, calendar access, or code execution. Simple way to rememeber it Simple Multi Agent Two agent working towards a single goal Writer Agent can write the BLog Article Editor Agent can provide feedback on the Blog Agent can have their tools but A task can have its own tools Agents can perform different tasks or work together on a single task Multi Agent Design patterns 1. Sequential Pattern In this pattern, one agent performs a specific task and then passes its output directly to the next agent in the chain. This next agent then uses the output from the previous agent as its input to perform its own task, and this process continues down the line of agents until the overall task is completed. A clear example of the sequential pattern is AI-powered document processing. You could have a first agent designed to extract text from scanned documents. 2. Hierarchical Agent System In this design, the manager agent receives an overarching task and delegates specific parts of it to various sub-agents. Each sub-agent is typically specialized and equipped with particular tools or access to data necessary for its assigned task. After completing their individual tasks, the sub-agents report their results back to the manager agent. The manager agent is then responsible for compiling these results, aggregating the information, and potentially passing it along for further processing or decision-making. An illustrative example of this pattern is writing a business decision-making report. A manager AI agent receives the task of generating the report. It delegates sub-agent tasks such as monitoring market trends, analyzing internal customer sentiment using internal databases, and tracking internal company metrics. Each sub-agent performs its specialized function and reports its findings back to the manager agent. The manager agent combines these diverse insights, potentially handing the compiled information to another agent focused on decision-making to produce the final report and business recommendation. 3. Hybrid System A critical aspect of the hybrid system, particularly in dynamic environments like autonomous driving, is the continuous feedback loop. The sub-agents don't just report information back to the top-level agent; they also communicate with each other and constantly update the top-level agent as internal and external conditions change. This design pattern is frequently used in robotics, navigation systems, and adaptive AI systems where there are many interacting components and constantly changing circumstances. In this pattern, agents can collaborate in a top-down structure, similar to the hierarchical model, while also interacting sequentially, much like the sequential pattern. A common example of this pattern is found in autonomous vehicles. A high-level AI agent might be responsible for overall route planning and traffic strategy. 4. Parallel Agent Design Systems The primary goal of using parallel agents is often to enhance processing speed by leveraging simultaneous execution. A common example of this design is in AI systems used for large-scale data analysis. Here, agents can each take on chunks of the data, process their assigned portions separately, and then merge the results together at the end. In this setup, agents work independently on separate work streams at the same time. 5. Asynchronous Multi-Agent System Executes Tasks independently and at different times. Better handles uncertain condition than Sequential and Parallel For instance, one agent might continuously monitor network traffic in real time. A second agent could focus on identifying suspicious usage patterns by analyzing user behavior or system logs. A third agent might perform random sampling and test different use cases or potential vulnerabilities. When any of these agents detects something anomalous or potentially malicious, they flag the event, triggering further actions within the system. This independent yet collaborative approach allows the system to maintain vigilance across different aspects of the network simultaneously. A practical example of an asynchronous multi-agent system in the context of cyber attack detection is an AI-powered cyber security threat detection system. In this setup, multiple agents work in parallel without strict synchronization. mostly for this section. And the biggest takeaway that I got from this, like assuming you want to be building something thing, using AI agents, something that is useful for other people, you're building up a business is from this, Why Combinator video, where they say that, for every SAS or software as a service company, there will be a corresponding AI agent company. Let me just like repeat that, because this is like huge guidance in terms of what to build for every software, as a service company, like all the software service companies that we see today, there will be a corresponding AI agent version of that. So if you don't know what to build or what to do right now, and you want to play around with a agents, just literally take a SAS company, and then think about how do I make that into an AI agent company? Just ask Chachu, BT, what are some top SAS companies says? Adobe Microsoft Salesforce, shopify Link tree, canva, squarespace, and on and on and on and on. There are so many, literally every company that is a SASs unicorn, you could imagine there's a vertical AI unicorn equivalent. I really think that piece of advice is literal gold. Let me know in the comments if there's a specific AI agent that you're interested in building or an AI agent business. All right, we have come to the end of this video. Thank you so much for watching through it. As promised. Here is a little assessment. If you can answer all What are AI Agents? AI Agents Fundamentals In 21 Minutes AI Agents: A Deep Dive This blog post summarizes a video on AI agents, covering their definition, design patterns, multi-agent architectures, and no-code implementation. It also explores opportunities for building AI agent-based businesses. What are AI Agents? Definition: An AI agent is not simply asking an AI to perform a single task (one-hot prompting). Instead, it involves breaking down a complex task into smaller steps, iteratively refining the output through a circular process of thinking, researching, and revising. Levels of AI Agents: Non-Agentic Workflow: A simple, linear process from start to finish. Agentic Workflow: An iterative, circular process involving multiple steps and revisions. Truly Autonomous AI Agent: An AI that independently determines steps, tools, and revisions to achieve an output (not yet fully realized). Agentic Design Patterns Four key agentic design patterns are: Reflection: The AI carefully examines its own output , identifying and correcting errors or improving efficiency. This can be enhanced by using a second AI to provide feedback. Tool Use: Equipping the AI with tools (web search, code execution, access to calendars and emails) allows it to break down tasks and execute specific steps , leading to more comprehensive and accurate results. Example: Using a web search tool to gather information before answering a question. Planning and Reasoning: The AI determines the necessary steps and tools to complete a given task. Example: Generating an image based on a description and then describing the image using text-to-speech. Multi-Agent Systems: Employing multiple AIs with specialized roles to collaborate on a task, often yielding better results than a single AI. Analogy: A team of humans working together on a project. Mnemonic: R ed T urtles P aint M urals ( R eflection, T ool Use, P lanning, M ulti-agent systems) Design Pattern Description Example Reflection AI examines its own output for errors and improvements AI checks code for correctness and style Tool Use AI uses external tools to complete tasks AI uses web search to answer questions Planning & Reasoning AI determines steps and tools needed AI generates an image and describes it Multi-Agent Systems Multiple AIs collaborate on a task Multiple AIs work together to write a report Multi-Agent Architectures Single AI Agent: Composed of a task , answer , model , and tools . Mnemonic: T ired A lpacas M ix T ea. Simple Multi-Agent System: Two or more AI agents collaborating on a task. Example: A writer agent and an editor agent. Multi-Agent Design Patterns: Sequential: Agents work in a linear sequence, passing output to the next agent. Hierarchical: A manager agent supervises and coordinates multiple sub-agents. Hybrid: Combines sequential and hierarchical structures. Parallel: Agents work independently on different parts of a task simultaneously. Asynchronous: Agents work independently at different times. No-Code Implementation with n8n A no-code tool like n8n can be used to create AI agent workflows. An example is a Telegram-based AI assistant that prioritizes tasks and schedules calendar events using OpenAI's GPT-4 and Google Calendar integration. Opportunities for AI Agents For every Software as a Service (SaaS) company, there's a potential corresponding AI agent company. Identifying existing SaaS companies and envisioning AI agent versions presents numerous business opportunities. Key Takeaways This video provides a comprehensive overview of AI agents, from their basic definition to complex multi-agent systems. The emphasis on no-code implementation makes the technology accessible to a wider audience. The identification of business opportunities based on existing SaaS models highlights the significant potential of AI agents in various industries.