Skip to main content
Challenge

Visual Defect & Asset Quality Agent with Mastra AI and Replicate Vision Models

Undetected physical defects on high-speed motor control assembly lines lead to expensive plant downtime and product recalls. Build a TypeScript visual inspection workflow using Mastra AI and Replicate vision inference models to detect component assembly flaws in real time. Achieve 98% defect classification accuracy with sub-500ms execution latency.

EngineeringHosted by Vera
Challenge brief

What you are building

The core problem, expected build, and operating context for this challenge.

Develop a TypeScript Mastra AI workflow that routes camera frame captures to Replicate-hosted vision models for real-time assembly line defect classification.

Delivery guide

How work is evaluated

Evaluation

Evaluates visual defect classification accuracy and inference pipeline execution speed.

Datasets

Challenge datasets

Public datasets, plus the private datasets you have access to.

Evaluation rubric

How submissions are scored

These dimensions define what the evaluator checks and which criteria separate a passable run from a strong one.

Dimensions
2 scoring checks
Binary
2 pass or fail dimensions
Ordinal
0 scaled dimensions
Dimension 1

latency_check

Verifies execution latency is below 500 milliseconds limit.

Binary check

This dimension contributes its full weight only when the submission satisfies the requirement. Partial credit is not awarded.

Dimension 2

classification_accuracy

Accuracy of defect classification across vision benchmark set. • target: 0.98 • range: 0-1

Binary check

This dimension contributes its full weight only when the submission satisfies the requirement. Partial credit is not awarded.

Learning goals

What you should walk away with

  • Build a Mastra AI workflow pipeline with step functions for image payload processing

  • Integrate Replicate API inference endpoints running lightweight object detection vision models

  • Classify assembly component anomalies and generate instant rejection trigger signals

Resources and assets

Reference links and supporting material

Dataset notes

Annotated factory assembly component imagery depicting common mechanical flaws like loose connections and surface scratches.

Challenge setup

Evaluates visual defect classification accuracy and inference pipeline execution speed.

Challenge input

JSON with image_url, component_id, and expected_inspection_type

Mastra AI

TypeScript agent and workflow engine

Replicate

Host for open-source visual detection models

Evaluated output

JSON containing defect_detected boolean, defect_type, confidence, and processing_time_ms

Evaluation checks
  • Verifies execution latency is below 500 milliseconds limit.
  • Accuracy of defect classification across vision benchmark set. • target: 0.98 • range: 0-1
Configured evaluation evidence
  • Benchmark: Industrial Vision Quality Inspection
  • Classification Accuracy target: 0.98
  • 1 public reference case
Configured runtime
  • JavaScript execution harness
  • javascript sandbox (unavailable on Versalist)

Summary shows the first task, up to three tools, and up to three evidence items. Open the technical recipe to view all configured items.

View technical recipe

Configured tools

Action Space
  • Mastra AI · Required
  • Replicate · Optional
Orchestration
  • Mastra AI · Required

Evaluation contract

  • latency_check · Weight 1
  • classification_accuracy · Weight 1

Metrics

  • classification_accuracy · Target 0.98

Benchmarks

  • Industrial Vision Quality Inspection
  • robotics

Reference cases

  • 1 public reference case

Workflow tasks

  1. Task 1

    Input: JSON with image_url, component_id, and expected_inspection_type

    Output: JSON containing defect_detected boolean, defect_type, confidence, and processing_time_ms

    Execution harness: JavaScript

Evaluation tools

  • Mastra AI · framework
  • Replicate · inference-model-runtime

Recipe freeze marker

No recipe freeze time is recorded.

Frequently Asked Questions about Visual Defect & Asset Quality Agent with Mastra AI and Replicate Vision Models