AWS recommends handling rule-based workflow steps in code, using constrained decisions for fixed choices and right-sized models for open-ended work.
AWS’s November 17, 2026, guidance for generative AI developers starts cost control with a basic design question: does a workflow step need a model? The company argues that routing routine checks and formatting through a model can add expense, latency and variable outputs, especially when those calls accumulate at production scale.
The recommended approach separates work into three paths. Deterministic code can handle checkable conditions such as input formats, schemas, keywords and numeric ranges. A constrained decision call can select among a fixed set of choices, with uncertain cases sent for additional review. Open-ended tasks—such as drafting a customer response or interpreting prose—remain candidates for a model sized to the task’s quality requirements.
AWS illustrates the distinction with a customer-support assistant. An order-number format check could run through API Gateway request validation or an AWS Lambda function. A keyword rule could route clear requests such as refunds, while less clear messages go to a constrained decision call. For ticket assignment among support queues, the system can choose from a fixed list and escalate uncertain results; drafting a reply is left to an Amazon Bedrock model.
The post also suggests having a model draft a reusable rule, such as a regular expression or JSON schema, then reviewing and committing it so the rule runs as code. For steps that still need a model, teams should set a quality floor, cost ceiling and latency target, test options against labeled examples, and make model changes reversible. AWS also recommends monitoring cases resolved by rules to detect when workflow assumptions no longer hold.
Its examples use AWS services including Step Functions, Lambda, API Gateway and Amazon Bedrock, but the central recommendation is about allocating model calls: use code for explicit rules, constrained calls for bounded choices, and models for tasks that require interpretation or generation.

