Overview

The AI Market Research Agent is a powerful SDR built using Composio’s tooling ecosystem and LlamaIndex agentic framework. The agent uses Tavily to find niche ideas that can be built and marketed. With a user-friendly setup process and seamless integration capabilities, this agent can significantly enhance your outreach efficiency and sales pipeline management.

Getting Started

1

Installation

install dependencies
pip install composio-llamaindex python-dotenv
2

Connecting to tools and models

connect to required tools
composio add tavily
composio add googledocs

export OPENAI_API_KEY="<your-openai-api-key>"
3

Importing the required libraries

import required libraries
from composio_llamaindex import ComposioToolSet, App, Action
from llama_index.core.agent import FunctionCallingAgentWorker
from llama_index.core.llms import ChatMessage
from llama_index.llms.openai import OpenAI
from dotenv import load_dotenv

load_dotenv()
4

Initializing the Tools and the LLM

initialize toolset and llm
toolset = ComposioToolSet(api_key="")
tools = toolset.get_tools(apps=[App.TAVILY, App.GOOGLEDOCS])

llm = OpenAI(model="gpt-4o")
5

Setting up Function Calling Worker

setup function calling worker
prefix_messages = [
    ChatMessage(
        role="system",
        content=(
        f"""
        You are a market research agent that finds niche ideas that can be built and marketed. 
        Your users are primarily indie hackers who want to build something new and are looking for ideas. The input will 
        be a domain or a category and your job is to research extensively and find ideas that can be marketed.
        Write this content in a google doc, create a google doc before writing in it.
        I want you to show the following content:
        - Data Collection and Aggregation - Show data supporting a trend
        - Sentiment Analysis - Show customer sentiment on the topic
        - Trend Forecasting
        - Competitor Analysis
        - Competitor Benchmarking
        - Idea Validation
        """
        )
    )
]
agent = FunctionCallingAgentWorker(
    tools=tools,
    llm=llm,
    prefix_messages=prefix_messages,
    max_function_calls=10,
    allow_parallel_tool_calls=False,
    verbose=True,
).as_agent()
6

Executing the Agent

run the agent
a = input('Enter the domain or category you want to research about:')
task = f"""
The domain or category you want to research about is {a}. Use all the tools available to you to find and gather more insights on customers and market.
"""
response = agent.chat(task)
print(response)
7

Final Code

final code
from composio_llamaindex import ComposioToolSet, App, Action
from llama_index.core.agent import FunctionCallingAgentWorker
from llama_index.core.llms import ChatMessage
from llama_index.llms.openai import OpenAI
from llama_index.llms.cerebras import Cerebras
from llama_index.llms.groq import Groq
from dotenv import load_dotenv
from pathlib import Path
import os

load_dotenv()
llm = OpenAI(model='gpt-4o')
#llm = Groq(model="llama3-groq-70b-8192-tool-use-preview")
#llm = Cerebras(model="llama3.1-70b")
composio_toolset = ComposioToolSet()
tools = composio_toolset.get_tools(apps = [App.TAVILY, App.GOOGLEDOCS])

prefix_messages = [
    ChatMessage(
        role="system",
        content=(
        f"""
        You are a market research agent that finds niche ideas that can be built and marketed. 
        Your users are primarily indie hackers who want to build something new and are looking for ideas. The input will 
        be a domain or a category and your job is to research extensively and find ideas that can be marketed.
        Write this content in a google doc, create a google doc before writing in it.
        I want you to show the following content:
        - Data Collection and Aggregation - Show data supporting a trend
        - Sentiment Analysis - Show customer sentiment on the topic
        - Trend Forecasting
        - Competitor Analysis
        - Competitor Benchmarking
        - Idea Validation
        """
        )
    )
]


agent = FunctionCallingAgentWorker(
    tools=tools,  
    llm=llm,  
    prefix_messages=prefix_messages,  
    max_function_calls=10,  
    allow_parallel_tool_calls=False,  
    verbose=True,  
).as_agent()


a = input('Enter the domain or category you want to research about:')
task = f"""
The domain or category you want to research about is {a}. Use all the tools available to you to find and gather more insights on customers and market.
"""
response = agent.chat(task)
print(response)