Automate the spine with rules. Use AI where the input is messy.
Use rules for the path you can already code. Use AI where the input is messy, like a PDF or a paragraph.
Draw the workflow as states, then mark the messy arrows
Write the states a job can be in: received, waiting on customer, in review, ready to post, posted, failed. Write what moves it. Most arrows are boring: a user clicks approve; a payment webhook says settled; a timer expires. Those arrows belong in code. They should be testable. They should log. They should retry with backoff. None of that requires a model.
A default pattern that stays boring on purpose
Replace the nouns with yours. Keep the gates.
- Trigger (form, mail, webhook, schedule)
- Normalize and store the raw payload
- Deterministic checks (duplicates, required fields, permissions)
- AI step only if still unstructured (classify, extract, draft)
- Validate against schema and policy
- Write to system of record or enqueue review
- Human on high-impact transitions
- Log, metric, dead-letter
Send the state machine and the messy arrow
If you can list statuses and the one handoff that is still a human reading, we can say whether you need a worker, a model, an agent, or a source of truth you do not have yet.