# Automate medical coding with Step Functions and Amazon Bedrock AgentCore

DevFeed: [Automate medical coding with Step Functions and Amazon Bedrock AgentCore](<https://devfeed.tech/articles/automate-medical-coding-with-step-functions-and-amazon-bedrock-agentcore-93907.md>)

Original publisher: [Read original article](<https://aws.amazon.com/blogs/architecture/automate-medical-coding-with-step-functions-and-amazon-bedrock-agentcore/>)

Author: Sachin Doshi

Published: 2026-10-21T21:26:23Z

Content type: tutorial

Language: en

Sources: [AWS Architecture Blog](<https://devfeed.tech/sources/aws-architecture-blog.md>)

Topics: [Amazon Bedrock AgentCore](<https://devfeed.tech/topics/amazon-bedrock-agentcore.md>), [AWS Step Functions](<https://devfeed.tech/topics/aws-step-functions.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [llm-reasoning](<https://devfeed.tech/topics/llm-reasoning.md>), [Amazon Aurora](<https://devfeed.tech/topics/amazon-aurora.md>), [function calling](<https://devfeed.tech/topics/function-calling.md>)

Tags: [agent](<https://devfeed.tech/tags/agent.md>), [agentcore](<https://devfeed.tech/tags/agentcore.md>), [agentic](<https://devfeed.tech/tags/agentic.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-agent](<https://devfeed.tech/tags/ai-agent.md>), [amazon](<https://devfeed.tech/tags/amazon.md>), [amazon-bedrock](<https://devfeed.tech/tags/amazon-bedrock.md>), [amazon-bedrock-agentcore](<https://devfeed.tech/tags/amazon-bedrock-agentcore.md>), [automate](<https://devfeed.tech/tags/automate.md>), [aws](<https://devfeed.tech/tags/aws.md>), [aws-step-functions](<https://devfeed.tech/tags/aws-step-functions.md>), [bedrock](<https://devfeed.tech/tags/bedrock.md>), [bedrock-agentcore](<https://devfeed.tech/tags/bedrock-agentcore.md>), [coding](<https://devfeed.tech/tags/coding.md>), [harness](<https://devfeed.tech/tags/harness.md>), [intermediate-200](<https://devfeed.tech/tags/intermediate-200.md>), [medical](<https://devfeed.tech/tags/medical.md>), [orchestration](<https://devfeed.tech/tags/orchestration.md>), [reasoning](<https://devfeed.tech/tags/reasoning.md>), [routing](<https://devfeed.tech/tags/routing.md>), [step-functions](<https://devfeed.tech/tags/step-functions.md>), [technical-how-to](<https://devfeed.tech/tags/technical-how-to.md>)

## AI overview

The workflow uses AWS Step Functions to keep sequencing, routing, and audit history deterministic while limiting an Amazon Bedrock AgentCore agent to ambiguous coding decisions. A Lambda first blocks terms unsafe to autocode, then checks exact dictionary and curated synonym matches; only misses reach the agent, which searches with Titan embeddings and can request study context through a separate tool. The workflow routes on the agent's reported confidence, applies a fixed 0.90 autocode gate, and checks that the selected code exists before writing it back; lower-confidence or invalid cases remain open for human review. The article reports that confidence can vary across identical runs, and vector retrieval can omit the clinically correct candidate, so thresholds need validation against known-correct data and retrieval quality limits results. Its sample is demonstrative, not for clinical use; licensed MedDRA or WHODrug dictionaries require subscriptions.

## Source excerpt

Learn how to combine deterministic orchestration with bounded agentic reasoning using AWS Step Functions and the Amazon Bedrock AgentCore harness. This medical coding workflow escalates cheapest-first: a safety block-list, then exact matching, then an AI agent only for terms that need judgment, keeping every routing decision auditable.