Applied AI Engineering

When to Use AI vs Normal Code

Use AI for fuzzy, language-heavy, perceptual, or hard-to-specify work. Use normal code for explicit rules, calculations, invariants, permissions, and anything that must be deterministic.
  • Deterministic rules belong in code
  • AI helps when rules are hard to write
  • Hybrid systems are usually best
  • A model call has product costs
  • A prototype can hide production pain
AI or normal code?
TaskPreferWhy
Calculate invoice totalCodeExact deterministic formula
Extract fields from varied invoicesAI + schema validationMessy input, structured output
Check permissionCodeSecurity invariant
Summarize support threadAILanguage-heavy compression
Route ticket by meaningAI + fallbackSemantic classification
Decide whether to delete dataCode + human approvalIrreversible side effect
Sources
  • OpenAI API DocumentationProduction best practices
  • Claude Prompt Engineering and Evaluation DocsDefine success criteria and tests
  • Rules of Machine LearningML engineering guidance