The BusinessIntelligenceTool provides real-time business intelligence, KPI monitoring, and performance analytics for mindX. It enables business-focused agents (like CEO Agent) to monitor business metrics, generate reports, and make data-driven decisions.
File: tools/business_intelligence_tool.py
Class: BusinessIntelligenceTool
Version: 1.0.0
Status: ✅ Active
class BusinessIntelligenceTool:
- business_data: Dict - Sample business data
- logger: Logger - Logging
@dataclass
class BusinessMetrics:
timestamp: str
revenue_metrics: Dict[str, float]
cost_metrics: Dict[str, float]
performance_metrics: Dict[str, float]
growth_metrics: Dict[str, float]
efficiency_metrics: Dict[str, float]
@dataclass
class KPIReport:
report_id: str
timestamp: str
period: str
kpis: Dict[str, Any]
trends: Dict[str, str]
alerts: List[str]
recommendations: List[str]
get_business_metricsParameters:
period (str, optional): Time period (default: "current")Returns: BusinessMetrics object
generate_kpi_reportParameters:
period (str, optional): Report period (default: "monthly")Returns: KPIReport object
analyze_performance_trendsParameters:
metric (str): Metric to analyzetimeframe (int, optional): Days to analyze (default: 30)Returns: Trend analysis dictionary
get_financial_dashboardParameters: None
Returns: Financial dashboard dictionary
monitor_business_healthParameters: None
Returns: Business health report
from tools.business_intelligence_tool import BusinessIntelligenceTool
tool = BusinessIntelligenceTool()
Get current metrics
metrics = await tool.get_business_metrics()
print(f"MRR: ${metrics.revenue_metrics['monthly_recurring_revenue']:,.2f}")
print(f"Growth Rate: {metrics.growth_metrics['revenue_growth_rate']:.1f}%")
# Generate monthly KPI report
report = await tool.generate_kpi_report(period="monthly")
print(f"KPIs tracked: {len(report.kpis)}")
print(f"Alerts: {len(report.alerts)}")
print(f"Recommendations: {len(report.recommendations)}")
# Check business health
health = await tool.monitor_business_health()
print(f"Health Score: {health['overall_health_score']:.1f}")
print(f"Status: {health['health_status']}")
print(f"Strengths: {health['strengths']}")
Tracks key performance indicators:
Analyzes trends:
Calculates business health:
Generates:
Designed for CEO Agent usage:
# In CEO Agent
metrics = await self.business_intelligence.get_business_metrics()
report = await self.business_intelligence.generate_kpi_report()
Can integrate with:
# Get all business insights
metrics = await tool.get_business_metrics()
report = await tool.generate_kpi_report()
health = await tool.monitor_business_health()
dashboard = await tool.get_financial_dashboard()
Analyze trends
revenue_trend = await tool.analyze_performance_trends("revenue", timeframe=90)
dataclasses: Data structuresdatetime: Timestampsuuid: Report IDsutils.logging_config.get_logger: Loggingbusiness_data = {
"revenue": {...},
"costs": {...},
"customers": {...},
"operations": {...}
}