An AI-powered market research agent that analyzes retail companies for sales quota planning. It retrieves historical financial metrics (revenue, market cap, physical store count), predicts next-year performance with bear/base/bull ranges, and provides long-format reasoning with source citations.
Built with Microsoft Agent Framework and deployed as a hosted agent in Azure AI Foundry.
You: "Analyze Target Corporation for my quota planning"
Agent:
π Historical Data β structured JSON with revenue, market cap, store count by year
π Prediction β next-year bear/base/bull ranges with methodology and assumptions
π Reasoning β 1000-2000 word narrative with source citations
π Excel β downloadable .xlsx with Historical + Prediction sheets
Users can iterate conversationally β correct data, add context ("they announced 50 new stores"), and the agent re-predicts.
| Component | Purpose |
|---|---|
| yfinance | Deterministic revenue and market cap from Yahoo Finance |
| Bing Grounding | Physical store counts, analyst forecasts, industry context |
| GPT-4o | Synthesize data, generate predictions, write reasoning |
| openpyxl | Excel artifact generation |
| Agent Framework | Tool orchestration, multi-turn conversation |
| Foundry Hosted Agent | Managed deployment with portal chat UI |
- Python 3.13+
- Azure subscription with AI Foundry access
- Azure Developer CLI (azd) 1.25.3+
- Docker (for container builds)
git clone https://github.com/ericchansen/market-research.git
cd market-research
python -m venv .venv
source .venv/bin/activate # Linux/Mac
# .venv\Scripts\activate # Windows
pip install -r requirements.txt -r requirements-dev.txt
pytest# Install the Foundry extension
azd ext install microsoft.foundry
# Provision Azure resources (AI Foundry, Bing, OpenAI, ACR)
azd provision
# Deploy the agent
azd deployAfter deployment, the agent is available in the Foundry portal chat UI.
{
"company": "Target Corporation",
"ticker": "TGT",
"sector": "Consumer Defensive",
"historical": [
{
"fiscal_year": 2024,
"revenue_usd_millions": 107600,
"market_cap_usd_millions": 73200,
"physical_store_count": 1956,
"store_count_change_yoy": 8,
"revenue_per_store_usd_millions": 55.0,
"sources": {"financial": "Yahoo Finance", "store_count": "https://..."}
}
]
}{
"prediction": {
"fiscal_year": 2027,
"revenue_usd_millions": {"bear": 103000, "base": 108500, "bull": 114000},
"market_cap_usd_millions": {"bear": 60000, "base": 72000, "bull": 85000},
"physical_store_count": {"bear": 1925, "base": 1960, "bull": 2010},
"confidence": "moderate",
"methodology_summary": "3-year CAGR + analyst consensus adjustment",
"key_assumptions": ["No major recession", "E-commerce mix stable"]
}
}βββ main.py # Agent server entry point
βββ src/
β βββ agent.py # Agent definition with tools
β βββ prompts.py # System prompt
β βββ schemas.py # Pydantic output models
β βββ tools/
β βββ financial_data.py # yfinance wrapper
β βββ excel_generator.py # Excel artifact builder
βββ tests/ # Unit tests
βββ infra/ # Bicep templates for Azure resources
βββ Dockerfile # Container definition
βββ agent.manifest.yaml # Foundry agent manifest
βββ azure.yaml # azd project config
- Bing Grounding: Each query triggers multiple Bing searches. Cost is billed separately from model inference. See Bing Grounding pricing.
- GPT-4o: Standard token-based pricing per query. A typical analysis uses 2000-4000 input tokens and 3000-6000 output tokens.
- yfinance: Free, no API key required.
Predictions are LLM-synthesized estimates based on public data and analyst consensus. They are not financial advice. Always validate with authoritative sources before making business decisions.
See CONTRIBUTING.md for development setup and PR guidelines.