AI?
Agentic AI, originally introduced by Andrew Ng as AI “partners” that autonomously plan, execute, and complete complex tasks, is a new concept emerged from the burst of Generative AI applications. The term has rapidly gained popularity since late July 2025, according to its search volume in Google Trends.

Despite its recent appearance, the research article from BCG “How Agentic AI Is Transforming Enterprise Platforms” indicates that organizations have been actively adopting Agentic AI workflows to transform their core technology platforms and assist in marketing automation, customer services, workplace productivity etc, leading to 20% to 30% faster workflow cycles.
From LLMs to Multi-Agent Systems
What distinguishes an Agentic AI system from traditional automation systems is its autonomy to plan actions and logic, as long as achieving a specific, predefined objective. As a result, there is less rigid orchestration or predetermined decision-making trajectories governing the Agent’s intermediate steps. ”Synergizing Reasoning and Acting in Language Models” is considered the foundational paper that formalizes the early-stage LLM Agent framework “ReAct”, consisting of three key elements — actions, thoughts and observations. If you are interested in more details of how ReAct works, please see my blog post “6 Common LLM Customization Strategies Briefly Explained“.
With the rapid growth of this field, it becomes evident that a single LLM Agent cannot catch up with the high demand of AI applications and integrations. Therefore, Multi-Agent systems are developed to orchestrate Agent’s functionalities into a dynamic workflow. While each agent instance is role-based, task-focused, emphasizing on achieving a single objective, a multi-agent system is multi-functional and more generalized in its capabilities. The LangChain article “Benchmarking Multi-Agent Architectures” has shown that when the number of knowledge domains required in a task increases, the performance of a single-agent system deteriorates while a multi-agent system can achieve sustainable performance by reduce the amount of noise feeding into each individual agent.
Build a Simple Agentic AI System Using CrewAI
CrewAI is an open-source Python framework that allows developers to build production-ready and collaborative AI agent teams to tackle complex tasks. Compared to other popular Agent frameworks like LangChain and LlamaIndex, it focuses more on role-based multi-agent collaborations, while offering less flexibility for complex agentic architecture. Although it is a relatively younger framework, it is gaining increasing attractions starting from July 2025 due to the ease of implementation.
We can use the analogy of hiring a cross-functional project team (or a Crew) when using CrewAI framework to build the Agentic system, where each AI Agent in the Crew has a specific role capable of carrying out multiple role-related Tasks. Agents are equipped with Tools that facilitate them completing the jobs.
Now that we’ve covered the core concepts of the CrewAI framework—Agent, Task, Tool, and Crew—let’s look at sample code to build a minimal viable agentic system.
1. Install CrewAI and set up environment variables using bash commands below, e.g. export OpenAI API key as an environment variable for accessing OpenAI GPT models.
pip install crewai
pip install 'crewai[tools]'
export OPENAI_API_KEY='your-key-here'
2. Create Tools from CrewAI’s built-in tool list, e.g. apply DirectoryReadTool() to access a directory, and FileReadTool() to read files stored in the directory.
from crewai_tools import DirectoryReadTool, FileReadTool
doc_tool = DirectoryReadTool(directory='./articles')
file_tool = FileReadTool()
3. Initiate an Agent by specifying its role, goal, and providing it with tools.
from crewai import Agent
researcher = Agent(
role="Researcher",
goal="Find information on any topic based on the provided files",
tools=[doc_tool, file_tool]
)
4. Create a Task by providing a description and assign an agent to execute the task.
from crewai import Task
research_task = Task(
description="Research the latest AI trends",
agent=researcher
)
5. Build the Crew by combining your Agents and Tasks together. Start the workflow execution using kickoff().
from crewai import Crew
crew = Crew(
agents=[researcher],
tasks=[research_task]
)
result = crew.kickoff()
Develop an Agentic Social Media Marketing Crew
0. Project Objectives
Let’s expand on this simple CrewAI example by creating a Social Media Marketing team through the step-by-step procedures below. This team will generate blog posts based on the user’s topic of interest and create tailored campaign messages for sharing on different social media platforms.

An example output if we ask the crew about the topic “Agentic AI”.
Blog Post

X(Twitter) MessageDiscover the Future of Agentic AI! Have you ever wondered how Agentic AI is set to redefine our interaction with technology by 2025? Understanding AI trends for 2025 is not only crucial for technology enthusiasts but essential for businesses across various sectors. #AgenticAI #AITrends
YouTube MessageExplore Groundbreaking Trends in Agentic AI! 🌟 Uncover how Agentic AI is transforming industries in ways you never imagined! By 2025, these revolutionary trends will reshape how we engage with technologies, particularly in banking and finance. Are you ready to embrace the future? Don't forget to read our latest blog post and subscribe for more insights!
Substack MessageThe Changing Landscape of Agentic AI: What You Need to Know In 2025, the evolving world of Agentic AI is set to reshape industries, particularly in finance and banking. This blog covers key trends such as the transformational potential of agentic AI, new regulatory frameworks, and significant technological advancements. How can businesses successfully integrate agentic AI while managing risks? What does the future of this technology mean for consumers? Join the dialogue in our latest post, and let's explore how these innovations will impact our future together!
1. Project Environment Setup
Follow the CrewAI’s QuickStart guide to setup the development environment. We use the following directory structure for this project.
├── README.md
├── pyproject.toml
├── requirements.txt
├── src
│ └── social_media_agent
│ ├── __init__.py
│ ├── crew.py
│ ├── main.py
│ └── tools
│ ├── __init__.py
│ ├── browser_tools.py
│ └── keyword_tool.py
└── uv.lock
2. Develop Tools
The first tool we add to the crew is WebsiteSearchToolwhich is a built-in tool implemented by CrewAI for conducting semantic searches within the content of websites.
We just need a few lines of code to install the crewai tools package and use the WebsiteSearchTool. This tool is accessible by the market researcher agent to find latest market trends or industry news related to a given topic.
pip install 'crewai[tools]'
from crewai_tools import WebsiteSearchTool
web_search_tool = WebsiteSearchTool()
The screenshot below shows the output of web_search_tool when given the topic “YouTube videos”.

Next, we’ll create a custom keyword_tool by inheriting from the BaseTool class and using the SerpApi (Google Trend API). As shown in the code below, this tool generates the top searched, trending queries related to the input keyword. This tool is accessible by the marketing specialist agent to investigate trending keywords and refine the blog post for search engine optimization. We will see an example of the keyword tool’s output in the next section.
import os
import json
from dotenv import load_dotenv
from crewai.tools import BaseTool
from serpapi.google_search import GoogleSearch
load_dotenv()
api_key = os.getenv('SERPAPI_API_KEY')
class KeywordTool(BaseTool):
name: str = "Trending Keyword Tool"
description: str = "Get search volume of related trending keywords."
def _run(self, keyword: str) -> str:
params = {
'engine': 'google_trends',
'q': keyword,
'data_type': 'RELATED_QUERIES',
'api_key': api_key
}
search = GoogleSearch(params)
try:
rising_kws = search.get_dict()['related_queries']['rising']
top_kws = search.get_dict()['related_queries']['top']
return f"""
Rising keywords: {rising_kws} \n
Top keywords: {top_kws}
"""
except Exception as e:
return f"An unexpected error occurred: {str(e)}"
3. Define the Crew Class

In the crew.py script, we define our social media crew team with three agents—market_researcher, content_creator, marketing_specialist—and assign tasks to each. We initialize the SocialMediaCrew() class using the @CrewBase decorator. The topic attribute passes the user’s input about their topic of interest, and llm , model_name attributes specify the default model used throughout the Crew workflow.
@CrewBase
class SocialMediaCrew():
def __init__(self, topic: str):
"""
Initialize the SocialMediaCrew with a specific topic.
Args:
topic (str): The main topic or subject for social media content generation
"""
self.topic = topic
self.model_name = 'openai/gpt-4o'
self.llm = LLM(model=self.model_name,temperature=0)
4. Define Agents
CrewAI Agents rely on three essential parameters—role, goal, and backstory—to define their characteristics as well as the context they are operating in. Additionally, we provide Agents with relevant tools to facilitate their jobs and other parameters to control the resource consumption of the Agent calling and avoid unnecessary LLM token usage.
For example, we define the “Marketing Specialist Agent” using the code below. Start with using @agent decorator. Define the role as “Marketing Specialist” and provide the access to keyword_tool we previously developed, so that the marketing specialist can research the trending keywords to refine the blog contents for optimal SEO performance.
Visit our GitHub repository for the full code of other Agent definitions.
@CrewBase
class SocialMediaCrew():
def __init__(self, topic: str):
"""
Initialize the SocialMediaCrew with a specific topic.
Args:
topic (str): The main topic or subject for social media content generation
"""
self.topic = topic
self.model_name = 'openai/gpt-4o'
self.llm = LLM(model=self.model_name,temperature=0)
Setting verbose to true allows us to utilize CrewAI’s traceability functionality to observe intermediate output throughout the Agent calling. The screenshots below show the thought process of “Marketing Specialist” Agent using thekeyword_tool to research “YouTube trends”, as well as the SEO-optimized blog post based on the tool output.
Intermediate Output from Marketing Specialist


An alternative approach to define Agent is to store the Agent context in a YAML file using the format below, providing additional flexibility of experiment and iterating on prompt engineering when necessary.
Example agent.yaml
marketing_specialist:
role: >
"Marketing Specialist"
goal: >
"Improve the blog post to optimize for Search Engine Optimization using the Keyword Tool and create customized, channel-specific messages for social media distributions"
backstory: >
"A skilled Marketing Specialist with expertise in SEO and social media campaign design"
5. Define Tasks
If an Agent is considered as the employee (“who”) specialised in a domain (e.g. content creation, research), embodied with a persona or characteristics, then Tasks are the actions (“what”) that the employee performs with predefined objectives and output expectations.
In CrewAI, a Task is configured using description, expected_output, and the optional parameter output_file saves the intermediate output as a file. Alternatively, it is also recommended to use a standalone YAML file to provide a cleaner, maintainable way to define Tasks. In the code snippet below, we provide precise instructions for the crew to carry out four tasks and assign them to agents with relevant skillsets. We also save the output of each task in the working folder for the ease of comparing different output versions.
research: research on the market trend of the given topic; assigned to the market researcher.write: write an engaging blog post; assigned to the content creator.refine: refine blog post based for optimal SEO performance; assigned to the marketing specialist.distribute: generate platform-specific messages for distributing on each social media channel; assigned to the marketing specialist.
@task
def research(self) -> Task:
return Task(
description=f'Research the 2025 trends in the {self.topic} area and provide a summary.',
expected_output=f'A summary of the top 3 trending news in {self.topic} with a unique perspective on their significance.',
agent=self.market_researcher()
)
@task
def write(self) -> Task:
return Task(
description=f"Write an engaging blog post about the {self.topic}, based on the research analyst's summary.",
expected_output='A 4-paragraph blog post formatted in markdown with engaging, informative, and accessible content, avoiding complex jargon.',
agent=self.content_creator(),
output_file=f'blog-posts/post-{self.model_name}-{timestamp}.md'
)
@task
def refine(self) -> Task:
return Task(
description="""
Refine the given article draft to be highly SEO optimized for trending keywords.
Include the keywords naturally throughout the text (especially in headings and early paragraphs)
Make the content easy for both search engines and users to understand.
""",
expected_output='A refined 4-paragraph blog post formatted in markdown with engaging and SEO-optimized contents.',
agent=self.marketing_specialist(),
output_file=f'blog-posts/seo_post-{self.model_name}-{timestamp}.md'
)
@task
def distribute(self) -> Task:
return Task(
description="""
Generate three distinct versions of the original blog post description, each tailored for a specific distribution channel:
One version for X (formerly Twitter) – concise, engaging, and hashtag-optimized.
One version for YouTube post – suitable for video audience, includes emotive cue and strong call-to-action.
One version for Substack – slightly longer, informative, focused on newsletter subscribers.
Each description must be optimized for the norms and expectations of the channel, making subtle adjustments to language, length, and formatting.
Output should be in markdown format, with each version separated by a clear divider (---).
Use a short, impactful headline for each version to further increase channel fit.
""",
expected_output='3 versions of descriptions of the original blog post optimized for distribution channel, formatted in markdown, separated by dividers.',
agent=self.marketing_specialist(),
output_file=f'blog-posts/social_media_post-{self.model_name}-{timestamp}.md'
)
The CrewAI output log below shows task execution details, including status, agent assignments, and tool usage.
🚀 Crew: crew
├── 📋 Task: research (ID: 19968f28-0af7-4e9e-b91f-7a12f87659fe)
│ Assigned to: Market Research Analyst
│ Status: ✅ Completed
│ └── 🔧 Used Search in a specific website (1)
├── 📋 Task: write (ID: 4a5de75f-682e-46eb-960f-43635caa7481)
│ Assigned to: Content Writer
│ Status: ✅ Completed
├── 📋 Task: refine (ID: fc9fe4f8-7dbb-430d-a9fd-a7f32999b861)
│ **Assigned to: Marketing Specialist**
│ Status: ✅ Completed
│ └── 🔧 Used Trending Keyword Tool (1)
└── 📋 Task: distribute (ID: ed69676a-a6f7-4253-9a2e-7f946bd12fa8)
**Assigned to: Marketing Specialist**
Status: ✅ Completed
└── 🔧 Used Trending Keyword Tool (2)
╭───────────────────────────────────────── Task Completion ──────────────────────────────────────────╮
│ │
│ Task Completed │
│ Name: distribute │
│ Agent: Marketing Specialist │
│ Tool Args: │
│ │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────╯
6. Kick Off the Crew
As the final step in the crew.py script, we orchestrate Tasks, Agents and Tools together to define the crew.
@crew
def crew(self) -> Crew:
return Crew(
agents=self.agents,
tasks=self.tasks,
verbose=True,
planning=True,
)
In the main.py, we instantiate a SocialMediaCrew() object and run the crew by accepting the user’s input for their topic of interest.
# main.py
from social_media_agent.crew import SocialMediaCrew
def run():
# Replace with your inputs, it will automatically interpolate any tasks and agents information
inputs = {
'topic': input('Enter your interested topic: '),
}
SocialMediaCrew(topic=inputs['topic']).crew().kickoff(inputs=inputs)
Now let’s use “Agentic AI” as an example and here are output files generated by our social media crew after sequentially executing the tasks.
Output from “write” Task

Output from “refine” Task

Output from “distribute” Task

Take-Home Message
This tutorial demonstrates how to create an Agentic AI system using CrewAI framework. By orchestrating specialized agents with distinct roles and tools, we implement a multi-agent team that is capable of generating optimized content for different social media platforms.
- Environment Setup: Initialize your development environment with necessary dependencies and tools for CrewAI development
- Develop Tools: Develop the foundational tool structure with built-in and custom tool components
- Define Agents: Create specialized agents with clearly defined roles, goals, and backstories. Equip them with relevant tools to support their role.
- Create Tasks: Create tasks with clear descriptions and expected outputs. Assign Agents for task execution.
- Kick Off the Crew: Orchestrate Tasks, Agents and Tools together as a Crew and execute the workflow.
More Resources Like This



