Error Diagnosis Agent

Takes a failed query and its engine error, returns root cause, a category, and corrected SQL where derivable.

Inputs

Categories

Classified as one of: syntax, permission, reference (missing table/column), type (mismatch), constraint (FK / NOT NULL / unique), connectivity, unknown.

Output

{
  rootCause: 'concise explanation',
  category: 'syntax' | 'permission' | 'reference' | 'type' | 'constraint' | 'connectivity' | 'unknown',
  correctedSql: 'fixed SQL or undefined',
  steps: ['actionable fix step'...]
}