Overview
The TamboEngine AI service:- Analyzes completed production batches
- Identifies unusual patterns in production, waste, and costs
- Generates actionable alerts with severity levels
- Learns from historical data to improve accuracy
- Provides establishment-specific insights
AI Service
The TamboEngine is a separate AI service that communicates with the main backend via REST API. It runs independently at
TAMBO_AI_URL.How Alerts Work
Analysis Trigger
Alerts are generated when specific conditions are met:Batch Completion
When a production batch is marked as complete, the system checks if analysis should run.
The 15-batch minimum ensures the AI has sufficient data for meaningful pattern detection.
Analysis Payload
The data sent to the AI service includes:- Production volumes and trends
- Waste patterns by type
- Cost variations
- Efficiency metrics
- Cross-batch comparisons
Retrieving Alerts
Get All Alerts
Fetch alerts for an establishment:Get Recent Alerts
Fetch the most recent alerts for quick overview:Get Unseen Alert Count
Check how many alerts haven’t been viewed:Marking Alerts as Seen
Once a user reviews an alert, mark it as seen:Marking alerts as seen helps track which issues have been acknowledged and addressed.
Alert Enrichment
Alerts are enriched with batch information for better context:Alert Types
The AI can generate various types of alerts:High Waste
Detects when waste exceeds historical averages or industry benchmarks
Cost Anomalies
Identifies unusual cost patterns or unexpected expense increases
Production Efficiency
Highlights opportunities to improve yield or reduce processing time
Pattern Deviations
Flags when production patterns deviate from established norms
Severity Levels
Alerts are typically categorized by severity:- Alta (High)
- Media (Medium)
- Baja (Low)
Immediate attention required
- Significant production issues
- Major cost overruns
- Critical waste levels
- Urgent intervention needed
Dashboard Integration
Alerts are displayed in the dashboard sidebar:- Fetches alerts for the current establishment
- Displays unseen alerts prominently
- Allows marking alerts as seen
- Links to related batches for investigation
Error Handling
The system gracefully handles AI service issues:Fallback Behavior
- AI service hasn’t generated alerts yet (404)
- Service is temporarily unavailable
Use Cases
Waste Spike Investigation
Waste Spike Investigation
Scenario: Alert for elevated waste
- Alert appears in dashboard: “Mermas elevadas - Lote #1247”
- User clicks alert to view details
- System shows batch information and waste breakdown
- User investigates:
- Reviews waste type (Natural, Technical, etc.)
- Checks observations for clues
- Compares with similar batches
- User identifies root cause (e.g., equipment issue)
- User marks alert as seen after addressing
Cost Optimization
Cost Optimization
Scenario: Alert for cost anomaly
- Alert: “Costos 20% sobre promedio - Queso Cheddar”
- User reviews cost breakdown for flagged batch
- Identifies raw milk cost spike
- Investigates supplier pricing
- Negotiates better rates or switches supplier
- Marks alert as seen
Efficiency Improvement
Efficiency Improvement
Scenario: Alert for production inefficiency
- Alert: “Rendimiento bajo - considerar ajustes de proceso”
- User compares flagged batch with high-performing batches
- Identifies process variation
- Implements standardized procedures
- Monitors improvement in subsequent batches
- Marks alert as seen
Best Practices
Complete Batches Promptly
Mark batches complete as soon as production finishes to ensure timely AI analysis
Review Daily
Check the alerts section daily to stay on top of issues
Investigate Thoroughly
Don’t just dismiss alerts—investigate root causes
Track Resolution
Mark alerts as seen only after addressing the underlying issue
System Requirements
Minimum Data Requirements:
- At least 15 completed batches
- Batches must be from the last 15 days
- Batches must include waste and cost data
- All batches must have
estado: true
Performance Considerations
Background Processing
AI analysis runs in background; doesn’t block batch completion
Timeout Protection
15-second timeout prevents indefinite waiting on AI service
Graceful Degradation
System remains functional even if AI service is down
Efficient Queries
Alert enrichment batches database queries for performance
API Reference
| Endpoint | Method | Purpose |
|---|---|---|
/api/alertas/:idEstablecimiento | GET | Get all alerts for establishment |
/api/alertas/:idEstablecimiento/ultimas | GET | Get recent alerts |
/api/alertas/:idEstablecimiento/no-vistas | GET | Get count of unseen alerts |
/api/alertas/:idAlerta/visto | PUT | Mark alert as seen |
AI Service Endpoints
The TamboEngine AI service exposes:| Endpoint | Method | Purpose |
|---|---|---|
/api/v1/tambo/analyze | POST | Trigger production analysis |
/api/v1/tambo/alertas/:idEstablecimiento | GET | Fetch alerts |
/api/v1/tambo/alertas/:idEstablecimiento/ultimas | GET | Get recent alerts |
/api/v1/tambo/alertas/:idAlerta/visto | PUT | Mark as seen |
/api/v1/tambo/alertas/:idEstablecimiento/no-vistas | GET | Get unseen count |
