Study guide
6.2 Step Functions Orchestration & Human-in-the-Loop Workflows
AWS Certified Generative AI Developer - Professional AIP-C01
Track your progress as you read
Finished sections get a check mark.
1 Chapter 1: Exam Overview & Foundation Model Fundamentals
1.1 AIP-C01 Exam Structure, Logistics & Passing Strategy 1.2 AIP-C01 Scoring & Professional Decision Strategy 1.3 Foundation Model Landscape & Model Selection on Amazon Bedrock 1.4 Model Abstraction, Controlled Switching & Resilience 1.5 Customization Spectrum: Prompting vs RAG vs Fine-Tuning vs Continued Pre-training 1.6 Custom Model Deployment & Lifecycle Management
2 Chapter 2: Bedrock Knowledge Bases & RAG Architectures
2.1 Managed RAG Architecture with Bedrock Knowledge Bases 2.2 Knowledge Source Integration, Synchronization & Freshness 2.3 Data Ingestion, Parsing & Chunking Strategies 2.4 Embedding Models & Vector Representations 2.5 Vector Index Scale, Migration & Retrieval Evaluation 2.6 Vector Database Selection: OpenSearch Serverless vs Aurora pgvector vs Managed Stores 2.7 Vector Store Security, Multi-Tenancy & Connectivity
3 Chapter 3: Advanced Vector Search, Indexing & Data Compliance
3.1 Hybrid Search, Metadata Filtering & Semantic Reranking 3.2 Metadata Filtering, Reranking & Query Transformation 3.3 Fine-Tuning & Continued Pre-Training Data Pipeline Engineering 3.4 Data Validation, Multimodal Processing & Model Formatting 3.5 Data Privacy, Data Residency & Compliance Governance 3.6 Privacy Preservation, Source Lineage & Audit Evidence
4 Chapter 4: Prompt Engineering & Bedrock Runtime APIs
4.1 Advanced Prompt Engineering Techniques & Inference Parameters 4.2 Inference Parameters, Prompt Governance & Regression 4.3 Converse API vs InvokeModel API & Message Formatting 4.4 Tool Calling, FM API Resilience & Model Routing 4.5 Streaming Architectures & Asynchronous Event Processing 4.6 Resilient Streaming, Deployment & Asynchronous Processing
5 Chapter 5: Amazon Bedrock Agents & Tool Integration
5.1 Agentic Architecture, ReAct Reasoning Loops & Orchestration 5.2 Agent Frameworks, MCP & Lifecycle Management 5.3 Action Groups, OpenAPI Schemas & AWS Lambda Integration 5.4 Agent Memory, Session State & Multi-Agent Collaboration Patterns 5.5 Persistent State & Multi-Agent Coordination 5.6 Advanced Agent Prompt Templates & Flow Customization 5.7 Agent Safeguards, Tool Reliability & Cost Control
6 Chapter 6: Workflow Orchestration & Application Integration
6.1 Amazon Bedrock Prompt Flows & Visual Orchestration 6.2 Step Functions Orchestration & Human-in-the-Loop Workflows 6.3 Enterprise Integration: API Gateway, AppSync, and EventBridge 6.4 Hybrid Integration, GenAI Gateways & CI/CD Tooling
7 Chapter 7: AI Safety & Guardrails for Amazon Bedrock
7.1 Guardrails Architecture, Denied Topics & Content Filters 7.2 Content Safety, Defense in Depth & Threat Detection 7.3 Sensitive Information Filters & PII Redaction/Masking 7.4 Contextual Grounding Checks & Hallucination Prevention
8 Chapter 8: Security, Access Control & Network Architecture
8.1 IAM Least Privilege & Resource Policies for Bedrock 8.2 PrivateLink VPC Endpoints & Network Isolation 8.3 Encryption with AWS KMS & Cross-Account Access Patterns
9 Chapter 9: Governance, Auditing & Operational Logging
9.1 SageMaker Model Cards & AI Governance Frameworks 9.2 Lineage, Fairness, Transparency & Continuous Governance 9.3 Invocation Logging, CloudTrail Auditing & Observability 9.4 Responsible AI, Bias Mitigation & Red Teaming Methodologies
10 Chapter 10: Performance, Throughput & Cost Optimization
10.1 On-Demand vs Provisioned Throughput & Capacity Planning 10.2 Capacity Measurement, Scaling Patterns & Resilience 10.3 Batch Inference & Bedrock Intelligent Prompt Routing 10.4 Intelligent Prompt Routing & Application Eligibility 10.5 Prompt Caching, Token Optimization & Latency Reduction
11 Chapter 11: Testing, Evaluation & Troubleshooting GenAI Solutions
11.1 Amazon Bedrock Model Evaluation (Automatic & Human Workflows) 11.2 Human, RAG & Continuous Evaluation 11.3 Evaluation Metrics & RAG Quality Benchmarking (Ragas, ROUGE, BLEU) 11.4 RAG and Agent Performance Evaluation 11.5 CloudWatch Metrics, Throttling & Operational Observability 11.6 Quota Diagnosis, Retry Control & Operational Troubleshooting 11.7 Troubleshooting Common GenAI Failure Modes & Agent Traces 11.8 Prompt Maintenance, Content Handling & Deployment Validation
6.2 Step Functions Orchestration & Human-in-the-Loop Workflows
Key Takeaways Explain This Topic AI
AWS Step Functions provides an optimized service integration (arn:aws:states:::bedrock:invokeModel) that invokes Amazon Bedrock models directly without requiring intermediate AWS Lambda compute layers.
The Step Functions Distributed Map state bounds simultaneous work with MaxConcurrency; RPM or token-rate limits still require measured pacing, retries, or a separate rate-control mechanism.
Production-grade GenAI state machines implement ASL Retry blocks with exponential backoff and jitter targeting Bedrock.ThrottlingException and Bedrock.ModelTimeoutException, paired with Catch blocks for graceful model fallback.
Human-in-the-loop (HITL) workflows leverage the .waitForTaskToken callback pattern, pausing execution indefinitely (up to 1 year) until an external reviewer returns a Task Token via SendTaskSuccess or SendTaskFailure.
Standard Workflows are mandatory for human-in-the-loop workflows because they support the .waitForTaskToken callback pattern and extended execution durations, whereas Express Workflows have a 5-minute maximum runtime and do not support task tokens.
Last updated: September 2026
6.2 Step Functions Orchestration & Human-in-the-Loop Workflows
This independent study guide by ExamFinch helps candidates prepare for the AWS Certified Generative AI Developer - Professional (AIP-C01) examination. While Amazon Bedrock Prompt Flows provides low-code visual orchestration for model-centric graphs, enterprise architectures often demand broader workflow orchestration spanning dozens of AWS services, complex distributed transactions, parallel batch operations across petabytes of data, and asynchronous human intervention.
AWS Step Functions serves as the enterprise-grade orchestration backbone for these advanced architectures. Through native optimized service integrations, sophisticated error-handling primitives, and callback task token patterns, Step Functions coordinates resilient generative AI pipelines that adhere to enterprise reliability and compliance standards.
Native Bedrock Optimized Service Integration
Step Functions provides an optimized task integration for Amazon Bedrock ( arn:aws:states:::bedrock:invokeModel ), eliminating the need to write and maintain intermediate AWS Lambda functions simply to invoke foundation models.
Key Capabilities & Mechanics
Zero Compute Overhead: Step Functions directly calls the Bedrock runtime API data plane, serializing request parameters and parsing response bodies natively within the state machine engine.
IAM Execution Role: The Step Functions state machine execution role must be granted permissions for bedrock:InvokeModel on the specific model ARN (e.g., arn:aws:bedrock:*::foundation-model/anthropic.claude-3-5-sonnet-* or Amazon Nova models).
Payload Construction & Intrinsic Functions: Using Amazon States Language (ASL), developers construct dynamic JSON payloads using intrinsic functions such as States.Format , States.StringToJson , and States.JsonToString to merge contextual variables into the model prompt.
Output Path Filtering: The response payload returned by Bedrock is mapped directly to the state output using JSONPath ( $.Body.content[0].text for Anthropic Claude or $.Body.generation for Titan).
High-Throughput Batch Processing with Distributed Map
Enterprise generative AI workloads frequently require batch processing across large document corpora—such as analyzing historical call center transcripts, re-indexing compliance documents, or categorizing product catalogs. Step Functions features the Distributed Map state, capable of coordinating up to 10,000 concurrent parallel workflow executions. [Amazon S3 Bucket (100,000 Documents)]
- │
- ▼
- ┌─────────────────────────────────────────────────────┐
- │ Step Functions Distributed Map State │
- │ - ItemReader: S3 ListBucket / CSV / JSON │
- │ - MaxConcurrency: 500 (Bounds Concurrent Work) │
- │ - ItemBatcher: Groups 5 documents per worker │
- │ │
- │ ┌───────────────┐ ┌───────────────┐ ┌───────────┐ │
- │ │ Child Exec 1 │ │ Child Exec 2 │ │ Child 500 │ │
- │ │ Bedrock Model │ │ Bedrock Model │ │ ... │ │
- │ └───────────────┘ └───────────────┘ └───────────┘ │
- │ │
- │ - ResultWriter: Direct Output to Amazon S3 │
- └─────────────────────────────────────────────────────┘
Critical Distributed Map Parameters for Bedrock:
ItemReader : Direct ingestion from Amazon S3. Step Functions reads S3 inventory files, CSVs, or JSON arrays without loading the dataset into memory.
MaxConcurrency (Concurrency Protection): Uncontrolled parallel invocations can saturate Amazon Bedrock quotas and trigger ThrottlingException errors. Setting MaxConcurrency bounds simultaneous child work. To enforce Requests Per Minute (RPM) or Tokens Per Minute (TPM), also use measured task duration, retries, and explicit pacing or admission control; concurrency is not a rate.
ItemBatcher : Combines multiple S3 items into a single child execution payload, enabling multi-document prompt batching to maximize model throughput and minimize per-invocation network overhead.
ResultWriter : Streams child execution results directly to an Amazon S3 destination bucket, avoiding the Step Functions execution history limit (25,000 events or 4 MB payload size).
Resilient Error Handling: Retry, Backoff, Jitter & Fallbacks
In production generative AI pipelines, transient network issues, regional capacity spikes, and token rate limits are inevitable. Resilient ASL definitions employ structured Retry and Catch blocks:
- ASL Retry Configuration for Bedrock "Retry": [
- {
- "ErrorEquals": [
- "Bedrock.ThrottlingException",
- "Bedrock.ModelTimeoutException",
- "States.Timeout"
- ],
- "IntervalSeconds": 2,
- "MaxAttempts": 5,
- "BackoffRate": 2.0,
- "JitterStrategy": "FULL"
- }
- ]
Exponential Backoff ( BackoffRate: 2.0 ): Successive retries wait exponentially longer (e.g., 2s, 4s, 8s, 16s, 32s) to allow downstream Bedrock rate limits to recover.
Full Jitter ( JitterStrategy: FULL ): Randomizes the retry delay between 0 and the calculated exponential interval. This prevents the "thundering herd" problem where hundreds of concurrent executions retry simultaneously and re-throttle the endpoint.
ASL Catch Configuration & Graceful Model Fallback
When retry attempts are exhausted, a Catch block redirects execution to an alternative fallback branch rather than failing the workflow:
Model Fallback: If the primary frontier model (e.g., Claude 3.5 Sonnet) remains throttled or unavailable, the Catch block transitions to a secondary state invoking a smaller, high-throughput model (e.g., Claude 3 Haiku or Amazon Nova Lite).
Dead-Letter Queue (DLQ): Unrecoverable errors are routed to an Amazon SQS DLQ or an Amazon SNS notification topic with the failed document ID and error payload for administrative triage.
Human-in-the-Loop (HITL) Architectures with .waitForTaskToken
Certain generative AI tasks—such as approving medical diagnostic summaries, issuing financial advice, or validating legal settlement offers—cannot be fully automated due to regulatory mandates. Step Functions implements the Task Token callback pattern to seamlessly pause workflow execution until a human reviewer renders a judgment.
The Task Token Callback Workflow
Pause & Token Generation: A Task state specifies the .waitForTaskToken resource suffix (e.g., arn:aws:states:::sns:publish.waitForTaskToken or arn:aws:states:::sqs:sendMessage.waitForTaskToken ).
Context Injection: The state machine injects the contextual task token ( $$.Task.Token ) into the notification payload sent to human reviewers (via Amazon SNS email, an internal Slack bot, or an internal review web portal backed by Amazon SQS and DynamoDB).
Indefinite Pause: Step Functions pauses execution of the state machine. Standard Workflows can maintain this paused state for up to 1 year with zero compute charges while waiting.
External Evaluation & Resumption:
If the human reviewer approves the generated text: An external microservice invokes the Step Functions runtime API SendTaskSuccess(taskToken, outputPayload) . Execution resumes immediately with the reviewer's modifications.
If the human reviewer rejects the generation: The microservice calls SendTaskFailure(taskToken, error, cause) , triggering the state machine's Catch block to handle rejection logic.
Heartbeat Protection: To prevent orphaned executions if a reviewer abandons a task, configure HeartbeatSeconds alongside TimeoutSeconds . If SendTaskHeartbeat is not received within the heartbeat window, Step Functions fails the task and escalates to a backup reviewer.
Standard vs. Express Workflows for Generative AI
Selecting the correct Step Functions workflow type is a frequent AIP-C01 exam topic:
- Feature Standard Workflows Express Workflows
- Maximum Duration Up to 1 year Up to 5 minutes
- Execution Model Exactly-once state transitions At-least-once (asynchronous) or At-most-once (synchronous)
- Task Token Support ( .waitForTaskToken ) Fully supported (mandatory for HITL) Not supported
- Distributed Map Support Fully supported Limited to inline map
- Pricing Model Billed per state transition Billed per execution duration and memory consumed
- Auditability Visual execution history stored up to 90 days Execution logs sent to Amazon CloudWatch Logs
GenAI Exam Recommendation Mandatory for HITL, long batch RAG pipelines, and Distributed Map Best for high-volume, low-latency microservice tasks (< 5 min)
Concrete ASL State Machine Definition
The following Amazon States Language snippet illustrates a production Bedrock invocation with retry, model fallback, and human-in-the-loop task token review: {
- "Comment": "AIP-C01 Production GenAI Workflow with Retry, Fallback, and HITL",
- "StartAt": "InvokePrimaryBedrockModel",
- "States": {
- "InvokePrimaryBedrockModel": {
- "Type": "Task",
- "Resource": "arn:aws:states:::bedrock:invokeModel",
- "Parameters": {
- "ModelId": "anthropic.claude-3-5-sonnet-20240620-v1:0",
- "Body": {
- "anthropic_version": "bedrock-2023-05-31",
- "max_tokens": 2000,
- "messages": [
- {
- "role": "user",
- "content": "Analyze this financial statement and summarize risk factors: ."
- }
- ]
- }
- },
- "ResultPath": "$.ModelResult",
- "Retry": [
- {
- "ErrorEquals": ["Bedrock.ThrottlingException", "Bedrock.ModelTimeoutException"],
- "IntervalSeconds": 2,
- "MaxAttempts": 4,
- "BackoffRate": 2.0,
- "JitterStrategy": "FULL"
- }
- ],
- "Catch": [
- {
- "ErrorEquals": ["States.ALL"],
- "ResultPath": "$.FallbackError",
- "Next": "InvokeFallbackBedrockModel"
- }
- ],
- "Next": "HumanReviewStep"
- },
- "InvokeFallbackBedrockModel": {
- "Type": "Task",
- "Resource": "arn:aws:states:::bedrock:invokeModel",
- "Parameters": {
- "ModelId": "anthropic.claude-3-haiku-20240307-v1:0",
- "Body": {
- "anthropic_version": "bedrock-2023-05-31",
- "max_tokens": 2000,
- "messages": [
- {
- "role": "user",
- "content": "Analyze this financial statement and summarize risk factors: ."
- }
- ]
- }
- },
- "ResultPath": "$.ModelResult",
- "Next": "HumanReviewStep"
- },
- "HumanReviewStep": {
- "Type": "Task",
- "Resource": "arn:aws:states:::sqs:sendMessage.waitForTaskToken",
- "Parameters": {
- "QueueUrl": "https://sqs.us-east-1.amazonaws.com/123456789012/ComplianceReviewQueue",
- "MessageBody": {
- "DocumentId.$": "$.DocumentId",
- "GeneratedSummary.$": "$.ModelResult.Body.content[0].text",
- "TaskToken.$": "$$.Task.Token"
- }
- },
- "TimeoutSeconds": 86400,
- "Next": "PublishApprovedSummary"
- },
- "PublishApprovedSummary": {
- "Type": "Pass",
- "End": true
- }
- }
- }
- Common Exam Traps & High-Stakes Scenarios
Trap: Using Express Workflows for Human Review. Express Workflows have a hard 5-minute timeout and do not support the .waitForTaskToken callback. Any human review workflow requires Standard Workflows .
Trap: Treating MaxConcurrency as RPM. Distributed Map needs a bounded concurrency chosen from load evidence, but rate quotas also require pacing, admission control, and bounded retries.
Trap: Intermediate Lambda for Simple Bedrock Invocations. Introducing an AWS Lambda function solely to execute bedrock.invoke_model() adds unnecessary latency, cold starts, cost, and maintenance. Step Functions optimized integration ( arn:aws:states:::bedrock:invokeModel ) is the recommended pattern.