Agentic vs non-agentic workflows for GenAI Applications

--

In a non-agentic workflow (Zero-shot), the user types a prompt, and the language model generates an answer. You can’t go backspace and fix it until it returns the answer, or you can validate or enhance the answer until it returns and use a follow-up prompt. This is like writing a code without having the ability to change it in first try. This is why it is called Zero-shot. Still lot of existing LLMs do a pretty good join in creating this code. Now think of having an assistant take the code, validate it, fix it, and rerun it for you. This is where agentic workflow comes in to rescue.

In contrast, an agentic workflow is much more iterative. The language model may do some thinking, revise its output, and then do some more thinking, iterating this process through several times. This delivers remarkably better results. E.g, a coding agent can create a code for a given topic, and you can have testing agent that takes this code, run it with required libraries and you can have another agent called deploy agent to automatically deploy this to upstream environments. Another example is a search agent can bring in the latest news and an analysis agent can analyze the data and editor agent can edit and create a blog and a publisher agent can take it and publish or email the final content. Here is a simple example flow.

Sample Agent workflow

Here is an example of how CrewAI uses Agents to do the work.

from crewai import Agent
from crewai_tools import SerperDevTool
search_tool = SerperDevTool()

# Creating a senior researcher agent with memory and verbose mode
researcher = Agent(
role='Senior Researcher',
goal='Uncover groundbreaking technologies in {topic}',
verbose=True,
memory=True,
backstory=(
"Driven by curiosity, you're at the forefront of"
"innovation, eager to explore and share knowledge that could change"
"the world."
),
tools=[search_tool],
allow_delegation=True
)

# Creating a writer agent with custom tools and delegation capability
writer = Agent(
role='Writer',
goal='Narrate compelling tech stories about {topic}',
verbose=True,
memory=True,
backstory=(
"With a flair for simplifying complex topics, you craft"
"engaging narratives that captivate and educate, bringing new"
"discoveries to light in an accessible manner."
),
tools=[search_tool],
allow_delegation=False
)

There are various studies that compares the traditional zero-shot prompting methods and incorporating an agentic workflow. One example is — using GPT 3.5 vs incorporating an agentic workflow resulted in a 41% improvement.

With the understanding of how Agentic and non-agentic workflow works, here are some key facts about agentic workflows.

· Agent workflow: is a way of using language models to perform iterative and complex tasks. Agentic workflows show better results for certain use cases.

· Design patterns for agents: There are 4 design patterns of agentic workflow reflection, tool use, planning, and multi-agent collaboration.

· Consequences and challenges of agents: Agentic reasoning can expand the set of tasks that AI can do and improve the performance of existing models. There are also challenges, such as the need to wait for the agent’s response, the importance of fast token generation, and the difficulty of evaluating agents.

· A step towards AGI: Though this is going to take a long time, Agent workflows could help us move closer to artificial general intelligence (AGI).

Patterns for Agentic workflow.

  1. Multi-Agent Collaboration: This involves multiple agents working together to achieve a common goal. AutoGen, CrewAI are some examples of multi agent tools for Next-Gen LLM applications.
  2. Critic or Reflection: This involves an agent reflecting on its own work, checking for correctness, efficiency, and good construction.
  3. Tool Use: This involves an agent using various tools for analysis, gathering information, acting, and personal productivity.
  4. Planning: This involves an agent using planning algorithms to determine the best course of action.

Key Takeaways

  1. AI agents have the potential to significantly expand the capabilities of AI systems.
  2. Adopting agentic workflows can lead to substantial productivity boosts in various applications.
  3. Patience is crucial when working with AI agents, as generating tokens and receiving responses may take time.
  4. Faster token generation can improve the efficiency of AI agents, even when using lower-quality language models.

Reference: https://www.coursera.org/learn/generative-ai-with-llms?action=enroll&utm_campaign=WebsiteCoursesGAIA&utm_medium=institutions&utm_source=deeplearning-ai

--

--