Build1 distinct publisher2 min readUpdated
A dev.to hands-on replaces the classifier Lambda with a Step Functions Choice state. The trade is a second Bedrock invocation on every question, including the cheap ones.
The Engineer · Build desk
Compiled by The EngineerSomething wrong?How this is made
The toll for classification is smaller than it looks, and that is the whole case for the design. The classifier state is capped at 10 output tokens, while the Claude Haiku branch is allowed 500 [4][12], a ratio of fifty to one on the output side [16]. Breakeven is therefore not close: if the classifier correctly diverts even a modest slice of traffic off Haiku and onto Nova Micro, the fixed cost of asking "simple, code, or creative" is recovered [4]. The arithmetic only turns bad if the classification is wrong often enough that answers have to be retried by a human, and the walkthrough offers no measurement of how often that happens.
The second thing worth pricing is what "zero application code" actually removes [1]. The routing logic is a JSON document, but it is not free of programming: `States.Format` assembles the classification prompt inside the state machine from the user's question [9], and a `ResultSelector` plus `ResultPath` pair narrows the classifier's response to `$.classification.category` while keeping the original `$.question` alive for the answering states [10]. The author flags the trap directly: omit `ResultPath` and the classifier's one-word answer overwrites the question you were trying to route [10]. That is a bug class you get in a state machine and rarely in a router function, where the request object usually survives by default. The logic did not go away, it changed notation, and the notation has no unit test harness attached.
What did genuinely leave the request path is the compute. The optimized `arn:aws:states:::bedrock:invokeModel` integration lets each Task call the model directly [6], so there is no function to package, no runtime to upgrade, and no cold start between the classifier and the answer. The state machine defines four Bedrock invocations across four states, one classifier and three answerers [15], and a single execution touches two of them [13].
The maintenance did not leave either, it moved. Model identifiers on Bedrock change often enough that the post tells you to check `aws bedrock list-inference-profiles` before running anything, and notes its own IDs were only current at writing [8]. The dated string in the definition is the Haiku profile [5], which means the branch most likely to rot is the expensive one, and the failure lands on exactly the requests you routed there because the small model was not good enough for them. A JSON document in a console does not warn you about that; a dependency file in a repository sometimes does.
Follow any of these and your For You feed starts watching them — no settings page required.
Ranked by verification strength, evidence, and original report placement.
The dev.to hands-on builds content-based model routing on Bedrock with zero application code: a Step Functions state machine classifies each question with a small model and a Choice state routes it to an answering model, with the whole router expressed as one JSON document.
The post frames the usual fix as a router Lambda, which means code to write, deploy and maintain, and frames the problem as sending every request to the biggest model being the easiest way to burn a Bedrock budget.
The ClassifyQuestion state calls amazon.nova-micro-v1:0 with temperature 0 and maxTokens 10, using a prompt that asks the model to classify the question as exactly one word: simple, code, or creative.
The RouteByCategory Choice state sends classifications matching *code* to AnswerWithHaiku (us.anthropic.claude-haiku-4-5-20251001-v1:0) and *creative* to AnswerWithNovaLite (amazon.nova-lite-v1:0), with a Default of AnswerWithNovaMicro (amazon.nova-micro-v1:0).
Step Functions has an optimized integration for Bedrock, arn:aws:states:::bedrock:invokeModel, so states call models directly with no Lambda in the path; retries and execution history come built in and the visual workflow doubles as documentation.
The walkthrough creates a Step Functions role trusted by states.amazonaws.com with an inline policy allowing bedrock:InvokeModel on Resource "*", and notes that for production the Resource should be scoped to the specific model and inference-profile ARNs.
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
Artifact fully reproduced, outcomes unmeasured
The complete state machine definition, IAM policy and three test inputs with expected routes are published inline, so every mechanical claim — classifier config, routing table, token caps, invocation count — is directly verifiable from the artifact. Evidence stops there: one publisher, one author, no measured cost, latency or classification-accuracy data, and no third-party reproduction.
No adoption signal in sources
The cluster contains a tutorial only. There is no release, deployment, usage disclosure, benchmark or pricing datapoint — not even a claim that the pattern runs in a production workload — so adoption cannot be scored without inventing facts.
Cost framing overstated relative to shown design
The post's headline promise — 'zero code' routing that fixes a Bedrock bill 'dominated by simple questions hitting an expensive model' — runs ahead of its own artifact. Routing logic still exists as versioned JSON with intrinsic functions and state I/O traps the author must warn about, and every question now costs two model calls, with default-route questions billed as two Nova Micro calls. No savings figure, latency number or classifier accuracy rate is offered, and the silent default fallback on malformed classifier output is presented as tolerance rather than a quality risk. The mechanics themselves are honestly and precisely reported, which keeps the gap moderate rather than large.
Practitioner-brand and vendor-aligned promotion
The author signs off as 'Maruchin Tech — 12x AWS Certified | Cloud & AI for manufacturing and supply chain', and the post cross-promotes a YouTube version of the same hands-on, so credential and audience building are explicit in the source. The content is also single-vendor by construction — an AWS-native pattern that increases reliance on Step Functions and Bedrock — which biases toward presenting the approach favorably. Offsetting this, the author volunteers caveats against interest: scope the IAM Resource in production, re-check churning model IDs, and expect classifier output to be messy.
Mechanics reliable, consequences unverified
High confidence that the described artifact works as written, since the definition is published in full and the derived claims follow arithmetically from it. Low confidence in the story's economic and reliability implications: one publisher, one self-interested author, zero adoption evidence, and no measurement of cost, latency or classification accuracy.
build
Bedrock model IDs behind AppConfig flags: the swap gets cheaper, the approval gets thinner1 distinct publisher
build
Query-aware compression: AWS bets a second model call is cheaper than a fat RAG prompt1 distinct publisher
build
Force the tool call, then hand Lightsail a long-lived key1 distinct publisher
product
Anthropic's usage policy says no explicit content. Opus 4.6 said yes 10 times out of 10.1 distinct publisher
Distinct publishers with included, body-backed reporting in this cluster.
dev.to
1 article · August 22, 2026