By Sagar Shankaran, Founder of CallSphere
Build an AI-powered market research agent that gathers data from multiple sources, performs competitive analysis, detects industry trends, and generates structured reports with visualizations for strategic decision-making.
Key takeaways
Manual market research involves scanning news sites, reading analyst reports, tracking competitor product launches, and monitoring social sentiment — then synthesizing everything into a coherent strategic narrative. This process takes a skilled analyst one to two weeks and is outdated by the time the report is finished.
An AI market research agent continuously pulls data from multiple sources, extracts structured insights, detects emerging trends, and produces reports on demand. The analyst shifts from data gathering to strategic interpretation.
The agent needs tools to gather information from different channels. Here is a news search tool and a company profile fetcher:
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
flowchart LR
INPUT(["User intent"])
PARSE["Parse plus<br/>classify"]
PLAN["Plan and tool<br/>selection"]
AGENT["Agent loop<br/>LLM plus tools"]
GUARD{"Guardrails<br/>and policy"}
EXEC["Execute and<br/>verify result"]
OBS[("Trace and metrics")]
OUT(["Outcome plus<br/>next action"])
INPUT --> PARSE --> PLAN --> AGENT --> GUARD
GUARD -->|Pass| EXEC --> OUT
GUARD -->|Fail| AGENT
AGENT --> OBS
style AGENT fill:#4f46e5,stroke:#4338ca,color:#fff
style GUARD fill:#f59e0b,stroke:#d97706,color:#1f2937
style OBS fill:#ede9fe,stroke:#7c3aed,color:#1e1b4b
style OUT fill:#059669,stroke:#047857,color:#fff
import httpx
from datetime import datetime, timedelta
from agents import Agent, Runner, function_tool
@function_tool
async def search_news(query: str, days_back: int = 30) -> str:
"""Search recent news articles about a company or industry topic."""
# Using a news API (NewsAPI, Bing News, or similar)
since = (datetime.now() - timedelta(days=days_back)).strftime("%Y-%m-%d")
async with httpx.AsyncClient() as client:
resp = await client.get(
"https://newsapi.org/v2/everything",
params={
"q": query,
"from": since,
"sortBy": "relevancy",
"pageSize": 10,
"apiKey": "YOUR_API_KEY",
},
)
resp.raise_for_status()
articles = resp.json().get("articles", [])
results = []
for a in articles:
results.append(
f"Title: {a['title']}\n"
f"Source: {a['source']['name']}\n"
f"Date: {a['publishedAt'][:10]}\n"
f"Summary: {(a.get('description') or 'N/A')[:300]}"
)
return "\n---\n".join(results) if results else "No news articles found."
@function_tool
async def get_company_info(company_name: str) -> str:
"""Fetch basic company information from a public data source."""
async with httpx.AsyncClient() as client:
resp = await client.get(
"https://api.crunchbase.com/api/v4/autocompletes",
params={"query": company_name, "user_key": "YOUR_KEY"},
)
if resp.status_code != 200:
return f"Could not fetch info for {company_name}."
entities = resp.json().get("entities", [])
if not entities:
return "No matching companies found."
e = entities[0]["properties"]
return (
f"Name: {e.get('name')}\n"
f"Description: {e.get('short_description', 'N/A')}\n"
f"Founded: {e.get('founded_on', 'N/A')}\n"
f"Location: {e.get('location_identifiers', [{}])[0].get('value', 'N/A')}"
)
The core of market research is structured comparison. This tool organizes competitor data into a framework:
_competitor_data: list[dict] = []
@function_tool
def add_competitor(
name: str,
strengths: str,
weaknesses: str,
market_position: str,
recent_moves: str,
) -> str:
"""Add a competitor profile to the analysis framework."""
_competitor_data.append({
"name": name,
"strengths": strengths,
"weaknesses": weaknesses,
"market_position": market_position,
"recent_moves": recent_moves,
})
return f"Added {name}. Total competitors tracked: {len(_competitor_data)}"
@function_tool
def get_competitive_matrix() -> str:
"""Return a formatted competitive analysis matrix."""
if not _competitor_data:
return "No competitors added yet."
lines = []
for c in _competitor_data:
lines.append(
f"## {c['name']}\n"
f"**Position:** {c['market_position']}\n"
f"**Strengths:** {c['strengths']}\n"
f"**Weaknesses:** {c['weaknesses']}\n"
f"**Recent moves:** {c['recent_moves']}"
)
return "\n\n".join(lines)
Trend detection looks for patterns across the collected news and data. This tool uses keyword frequency analysis to surface emerging themes:
from collections import Counter
import re
_collected_texts: list[str] = []
@function_tool
def record_text_for_trends(text: str) -> str:
"""Store a text snippet for later trend analysis."""
_collected_texts.append(text)
return f"Recorded. Total snippets: {len(_collected_texts)}"
@function_tool
def detect_trends(min_frequency: int = 3) -> str:
"""Analyze all recorded texts to find frequently mentioned topics."""
if not _collected_texts:
return "No texts recorded yet."
all_text = " ".join(_collected_texts).lower()
# Extract bigrams for more meaningful trends
words = re.findall(r"[a-z]+", all_text)
bigrams = [f"{words[i]} {words[i+1]}" for i in range(len(words) - 1)]
counter = Counter(bigrams)
trending = [
(phrase, count)
for phrase, count in counter.most_common(20)
if count >= min_frequency
]
if not trending:
return "No strong trends detected. Try collecting more data."
lines = ["Detected trends (phrase: frequency):"]
for phrase, count in trending:
lines.append(f" - '{phrase}': mentioned {count} times")
return "\n".join(lines)
market_researcher = Agent(
name="Market Research Agent",
instructions="""You are a market research analyst agent. When given a company or industry:
1. Use search_news to gather recent news about the target and its competitors.
2. Use get_company_info to pull structured data on each company.
3. Record all relevant text with record_text_for_trends.
4. For each competitor, call add_competitor with a SWOT-style profile.
5. Call detect_trends to identify emerging patterns.
6. Call get_competitive_matrix to compile the analysis.
7. Produce a final report with: Executive Summary, Competitive Landscape,
Emerging Trends, Strategic Recommendations.""",
tools=[
search_news, get_company_info, add_competitor,
get_competitive_matrix, record_text_for_trends, detect_trends,
],
)
import asyncio
async def main():
result = await Runner.run(
market_researcher,
"Conduct a competitive analysis of the AI code assistant market. "
"Compare GitHub Copilot, Cursor, and Codeium. Identify trends "
"and recommend positioning strategies for a new entrant.",
)
print(result.final_output)
asyncio.run(main())
The agent searches news for each competitor, builds company profiles, populates the competitive matrix, runs trend detection across all collected articles, and outputs a structured report with an executive summary, individual competitor assessments, trend analysis, and strategic recommendations.
Schedule the agent to run on a cron job — daily or weekly — and compare new results against previous reports. Store each run's output in a database and have the agent highlight changes since the last analysis.
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
News APIs (NewsAPI, Bing News) for recent developments, Crunchbase or PitchBook for company data, SEC EDGAR for financial filings, and social media APIs for sentiment. The more diverse your sources, the richer the analysis.
Yes. Add a chart generation tool (like the one in the data analysis agent post) and instruct the agent to create bar charts comparing competitors on key metrics or line charts showing trend frequency over time.
#MarketResearch #CompetitiveAnalysis #TrendDetection #WebScraping #AIAgents #AgenticAI #LearnAI #AIEngineering
Written by
Sagar Shankaran· Founder, CallSphere
Sagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
How we built a fault-tolerant HVAC emergency triage and tech-dispatch platform on Kubernetes — three-tier CQRS, 11 micro-agents on the OpenAI Agents SDK + LangGraph, NATS JetStream, DTMF/SMS/WebSocket acceptance, circuit breakers, and an evaluation pipeline that catches regressions before they wake a tech at 3 AM.
Head-to-head: OpenAI Frontier and Anthropic's managed agent stack — strengths, fit, and what each means for enterprise AI voice and chat deployment.
Meta is building Hatch, a consumer AI agent that operates DoorDash, Reddit, and other third-party apps — Meta's answer to OpenClaw and Google Remy.
OpenAI Frontier — the new enterprise platform announced this week for building, deploying, and managing AI agents that do real work.
Q1 2026 saw a record acquisition wave: Aircall bought Vogent (May), Meta acquired Manus and PlayAI, OpenAI closed six deals. The voice AI consolidation phase has begun.
Microsoft's Copilot for Sales shipped 2026 updates that knit Dynamics, Outlook, and Teams into a single agentic surface. Here's the playbook, the per-seat pricing.
© 2026 CallSphere LLC. All rights reserved.
Made within New York