Close Menu
    Trending
    • “The success of an AI product depends on how intuitively users can interact with its capabilities”
    • How to Crack Machine Learning System-Design Interviews
    • Music, Lyrics, and Agentic AI: Building a Smart Song Explainer using Python and OpenAI
    • An Anthropic Merger, “Lying,” and a 52-Page Memo
    • Apple’s $1 Billion Bet on Google Gemini to Fix Siri
    • Critical Mistakes Companies Make When Integrating AI/ML into Their Processes
    • Nu kan du gruppchatta med ChatGPT – OpenAI testar ny funktion
    • OpenAI’s new LLM exposes the secrets of how AI really works
    ProfitlyAI
    • Home
    • Latest News
    • AI Technology
    • Latest AI Innovations
    • AI Tools & Technologies
    • Artificial Intelligence
    ProfitlyAI
    Home » How to Build Your Own Agentic AI System Using CrewAI
    Artificial Intelligence

    How to Build Your Own Agentic AI System Using CrewAI

    ProfitlyAIBy ProfitlyAINovember 9, 2025No Comments13 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    AI?

    Agentic AI, initially launched by Andrew Ng as AI “companions” that autonomously plan, execute, and full complicated duties, is a brand new idea emerged from the burst of Generative AI purposes. The time period has quickly gained reputation since late July 2025, in accordance with its search quantity in Google Traits.

    “Agentic AI” Google search quantity over the previous 12 months

    Regardless of its latest look, the analysis article from BCG “How Agentic AI Is Transforming Enterprise Platforms” signifies that organizations have been actively adopting Agentic AI workflows to remodel their core know-how platforms and help in advertising and marketing automation, buyer providers, office productiveness and many others, main to twenty% to 30% quicker workflow cycles.

    From LLMs to Multi-Agent Methods

    What distinguishes an Agentic AI system from conventional automation programs is its autonomy to plan actions and logic, so long as attaining a particular, predefined goal. In consequence, there’s much less inflexible orchestration or predetermined decision-making trajectories governing the Agent’s intermediate steps. ”Synergizing Reasoning and Acting in Language Models” is taken into account the foundational paper that formalizes the early-stage LLM Agent framework “ReAct”, consisting of three key parts — actions, ideas and observations. In case you are interested by extra particulars of how ReAct works, please see my weblog put up “6 Common LLM Customization Strategies Briefly Explained“.

    With the speedy development of this discipline, it turns into evident {that a} single LLM Agent can not meet up with the excessive demand of AI purposes and integrations. Due to this fact, Multi-Agent programs are developed to orchestrate Agent’s functionalities right into a dynamic workflow. Whereas every agent occasion is role-based, task-focused, emphasizing on attaining a single goal, a multi-agent system is multi-functional and extra generalized in its capabilities. The LangChain article “Benchmarking Multi-Agent Architectures” has proven that when the variety of data domains required in a job will increase, the efficiency of a single-agent system deteriorates whereas a multi-agent system can obtain sustainable efficiency by cut back the quantity of noise feeding into every particular person agent.

    Construct a Easy Agentic AI System Utilizing CrewAI

    CrewAI is an open-source Python framework that enables builders to construct production-ready and collaborative AI agent groups to deal with complicated duties. In comparison with different in style Agent frameworks like LangChain and LlamaIndex, it focuses extra on role-based multi-agent collaborations, whereas providing much less flexibility for complicated agentic structure. Though it’s a comparatively youthful framework, it’s gaining growing sights ranging from July 2025 because of the ease of implementation.

    We are able to use the analogy of hiring a cross-functional challenge staff (or a Crew) when utilizing CrewAI framework to construct the Agentic system, the place every AI Agent within the Crew has a particular function able to finishing up a number of role-related Duties. Brokers are geared up with Instruments that facilitate them finishing the roles.

    Now that we’ve lined the core ideas of the CrewAI framework—Agent, Job, Device, and Crew—let’s take a look at pattern code to construct a minimal viable agentic system.

    1. Set up CrewAI and arrange surroundings variables utilizing bash instructions beneath, e.g. export OpenAI API key as an surroundings variable for accessing OpenAI GPT fashions.

    pip set up crewai
    pip set up 'crewai[tools]'
    export OPENAI_API_KEY='your-key-here'

    2. Create Instruments from CrewAI’s built-in tool list, e.g. apply DirectoryReadTool() to entry a listing, and FileReadTool() to learn information saved within the listing.

    from crewai_tools import DirectoryReadTool, FileReadTool
    
    doc_tool = DirectoryReadTool(listing='./articles')
    file_tool = FileReadTool()

    3. Provoke an Agent by specifying its function, objective, and offering it with instruments.

    from crewai import Agent
    
    researcher = Agent(
        function="Researcher",
        objective="Discover data on any matter based mostly on the supplied information",
        instruments=[doc_tool, file_tool]
    )

    4. Create a Job by offering an outline and assign an agent to execute the duty.

    from crewai import Job
    
    research_task = Job(
        description="Analysis the newest AI developments",
        agent=researcher
    )

    5. Construct the Crew by combining your Brokers and Duties collectively. Begin the workflow execution utilizing kickoff().

    from crewai import Crew
    
    crew = Crew(
        brokers=[researcher],
        duties=[research_task]
    )
    
    consequence = crew.kickoff()

    Develop an Agentic Social Media Advertising and marketing Crew

    0. Challenge Goals

    Let’s increase on this easy CrewAI instance by making a Social Media Advertising and marketing staff by way of the step-by-step procedures beneath. This staff will generate weblog posts based mostly on the person’s matter of curiosity and create tailor-made marketing campaign messages for sharing on completely different social media platforms.

    An instance output if we ask the crew in regards to the matter “Agentic AI”.

    Weblog Put up

    X(Twitter) Message
    Uncover the Way forward for Agentic AI! Have you ever ever questioned how Agentic AI is about to redefine our interplay with know-how by 2025? Understanding AI developments for 2025 will not be solely essential for know-how fans however important for companies throughout numerous sectors. #AgenticAI #AITrends
    YouTube Message
    Discover Groundbreaking Traits in Agentic AI! 🌟 Uncover how Agentic AI is remodeling industries in methods you by no means imagined! By 2025, these revolutionary developments will reshape how we interact with applied sciences, significantly in banking and finance. Are you able to embrace the longer term? Do not forget to learn our newest weblog put up and subscribe for extra insights!
    Substack Message
    The Altering Panorama of Agentic AI: What You Have to Know In 2025, the evolving world of Agentic AI is about to reshape industries, significantly in finance and banking. This weblog covers key developments such because the transformational potential of agentic AI, new regulatory frameworks, and important technological developments. How can companies efficiently combine agentic AI whereas managing dangers? What does the way forward for this know-how imply for customers? Be part of the dialogue in our newest put up, and let's discover how these improvements will impression our future collectively!

    1. Challenge Surroundings Setup

    Observe the CrewAI’s QuickStart information to setup the event surroundings. We use the next listing construction for this challenge.

    ├── README.md
    ├── pyproject.toml
    ├── necessities.txt
    ├── src
    │   └── social_media_agent
    │       ├── __init__.py
    │       ├── crew.py
    │       ├── major.py
    │       └── instruments
    │           ├── __init__.py
    │           ├── browser_tools.py
    │           └── keyword_tool.py
    └── uv.lock

    2. Develop Instruments

    The primary device we add to the crew is WebsiteSearchToolwhich is a built-in device applied by CrewAI for conducting semantic searches throughout the content material of internet sites.

    We simply want a couple of traces of code to put in the crewai instruments package deal and use the WebsiteSearchTool. This device is accessible by the market researcher agent to search out newest market developments or trade information associated to a given matter.

    pip set up 'crewai[tools]'
    from crewai_tools import WebsiteSearchTool
    
    web_search_tool = WebsiteSearchTool()

    The screenshot beneath reveals the output of web_search_tool when given the subject “YouTube movies”.

    Agentic AI Tool Output Example

    Subsequent, we’ll create a customized keyword_tool by inheriting from the BaseTool class and utilizing the SerpApi (Google Trend API). As proven within the code beneath, this device generates the highest searched, trending queries associated to the enter key phrase. This device is accessible by the advertising and marketing specialist agent to research trending key phrases and refine the weblog put up for SEO. We are going to see an instance of the key phrase device’s output within the subsequent part.

    import os
    import json
    from dotenv import load_dotenv
    from crewai.instruments import BaseTool
    from serpapi.google_search import GoogleSearch
    
    load_dotenv()
    api_key = os.getenv('SERPAPI_API_KEY')
    
    class KeywordTool(BaseTool):
        title: str = "Trending Key phrase Device"
        description: str = "Get search quantity of associated trending key phrases."
    
        def _run(self, key phrase: str) -> str:
            params = {
                'engine': 'google_trends',
                'q': key phrase,
                'data_type': 'RELATED_QUERIES',
                'api_key': api_key
            }
    
            search = GoogleSearch(params)
    
            attempt:
                rising_kws = search.get_dict()['related_queries']['rising']
                top_kws = search.get_dict()['related_queries']['top']
    
                return f"""
                        Rising key phrases: {rising_kws} n 
                        High key phrases: {top_kws}
                    """
            besides Exception as e:
    
                return f"An surprising error occurred: {str(e)}"
    

    3. Outline the Crew Class

    CrewAI Architecture

    Within the crew.py script, we outline our social media crew staff with three brokers—market_researcher, content_creator, marketing_specialist—and assign duties to every. We initialize the SocialMediaCrew() class utilizing the @CrewBase decorator. The matter attribute passes the person’s enter about their matter of curiosity, and llm , model_name attributes specify the default mannequin used all through the Crew workflow.

    @CrewBase
    class SocialMediaCrew():
        def __init__(self, matter: str):
            """
            Initialize the SocialMediaCrew with a particular matter.
    
            Args:
                matter (str): The principle matter or topic for social media content material technology
            """
    
            self.matter = matter
            self.model_name = 'openai/gpt-4o'
            self.llm = LLM(mannequin=self.model_name,temperature=0)

    4. Outline Brokers

    CrewAI Brokers depend on three important parameters—function, objective, and backstory—to outline their traits in addition to the context they’re working in. Moreover, we offer Brokers with related instruments to facilitate their jobs and different parameters to manage the useful resource consumption of the Agent calling and keep away from pointless LLM token utilization.

    For instance, we outline the “Advertising and marketing Specialist Agent” utilizing the code beneath. Begin with utilizing @agent decorator. Outline the function as “Advertising and marketing Specialist” and supply the entry to keyword_tool we beforehand developed, in order that the advertising and marketing specialist can analysis the trending key phrases to refine the weblog contents for optimum Website positioning efficiency.

    Go to our GitHub repository for the complete code of different Agent definitions.

    @CrewBase
    class SocialMediaCrew():
        def __init__(self, matter: str):
            """
            Initialize the SocialMediaCrew with a particular matter.
    
            Args:
                matter (str): The principle matter or topic for social media content material technology
            """
    
            self.matter = matter
            self.model_name = 'openai/gpt-4o'
            self.llm = LLM(mannequin=self.model_name,temperature=0)

    Setting verbose to true permits us to make the most of CrewAI’s traceability performance to look at intermediate output all through the Agent calling. The screenshots beneath present the thought technique of “Advertising and marketing Specialist” Agent utilizing thekeyword_tool to analysis “YouTube developments”, in addition to the Website positioning-optimized weblog put up based mostly on the device output.

    Intermediate Output from Advertising and marketing Specialist

    An alternate method to outline Agent is to retailer the Agent context in a YAML file utilizing the format beneath, offering extra flexibility of experiment and iterating on immediate engineering when obligatory.

    Instance agent.yaml

    marketing_specialist: 
      function: >
       "Advertising and marketing Specialist"
      objective: >
       "Enhance the weblog put up to optimize for Search Engine Optimization utilizing the Key phrase Device and create custom-made, channel-specific messages for social media distributions"
      backstory: >
        "A talented Advertising and marketing Specialist with experience in Website positioning and social media marketing campaign design"

    5. Outline Duties

    If an Agent is taken into account as the worker (“who”) specialised in a site (e.g. content material creation, analysis), embodied with a persona or traits, then Duties are the actions (“what”) that the worker performs with predefined aims and output expectations.

    In CrewAI, a Job is configured utilizing description, expected_output, and the non-obligatory parameter output_file saves the intermediate output as a file. Alternatively, it is usually really useful to make use of a standalone YAML file to offer a cleaner, maintainable method to outline Duties. Within the code snippet beneath, we offer exact directions for the crew to hold out 4 duties and assign them to brokers with related skillsets. We additionally save the output of every job within the working folder for the benefit of evaluating completely different output variations.

    • analysis: analysis in the marketplace pattern of the given matter; assigned to the market researcher.
    • write: write an attractive weblog put up; assigned to the content material creator.
    • refine: refine weblog put up based mostly for optimum Website positioning efficiency; assigned to the advertising and marketing specialist.
    • distribute: generate platform-specific messages for distributing on every social media channel; assigned to the advertising and marketing specialist.
    @job
    def analysis(self) -> Job:
        return Job(
            description=f'Analysis the 2025 developments within the {self.matter} space and supply a abstract.',
            expected_output=f'A abstract of the highest 3 trending information in {self.matter} with a singular perspective on their significance.',
            agent=self.market_researcher()
        )
    
    @job
    def write(self) -> Job:
        return Job(
            description=f"Write an attractive weblog put up in regards to the {self.matter}, based mostly on the analysis analyst's abstract.",
            expected_output='A 4-paragraph weblog put up formatted in markdown with partaking, informative, and accessible content material, avoiding complicated jargon.',
            agent=self.content_creator(),
            output_file=f'blog-posts/post-{self.model_name}-{timestamp}.md' 
        )
    
    @job
    def refine(self) -> Job:
        return Job(
            description="""
                Refine the given article draft to be extremely Website positioning optimized for trending key phrases. 
                Embody the key phrases naturally all through the textual content (particularly in headings and early paragraphs)
                Make the content material simple for each engines like google and customers to know.
                """,
            expected_output='A refined 4-paragraph weblog put up formatted in markdown with partaking and Website positioning-optimized contents.',
            agent=self.marketing_specialist(),
            output_file=f'blog-posts/seo_post-{self.model_name}-{timestamp}.md' 
        )
    
    @job
    def distribute(self) -> Job: 
        return Job(
            description="""
                Generate three distinct variations of the unique weblog put up description, every tailor-made for a particular distribution channel:
                One model for X (previously Twitter) – concise, partaking, and hashtag-optimized.
    
                One model for YouTube put up – appropriate for video viewers, consists of emotive cue and robust call-to-action.
    
                One model for Substack – barely longer, informative, centered on publication subscribers.
    
                Every description should be optimized for the norms and expectations of the channel, making delicate changes to language, size, and formatting.
                Output needs to be in markdown format, with every model separated by a transparent divider (---).
                Use a brief, impactful headline for every model to additional enhance channel match.
            """,
            expected_output='3 variations of descriptions of the unique weblog put up 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 beneath reveals job execution particulars, together with standing, agent assignments, and power utilization.

    🚀 Crew: crew
    ├── 📋 Job: analysis (ID: 19968f28-0af7-4e9e-b91f-7a12f87659fe)
    │   Assigned to: Market Analysis Analyst
    │   Standing: ✅ Accomplished
    │   └── 🔧 Used Search in a particular web site (1)
    ├── 📋 Job: write (ID: 4a5de75f-682e-46eb-960f-43635caa7481)
    │   Assigned to: Content material Author
    │   Standing: ✅ Accomplished
    ├── 📋 Job: refine (ID: fc9fe4f8-7dbb-430d-a9fd-a7f32999b861)
    │   **Assigned to: Advertising and marketing Specialist**
    │   Standing: ✅ Accomplished
    │   └── 🔧 Used Trending Key phrase Device (1)
    └── 📋 Job: distribute (ID: ed69676a-a6f7-4253-9a2e-7f946bd12fa8)
        **Assigned to: Advertising and marketing Specialist**
        Standing: ✅ Accomplished
        └── 🔧 Used Trending Key phrase Device (2)
    ╭───────────────────────────────────────── Job Completion ──────────────────────────────────────────╮
    │                                                                                                    │
    │  Job Accomplished                                                                                    │
    │  Title: distribute                                                                                  │
    │  Agent: Advertising and marketing Specialist                                                                       │
    │  Device Args:                                                                                        │
    │                                                                                                    │
    │                                                                                                    │
    ╰────────────────────────────────────────────────────────────────────────────────────────────────────╯

    6. Kick Off the Crew

    As the ultimate step within the crew.py script, we orchestrate Duties, Brokers and Instruments collectively to outline the crew.

    @crew
    def crew(self) -> Crew:
        return Crew(
            brokers=self.brokers,
            duties=self.duties,
            verbose=True,
            planning=True,
        )

    In the principle.py, we instantiate a SocialMediaCrew() object and run the crew by accepting the person’s enter for his or her matter of curiosity.

    # major.py
    from social_media_agent.crew import SocialMediaCrew
    
    def run():
        # Substitute along with your inputs, it'll mechanically interpolate any duties and brokers data
        inputs = {
            'matter': enter('Enter your  matter: '),
        }
        SocialMediaCrew(matter=inputs['topic']).crew().kickoff(inputs=inputs)

    Now let’s use “Agentic AI” for example and listed below are output information generated by our social media crew after sequentially executing the duties.

    Output from “write” Job

    Output from "write" Task

    Output from “refine” Job

    Output from “distribute” Job


    Take-House Message

    This tutorial demonstrates methods to create an Agentic AI system utilizing CrewAI framework. By orchestrating specialised brokers with distinct roles and instruments, we implement a multi-agent staff that’s able to producing optimized content material for various social media platforms.

    • Surroundings Setup: Initialize your improvement surroundings with obligatory dependencies and instruments for CrewAI improvement
    • Develop Instruments: Develop the foundational device construction with built-in and customized device elements
    • Outline Brokers: Create specialised brokers with clearly outlined roles, targets, and backstories. Equip them with related instruments to help their function.
    • Create Duties: Create duties with clear descriptions and anticipated outputs. Assign Brokers for job execution.
    • Kick Off the Crew: Orchestrate Duties, Brokers and Instruments collectively as a Crew and execute the workflow.

    Extra Assets Like This



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticlePower Analysis in Marketing: A Hands-On Introduction
    Next Article LLM-Powered Time-Series Analysis | Towards Data Science
    ProfitlyAI
    • Website

    Related Posts

    Artificial Intelligence

    “The success of an AI product depends on how intuitively users can interact with its capabilities”

    November 14, 2025
    Artificial Intelligence

    How to Crack Machine Learning System-Design Interviews

    November 14, 2025
    Artificial Intelligence

    Music, Lyrics, and Agentic AI: Building a Smart Song Explainer using Python and OpenAI

    November 14, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    What Being a Data Scientist at a Startup Really Looks Like

    September 3, 2025

    Exploring the Proportional Odds Model for Ordinal Logistic Regression

    June 12, 2025

    How to Develop a Bilingual Voice Assistant

    August 31, 2025

    Toward video generative models of the molecular world | MIT News

    April 7, 2025

    Freepik lanserar F Lite en AI-bildgenerator som utmanar branschjättar

    May 1, 2025
    Categories
    • AI Technology
    • AI Tools & Technologies
    • Artificial Intelligence
    • Latest AI Innovations
    • Latest News
    Most Popular

    Synthetic data in healthcare: Definition, Benefits, and Challenges

    April 9, 2025

    How to Create an LLM Judge That Aligns with Human Labels

    July 21, 2025

    It’s been a massive week for the AI copyright debate

    April 3, 2025
    Our Picks

    “The success of an AI product depends on how intuitively users can interact with its capabilities”

    November 14, 2025

    How to Crack Machine Learning System-Design Interviews

    November 14, 2025

    Music, Lyrics, and Agentic AI: Building a Smart Song Explainer using Python and OpenAI

    November 14, 2025
    Categories
    • AI Technology
    • AI Tools & Technologies
    • Artificial Intelligence
    • Latest AI Innovations
    • Latest News
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2025 ProfitlyAI All Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.