Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

3.3.4. Prompt Flows and Chaining

💡 First Principle: Complex GenAI tasks often require sequential reasoning — the output of one FM call informs the next. Prompt Flows provide a visual, managed orchestration layer for multi-step FM workflows, eliminating the need to write custom orchestration code for common chaining patterns.

Amazon Bedrock Prompt Flows enables no-code/low-code orchestration of:

  • Sequential FM calls (output of step 1 → input of step 2)
  • Conditional branching (route based on FM output classification)
  • Knowledge Base retrieval steps
  • Lambda function steps (external data enrichment)
  • Input/output transformation
Example: document analysis pipeline as a Prompt Flow:
Input: raw_document
  ↓
Step 1 (FM): "Extract the 5 key topics from this document" → topic_list
  ↓
Step 2 (Knowledge Base): Retrieve relevant context for each topic → context_per_topic
  ↓
Step 3 (Lambda): Format and merge retrieved contexts → enriched_context
  ↓
Step 4 (FM): "Given these topics and context, generate an executive summary" → summary
  ↓
Step 5 (Conditional): IF summary length > 500 words → Step 6 ELSE → Output
  ↓
Step 6 (FM): "Condense this summary to 300 words" → concise_summary
  ↓
Output: concise_summary
When to use Prompt Flows vs. Bedrock Agents vs. Step Functions:
OrchestrationBest ForNot For
Bedrock Prompt FlowsStructured multi-step FM workflows; visual design; predictable pathsDynamic tool selection; long-running processes
Bedrock AgentsAutonomous reasoning; dynamic tool calling; variable number of stepsDeterministic workflows; real-time latency requirements
Step FunctionsComplex orchestration with many services; durable execution; long-runningSimple FM chaining

⚠️ Exam Trap: Bedrock Prompt Flows runs synchronously and has execution time limits. For workflows that might take hours (processing large documents, batch operations), use Step Functions + Lambda with asynchronous Bedrock invocations — not Prompt Flows.

Reflection Question: You need to build a pipeline that: (1) classifies incoming documents by type, (2) routes each type to a different FM prompt for extraction, and (3) validates the extraction output against a schema before writing to DynamoDB. Would you implement this as a Prompt Flow, Bedrock Agent, or Step Functions workflow? Justify your choice.

Alvin Varughese
Written byAlvin Varughese
Founder15 professional certifications