# Use CrewAI to create agent teams

[CrewAI](https://docs.crewai.com/) is an AI framework used to create multi-agent teams called crews that work together to provide a response.

Using the [`ImagineLLM`](https://docs.qualcomm.com/doc/80-88545-1/topic/langchain.html#imagine.langchain.ImagineLLM) we can use the Qualcomm AI Inference Suite SDK with CrewAI
agents.

## Prerequisites

- Complete the [get started prerequisites](https://docs.qualcomm.com/doc/80-88545-1/topic/crewai.html#prerequistes).
- If not already installed, install the [CrewAI extras](https://docs.qualcomm.com/doc/80-88545-1/topic/getting-started.html#prerequisites)
- If using the [Qualcomm AI On-Prem Appliance Solution](https://docs.qualcomm.com/nav/home?product=626615100779122971), make sure that the appliance box can communicate with the relevant external APIs to achieve tool calling.

## Create a multi-agent crew

The following example creates a `crew` with two agents, each with a specific role: a researcher agent and a writer agent. The researcher agent is
tasked with explaining the top five AI models and their specific applications. The
writer agent is tasked with using the output from the researcher agent to write a blog post about it in
Markdown.

import os
    
    from crewai import LLM, Agent, Crew, Process, Task

    os.environ["OTEL_SDK_DISABLED"] = "true"
    
    llm = LLM(model="openai/Llama-3.1-8B", base_url="", api_key="", max_tokens=1024)
    
    research = Agent(
        role="researcher",
        goal="the goal of this agent is to research about new AI models and their applications",
        backstory="this agent is a data scientist researcher and is interested in AI models",
        verbose=True,
        allow_delegation=False,
        llm=llm,
        max_retry_limit=2,
    )
    
    writer = Agent(
        role="writer",
        goal="the goal of this agent is to write about AI models and their applications",
        backstory="this agent is a writer for a blog and is interested in AI models",
        verbose=True,
        allow_delegation=False,
        llm=llm,
        max_retry_limit=2,
    )
    
    task1 = Task(
        description="research about new AI models and their applications",
        agent=research,
        expected_output="give a list of the top 5 AI models and their specific applications, do a short answer",
    )
    task2 = Task(
        description="write about AI models and their applications",
        agent=writer,
        expected_output="a blog post with at least 3 main parts, in markdown format, use the list given by the researcher",
    )
    
    crew = Crew(
        name="AI Models Crew",
        agents=[research, writer],
        tasks=[task1, task2],
        verbose=True,
        share_crew=False,
        process=Process.sequential,
    )
    
    result = crew.kickoff()
    
    print("-----------------------------")
    print("Crew execution result:")
    print("-----------------------------")
    print(result)
    Copy to clipboard

The output is similar to the following:

==================================================
    Crew execution result:
    ==================================================
    # Top five AI Models and Their Applications
    
    In recent years, Artificial Intelligence (AI) has made tremendous progress, and various
    AI models have been developed to solve complex problems. In this blog post, we will
    explore the top 5 AI models and their specific applications.
    
    ### 1. Generative Adversarial Networks (GANs)
    
    GANs are a type of AI model that uses a neural network to generate new data that is
    similar to a given dataset. The model consists of two neural networks: a generator and
    a discriminator. The generator creates new data, while the discriminator evaluates the
    generated data and tells the generator whether it is realistic or not.
    
    Applications:
    
    * Image generation: GANs can be used to generate realistic images of objects, such as
    faces, animals, and buildings.
    * Data augmentation: GANs can be used to generate new data that is similar to a given
    dataset, which can be used to train machine learning models.
    * Style transfer: GANs can be used to transfer the style of one image to another
    image.
    
    ### 2. Recurrent Neural Networks (RNNs)
    
    RNNs are a type of AI model that is designed to process sequential data, such as speech,
    text, and time series data. The model consists of a series of neural networks that are
    connected in a loop, allowing the model to keep track of the context of the input data.
    
    Applications:
    
    * Language translation: RNNs can be used to translate text from one language to another.
    * Speech recognition: RNNs can be used to recognize spoken language and transcribe it
    into text.
    * Time series forecasting: RNNs can be used to forecast future values in a time series
    based on past values.
    
    ### 3. Convolutional Neural Networks (CNNs)
    
    CNNs are a type of AI model that is designed to process data that is composed of grids
    of values, such as images and videos. The model consists of a series of neural networks that are connected in a convolutional manner, allowing the model to extract features from the input data.
    
    Applications:
    
    * Image classification: CNNs can be used to classify images into different categories,
    such as objects, scenes, and actions.
    * Object detection: CNNs can be used to detect objects in images and videos.
    * Image segmentation: CNNs can be used to segment images into different regions, such as
    objects, textures, and backgrounds.
    
    ### 4. Transformers
    
    Transformers are a type of AI model that is designed to process sequential data, such as
    text and speech. The model consists of a series of neural networks that are connected in
    a loop, allowing the model to keep track of the context of the input data.
    
    Applications:
    
    * Language translation: Transformers can be used to translate text from one language to
    another.
    * Text summarization: Transformers can be used to summarize long pieces of text into shorter
    summaries.
    * Question answering: Transformers can be used to answer questions based on a given
    piece of text.
    
    ### 5. Autoencoders
    
    Autoencoders are a type of AI model that is designed to learn a compact representation
    of the input data. The model consists of an encoder and a decoder, which are connected
    in a loop. The encoder maps the input data to a lower-dimensional representation, while
    the decoder maps the lower-dimensional representation back to the original input data.
    
    Applications:
    
    * Dimensionality reduction: Autoencoders can be used to reduce the dimensionality of
    high-dimensional data, such as images and videos.
    * Generative modeling: Autoencoders can be used to generate new data that is similar to
    a given dataset.
    * Anomaly detection: Autoencoders can be used to detect anomalies in a dataset by
    identifying data points that are farthest from the mean of the dataset.
    
    In conclusion, the top 5 AI models and their specific applications have the potential
    to revolutionize many industries and fields. These models have been used in a variety
    of applications, including image generation, data augmentation, style transfer, language
    translation, speech recognition, time series forecasting, image classification, object
    detection, image segmentation, text summarization, question answering, anomaly
    detection, dimensionality reduction, and generative modeling. As AI continues to evolve,
    we can expect to see even more innovative applications of these models in the future.
    Copy to clipboard

## Integrate agents with tools

CrewAI enables you to integrate various tools with your agents for additional functionality and capabilities. For example, you can use the [EXASearchTool](https://docs.crewai.com/en/tools/search-research/exasearchtool#exasearchtool) to search the internet in real-time in response to a query.

This example requires the CrewAI tools package and an Exa API key.

- To install the package, do the following:

pip install 'crewai[tools]'
        Copy to clipboard
- Register for a free account at [exa.ai](https://exa.ai) for the exa.ai API key.

The code in this example does the following:

- Imports the EXASearchTool.
- Defines two custom tools using the `@tool` decorator.
- Creates an agent and gives the agent access to the tools.
- Defines a task with a `description` that contains multiple questions.
- Creates a `crew` that contains the agent and the task.
- Runs the tasks in crew using `crew-kickoff()`.

import os
    
    from crewai_tools import EXASearchTool, tool
    
    from crewai import LLM, Agent, Crew, Process, Task

    os.environ["OTEL_SDK_DISABLED"] = "true"
    
    # https://docs.crewai.com/tools/exasearchtool
    # You would have to set the API Key for ExaSearchTool
    
    llm = LLM(model="openai/Llama-3.1-8B", base_url="", api_key="", max_tokens=1024)

    @tool
    def AdditionTool(a: int, b: int) -> str:
        """
        can perform additions
        """
        return a + b

    @tool
    def MultiplicationTool(a: int, b: int) -> str:
        """
        can perform multiplications
        """
        return a * b

    research = Agent(
        role="professor",
        goal="the goal of this agent is to give the answer of basic calculus questions and history questions",
        backstory="this agent is a professor for middle school student",
        verbose=True,
        allow_delegation=False,
        llm=llm,
        cache=True,
        max_retry_limit=0,
        tools=[EXASearchTool(), AdditionTool, MultiplicationTool],
    )
    
    task1 = Task(
        description="what is the result of 9 + 12? what is the result of 3 * 4? what's the name of the first US president? what is the result of 12 * 7?",
        agent=research,
        expected_output="the answer of each question",
        max_retry_limit=0,
    )
    
    crew = Crew(
        name="AI Models Crew",
        agents=[research],
        tasks=[task1],
        verbose=True,
        share_crew=False,
        process=Process.sequential,
    )
    
    result = crew.kickoff()
    
    print("=" * 50)
    print("Crew execution result:")
    print("=" * 50)
    print(result)
    Copy to clipboard

The output is similar to the following:

==================================================
    Crew execution result:
    ==================================================
    The result of 9 + 12 is 21.
    The result of 3 * 4 is 12.
    The first US president was George Washington.
    The result of 12 * 7 is 84.
    Copy to clipboard

## Next steps

- [Use AutoGen to create custom agents](https://docs.qualcomm.com/doc/80-88545-1/topic/autogen.html)
- [Create custom tools without involving agents](https://docs.qualcomm.com/doc/80-88545-1/topic/3_2_langchain_custom_tools.html) using LangChain.

<!-- We also have documentation about the usage of [LangChain tools without involving agents](3_2_langchain_custom_tools). -->

Last Published: Apr 17, 2026

[Previous Topic
Use LiteLLM to abstract API calls](https://docs.qualcomm.com/bundle/publicresource/80-88545-1/topics/litellm.md) [Next Topic
Create custom agents with AutoGen](https://docs.qualcomm.com/bundle/publicresource/80-88545-1/topics/autogen.md)