In today's data-driven world, businesses need more than just static reports—they need intelligent, real-time insights that drive decision-making. Enter the HazelJS Business Intelligence system, a powerful agent-based platform that transforms raw business data into actionable intelligence.
What is HazelJS?
HazelJS is a modern framework for building agent-based applications. It provides a robust foundation for creating intelligent systems that can analyze data, generate insights, and provide recommendations—all orchestrated through a clean, TypeScript-based architecture.
The Business Intelligence system built on HazelJS demonstrates the framework's capabilities by creating a fully interactive dashboard that combines:
Data ingestion from multiple sources
AI-powered analysis through specialized agents
Real-time visualization with interactive charts
Automated recommendations based on business metrics
Architecture Overview
The system is built around three core agents, each with a specific responsibility:
DataInsightsAgent
This agent analyzes business data to identify trends, opportunities, and anomalies. It processes sales, customer, and operational data to surface meaningful patterns that might otherwise go unnoticed.
ReportGeneratorAgent
Once insights are identified, this agent compiles them into comprehensive reports suitable for executive review. It summarizes findings, highlights critical issues, and provides context for decision-makers.
RecommendationEngineAgent
The most actionable component, this agent transforms insights into concrete recommendations. It prioritizes actions based on potential impact and provides estimated ROI and timeline information.
BusinessIntelligenceOrchestrator
The orchestrator coordinates all agents, ensuring they work together seamlessly. It manages the flow of data from raw input through analysis to final recommendations.
Key Features
Interactive Dashboard
The dashboard provides a modern, tabbed interface with four main sections:
Dashboard Tab
- Real-time KPI cards showing Total Sales, Active Customers, Average Efficiency, and Insights Generated
- Interactive sales trend chart powered by Chart.js
- Filterable insights with search, category, and impact filters
- Business recommendations with priority indicators
Data Entry Tab
- Forms for adding sales records with amount and customer information
- Customer entry forms with segmentation options
- Operations data input for efficiency tracking
- Clear data functionality for fresh starts
Scenarios Tab
- Pre-built business scenarios for testing and demonstration
- Quick data population for development and testing
Reports Tab
- Executive report generation with summary metrics
- CSV and JSON export functionality for data portability
Real-Time Updates
The dashboard automatically refreshes every 30 seconds, ensuring that KPIs, charts, and insights stay current. This live update capability is crucial for monitoring rapidly changing business metrics.
Advanced Filtering
Insights can be filtered by:
- Search terms - Find specific insights by keyword
- Category - Filter by trends, opportunities, anomalies, or risks
- Impact level - Focus on critical, high, medium, or low impact items
Data Export
Users can export business data in two formats:
- CSV - Spreadsheet-compatible format with separate sections for sales, customers, and operations
- JSON - Structured format for integration with other systems
Getting Started
Prerequisites
- Node.js >= 18.0.0
- npm or yarn package manager
Installation
- Clone the HazelJS repository or copy the hazeljs-business-intelligence directory
- Navigate to the project directory
- Install dependencies:
npm install
Note: If running outside the HazelJS monorepo, ensure your package.json includes all required dependencies:
{
"dependencies": {
"@hazeljs/agent": "^0.8.7",
"@hazeljs/core": "^0.8.7",
"@hazeljs/eval": "^0.8.7",
"reflect-metadata": "^0.2.2"
}
}
Running the Application
npm run dev
The dashboard will be available at http://localhost:3000/business-intelligence
Code Example: Adding a Custom Agent
The HazelJS framework makes it easy to extend the system with custom agents. Here's how you might add a new agent for inventory analysis:
import { Agent, AgentConfig } from '@hazeljs/agent';
interface InventoryInsight {
lowStockItems: string[];
overstockItems: string[];
reorderRecommendations: string[];
}
class InventoryAgent extends Agent<<InventoryInsight> {
constructor(config: AgentConfig) {
super(config);
}
async analyze(data: any): Promise<<InventoryInsight> {
const lowStock = data.inventory.filter(item => item.quantity < item.reorderPoint);
const overstock = data.inventory.filter(item => item.quantity > item.maxStock);
return {
lowStockItems: lowStock.map(item => item.name),
overstockItems: overstock.map(item => item.name),
reorderRecommendations: lowStock.map(item =>
`Reorder ${item.name}: ${item.reorderQuantity} units`
)
};
}
}
Use Cases
Sales Performance Monitoring
Track sales trends in real-time, identify seasonal patterns, and receive recommendations for inventory adjustments based on historical data.
Customer Insights
Analyze customer segments, identify at-risk customers, and get recommendations for retention strategies based on purchase patterns.
Operational Efficiency
Monitor operational metrics, identify bottlenecks, and receive recommendations for process improvements based on efficiency data.
Executive Reporting
Generate comprehensive reports for stakeholders with automated insights and prioritized recommendations for strategic planning.
Technical Highlights
Type Safety
Built entirely in TypeScript, the system provides full type safety and excellent IDE support for development.
Decorator-Based Routing
The HazelJS framework uses decorators for clean, declarative routing:
@Controller('/business-intelligence')
class BusinessIntelligenceController {
@Get('/insights')
async getInsights(@Res() res: any) {
// Handler logic
}
@Post('/add-sale')
async addSale(@Body() body: { amount?: number; customerName?: string }, @Res() res: any) {
// Handler logic
}
}
Dependency Injection
The framework provides robust dependency injection for managing services and agents.
Modular Architecture
Each component is designed to be modular and reusable, making it easy to extend or customize for specific business needs.
Future Enhancements
The system is designed to be extensible. Potential future enhancements include:
- Integration with external data sources (databases, APIs)
- Machine learning models for predictive analytics
- Multi-tenant support for SaaS applications
- Advanced visualization options with more chart types
- Real-time notifications and alerts
- Integration with popular BI tools
Conclusion
The HazelJS Business Intelligence system demonstrates the power of agent-based architectures for building intelligent business applications. By combining real-time data processing, AI-powered analysis, and interactive visualization, it provides a comprehensive solution for modern business intelligence needs.
Whether you're monitoring sales performance, analyzing customer behavior, or optimizing operations, this system provides the tools you need to turn data into actionable intelligence—all built on the robust HazelJS framework.
Ready to get started? Clone the repository, install the dependencies, and start building your intelligent business intelligence dashboard today!
Repo: hazeljs-business-intelligence


Top comments (0)