Multi-agent system for joint product quality control and machine maintenance