Back to feed
Renewal·마흔의 생활코딩

Agentic | CrewAI, an AI Agent Orchestration Framework

NS
normalstory
cover image
The Agentic Concept Series
  - Agentic Chunking LangChain RAG
  - DEVIKA, the AI software engineer
  ?  CrewAI, an AI agent orchestration framework

 

 

CrewAI

CrewAI is a framework for orchestrating (managing) role-playing autonomous AI agents. You can think of it as an abstraction layer that sits on top of LangChain. A similar service is Microsoft's AUTO-GEN, and umm.. it's a bit of a stretch, but conceptually similar is LangChain's LangGraph. There is of course a way to use CrewAI and LangGraph together (which I plan to use as content for the next post), but the timing of when these tools were born and the concept they share — Agentic (MOE) — point in pretty much the same direction.

 

Core Concepts

The framework's architecture is made up of agents Agents, tasks Tasks, tools Tools, processes Processes, and crews Crews.

 

1. Agents (Bots)

  • A kind of individual persona or unit
  • Agents are created in role-playing-persona form
  • Autonomous unit programs
    • Perform tasks
    • Make decisions
    • Communicate with other agents
  • That said, rather than figuring things out on their own, they focus on carrying out a specific assigned task
  • Key attributes
    • Role: tools, what it can do
    • Goal: how to use the tools, the guideline for decision-making
    • Backstory: sets context through the LLM, provides the system prompt, sets concrete context for the actual role
    • LLM: defaults to 4.0 but can be modified
    • Tools: packages the list of tools the agent will use
    • Verbose: enables detailed logging of the agent's execution for debugging or monitoring purposes (default is false)
    • Allow Delegation: delegation
    • max_iter: prevents infinite loops
    • Step Callback: a feature that lets you call an external function each time a step finishes
  • Example code
# Example: Creating an agent with all attributes
from crewai import Agent

agent = Agent(
  role='Data Analyst',
  goal='Extract actionable insights',
  backstory="""
	You're a data analyst at a large company.
  	You're responsible for analyzing data and providing insights to the business.
  	You're currently working on a project to analyze the performance of our marketing campaigns.
	""",
  tools=[my_tool1, my_tool2],  # Optional, defaults to an empty list
  llm=my_llm,  # Optional
  function_calling_llm=my_llm,  # Optional
  max_iter=15,  # Optional
  max_rpm=None, # Optional
  verbose=True,  # Optional
  allow_delegation=True,  # Optional
  step_callback=my_intermediate_step_callback,  # Optional
  memory=True  # Optional
)

*RCI Agent (Checker — a LangChain-based agent dedicated to validation): checks the output and, if something is off, corrects it back to normal

 

 

2. Tasks

  • The individual jobs each agent performs
  • A task encapsulates the information needed to execute it — the description, the assigned agent, the required tools, and so on
  • You can also define collaborative tasks across agents
  • What gets passed into the LLM
  • Key attributes
    • Description: a clear, concise description of what the task involves. Defines what the LLM model is — what it can do — what it should do
    • Agent: designate a dedicated agent; otherwise it's assigned according to the crew process
    • Expected Output: clearly and in detail define the expected outcome of the task; you can include a few examples
    • Tools
    • Async Execution: defines stages (ordering) across specific agents instead of running tasks concurrently
    • Context
    • Output JSON: API call
    • Output Pydantic: depends on the client (OpenAI) spec
    • Output File
    • Callback
    • Human Input
  • Example code
import os
os.environ["OPENAI_API_KEY"] = "Your Key"
os.environ["SERPER_API_KEY"] = "Your Key" # serper.dev API key

from crewai import Agent, Task, Crew
from crewai_tools import SerperDevTool

research_agent = Agent(
  role='Researcher',
  goal='Find and summarize the latest AI news',
  backstory="""
	You're a researcher at a large company.
  	You're responsible for analyzing data and providing insights
  	to the business.
	""",
  verbose=True
)

search_tool = SerperDevTool()

task = Task(
  description='Find and summarize the latest AI news',
  expected_output='A bullet list summary of the top 5 most important AI news',
  agent=research_agent,
  tools=[search_tool]
)

crew = Crew(
    agents=[research_agent],
    tasks=[task],
    verbose=2
)

result = crew.kickoff()
print(result)

 

 

3. Tools

  • Tasks external to the LLM: calling APIs, saving files
  • From simple search to complex interactions, and the ability to manage effective teamwork between agents
  • CrewAI: toolkit
  • LangChain: tools — its own repository, search (Git, YouTube, Wikipedia), and so on
  • Key characteristics
    • Utility: built for tasks like web search, data analysis, content generation, and agent collaboration.
    • Integration: seamlessly integrates tools into the workflow to enhance the agent's capabilities.
    • Customizability: provides the flexibility to develop custom tools tailored to a specific agent's needs, or to leverage existing ones. e.g., selectively granting database access permissions to each agent

 

 

4. Processes

  • Project management
  • Orchestrates how the agents execute tasks
  • Build Agent Automations
  • How a process is implemented
    • Sequential Crews
      • Hand off to another agent: configure a manager that can decide on the next step — manager_llm
      from crewai import Crew
      from crewai.process import Process
      from langchain_openai import ChatOpenAI
      
      # Example: Creating a crew with a sequential process
      crew = Crew(
          agents=my_agents,
          tasks=my_tasks,
          process=Process.sequential
      )
    • Hierarchical Crews
      • Build a to-do list
      • Delegate tasks to each agent
      • Review the results
      • Hand off to another agent: configure a manager that can decide on the next step — manager_llm
      from crewai import Crew
      from crewai.process import Process
      from langchain_openai import ChatOpenAI
      
      # Example: Creating a crew with a hierarchical process
      # Ensure to provide a manager_llm
      crew = Crew(
          agents=my_agents,
          tasks=my_tasks,
          process=Process.hierarchical,
          manager_llm=ChatOpenAI(model="gpt-4")
      )

 

 

5. Crews

  • A team — a collaborative group of agents working together
  • A 'crew' is a group of experts in one domain
  • Each crew has its own tools, its own task-execution strategy, agent collaboration, and overall workflow
  • Instantiated with: Tasks, Agents
  • Attributes
    • Tasks, Agents, Process, Verbose, Manager LLM
    • Max RPM: maximum number of requests (cost consideration)
    • Language
    • Full Output: choose whether to print the entire process or only the final result
  • Example of building a crew (team) code
from crewai import Crew, Agent, Task, Process
from langchain_community.tools import DuckDuckGoSearchRun

# Define agents with specific roles and tools
researcher = Agent(
    role='Senior Research Analyst',
    goal='Discover innovative AI technologies',
    tools=[DuckDuckGoSearchRun()]
)

writer = Agent(
    role='Content Writer',
    goal='Write engaging articles on AI discoveries',
    verbose=True
)

# Create tasks for the agents
research_task = Task(
    description='Identify breakthrough AI technologies',
    agent=researcher
)
write_article_task = Task(
    description='Draft an article on the latest AI technologies',
    agent=writer
)

# Assemble the crew with a sequential process
my_crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, write_article_task],
    process=Process.sequential,
    full_output=True,
    verbose=True,
)
  • Example code for crew oversight/monitoring
# Access the crew's usage metrics
crew = Crew(agents=[agent1, agent2], tasks=[task1, task2])
crew.kickoff()
print(crew.usage_metrics)
  • Example code for running
# Start the crew's task execution
result = my_crew.kickoff()
print(result)

 

 

 

Architecture diagrams 

Before getting into the hands-on, let me line up a mental model for the basics by comparing this with DEVIKA, which I posted about earlier. If you organize the basic understanding,  DEVIKA can be seen as Crews configured as a dedicated 'AI software engineer' organization.

 

Agentic | DEVIKA, the Open-Source AI Software Engineer

The Agentic concept series — Agentic Chunking LangChain RAG; DEVIKA, the AI software engineer; CrewAI, the AI agent orchestration framework. ...A practice run from a month or two ago that I kept putting off and finally posted...

normalstory.tistory.com

When you give a prompt to DEVIKA — the software AI — before generating any code, it analyzes the user's prompt and writes up a todo list. Then it assigns this todo list to the agents (for reference, DEVIKA is made up of 9? development-specialist agents) and is configured so that it does not move on to the next step until the current one is resolved. From this, my impression is that DEVIKA's process (to put it in CrewAI terms) is structured as a 'hierarchical process'. 

DEVIN, OPEN DEVIN, and DEVIKA are all, in the same sense, just configurations of agents pre-optimized for AI software engineering. The 'why' may be the same, but that doesn't mean the 'how' and the 'what' are the same. Just as no matter how many kimchi-stew restaurants there are out there, each has its own organizational structure and recipe — likewise, an organization adopting an LLM should not be agonizing over whether to build or adopt the #1 model on the HuggingFace Leaderboard. Rather, you need a process of finding what's optimal for your situation and setting your direction. 

From my own perspective making a living as a planner, service planner, PM/PO, this is a particularly important point — exactly the part where 'planning' (drawing the line) is needed.   

 

Coming back to it,
I have summarized the items above visually as best as I understand them (my understanding is incomplete, but the more you put out there the more you get corrected, and that's how you learn..).. If you spot anything wrong, please share your wisdom. 

Example of a sequential process 

CrewAI, Sequential Crews diagram

Example of a hierarchical process 

CrewAI Hierarchical Crews diagram

 

 

 

Hands-on 

1. Example using the OpenAI API

1) Building an Agent that prepares meeting materials 

 

CrewAI_practice01_meeting-material-research(api_exaai).ipynb

Colaboratory notebook

colab.research.google.com

2) Hands-on by process

    (1) Sequential style

 

Google Colab Notebook

Run, share, and edit Python notebooks

colab.research.google.com

    (2) Hierarchical style

 

Google Colab Notebook

Run, share, and edit Python notebooks

colab.research.google.com

3) RCI Agent

 

Google Colab Notebook

Run, share, and edit Python notebooks

colab.research.google.com

 

 

 

 

 


*Content to be added later 

Update the code so it uses a local LLM instead of the OpenAI API

This English version was translated by Claude.

친절한 찰쓰씨
Written by
친절한 찰쓰씨

Pleasant Charles — UI/UX researcher at AIT. Keeping notes on design, planning, and slow days here since 2010.

More on the author's page

Keep reading

Renewal

Steadily, for the long haul, without burning out

Mar 31, 2026·9 min
Renewal

Tech-life balance

Feb 7, 2026·3 min
Renewal

Humanality, by Park Jeong-ryeol

Feb 7, 2026·11 min