What is an AI Agent?
In simple terms, an AI agent is a program designed to meet user expectations with minimal to no input, functioning autonomously to achieve its objectives.
Think of it like a beehive hierarchy: worker bees, the queen bee, and drone bees each have distinct roles, yet they collaborate seamlessly to achieve a common goal. Similarly, AI agents specialize in tasks while working together to accomplish complex objectives.
With rapid advancements in artificial intelligence, the concept of Agentic AI is making waves. Industry leaders like Andrew Ng have highlighted how AI agents represent the next significant leap in AI evolution. In his recent talk, Andrew provided valuable insights into the current state of AI agents and how they can be harnessed for diverse applications.
Why AI Agents?
Developers know all too well the arduous process of building, testing, and deploying applications — a journey that can take weeks or even months. Enter AI orchestration frameworks like LangChain (LangGraph), CrewAI, OpenAI (Swarm), and Haystack, which have drastically reduced this timeline. Now, tasks that once took months can be completed in days — or even hours in some cases.
AI Agentic Design Patterns
As explained by Andrew Ng, there are four primary design patterns for creating AI agents:
1. Reflection
This pattern mirrors the human interaction loop found in apps like ChatGPT or Perplexity. It’s a request-response cycle where agents interact, research, and refine their output until they meet user expectations. Unlike human-driven iterations, agents autonomously handle the back-and-forth process to deliver results.
2. Planning
In this approach, a large task is broken down into smaller, manageable subtasks. Each agent is assigned a specific task, and the results are aggregated into a final cohesive output.
3. Tools
Agents utilize external resources — such as Python scripts, APIs, or web scrapers — to accomplish their tasks. This pattern leverages the versatility of tools to enhance agent capabilities.
4. MultiAgent
Imagine a professional team, with each member bringing specialized expertise — developers, product planners, QA engineers, and more. MultiAgent systems operate similarly, using a collaborative, supervised, or hierarchical approach where agents with unique strengths (different models) work together to achieve a unified goal.
For a deeper dive into these patterns, you can explore Andrew Ng’s original explanation here.
CrewAI: Agent Orchestration Framework
CrewAI is a notable orchestration platform that simplifies the development of multi-agent solutions. While numerous tutorials are available, the best starting point is their official documentation, which offers detailed guidance on framework concepts, technical terminology, and structuring agent-based projects.
Flight Finder and Trip Planner with CrewAI
To demonstrate the power of CrewAI, I built a project that streamlines flight search and trip planning. The tool not only finds flights but also crafts a destination itinerary — all with minimal effort. No more tedious searches, web scraping, or wrangling with messy HTML tags!
Code Structure
The project adheres to CrewAI’s quickstart guide:
-
Config folder: Contains
agents.yaml
andtasks.yaml
.- Agents: Defined as experts with roles, goals, and backstories.
- Tasks: Specify objectives, expected outputs, the agent responsible, and contextual dependencies between tasks.
- Custom Tool: The google_flights.py script interacts with the Google Flights API (via SerpAPI) to retrieve flight details.
- Serper API Integration: CrewAI’s built-in support simplifies web scraping tasks.
- LLM Model: OpenAI’s GPT-4o powers the solution.
Output
The final itinerary is saved as a trip_itinerary.md
file, providing a neatly formatted travel plan if run via crewai run
command.
Users can run it as a streamlit app
by following the instructions mentioned in the README of the repo.
The project code is available on GitHub. CrewAI GitHub repo has a list of curated open-source projects, check them out if interested in learning more and how the community is building.
Impact of Agents
As previously stated, with frameworks like CrewAI, iteration of an idea to implementation can be done in a few hours to days and then deployed to production. The future of development will be more focused on ideas, the clear concise way to write a prompt, and less tinkering at the code level.
Top comments (0)