LLM Routing with Zero Code: Content-Based Model Selection on Bedrock with Step Functions
Sending every request to your biggest model is the easiest way to burn a Bedrock budget — a "what's the capital of Japan?" question doesn't need the same model as "write FizzBuzz in Python". The usual fix is a router Lambda, but that means code to write, deploy, and maintain. In this hands-on, we'll build content-based model routing with zero application code : an AWS Step Functions state machine…
This hands-on guide shows how to build an AWS Step Functions state machine for routing requests to the appropriate large language model (LLM) on AWS Bedrock, without writing any code. The key steps are creating an IAM role with permissions for Bedrock model invocations, and defining the state machine in JSON. The machine begins with a "ClassifyQuestion" task that uses a small model to classify incoming questions as "simple", "code", or "creative".
A "Choice" state then routes each category to its designated answering model: Claude Haiku for code, Amazon Nova Lite for creative writing, and Nova Micro for all other questions. The routing logic lives entirely in the state machine, rather than requiring a custom Lambda function. This approach avoids the cost and maintenance overhead of a routing Lambda, while still providing built-in features like retries and execution history. To use the latest model IDs, check aws bedrock list-inference-profiles or the console.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.