Back to Blog
Published:
Last Updated:
Recently Updated
AWS & Google Agent FrameworksChapter 3

When to Mix SQS FIFO and Standard Queues in an Agent Pipeline

7 min read
1,400 words
medium priority
Mudassir Marwat

Mudassir Marwat

Founder & CEO, Cognilium AI

When to Mix SQS FIFO and Standard Queues in an Agent Pipeline — Cognilium AI

TL;DR

FIFO for chunk ordering, Standard for parallel analysis fan-out. Why a single queue type for the whole pipeline is the wrong default, with the dead-letter and retry settings that make the split work.

An agent pipeline with multiple stages tends to default to one queue type for the whole topology. That works for tutorials and breaks at production scale. The pipeline this writeup describes has three queue boundaries and uses three different topology choices for them — and the reasoning is worth writing down because most teams hit this and pick the wrong default.

Stage 1: chunk extraction (FIFO)

A document is split into 50–100 chunks. The assembler downstream stitches them into a structured contract analysis. Chunks must arrive in order — chunk 7 cannot land before chunk 6, otherwise the assembler either reorders (expensive) or skips and waits (slow). FIFO with message group ID = job_id keeps order inside one job while different jobs run in parallel. Per-group throughput is 300 messages/sec without batching, 3,000 with — enough for a job that emits 100 chunks in a couple seconds.

Stage 2: analysis fan-out (Standard)

Each chunk fans out to 11 specialist analyst agents. There is no ordering relationship — bias, severity, ambiguity, party, and the rest can finish in any order; the merger just collects them. FIFO here would force per-group serialization and tank parallelism. Standard queue with at-least-once delivery + idempotent worker is the right call.

Stage 3: result assembly (Standard with deduplication)

Results from 11 agents per chunk merge back. Standard works because the merge step is idempotent — writing the same agent result twice produces the same output. The trick: each merge writes to DynamoDB with a conditional update on (chunk_id, agent_id). Duplicate deliveries hit the conditional and short-circuit.

Dead-letter settings per queue

  • FIFO chunk queue: maxReceiveCount = 3, DLQ retention 14 days. A wedged chunk blocks its group — fail fast and alert.
  • Standard analysis queue: maxReceiveCount = 10, retention 14 days. Leaf-level retries are cheap, model-side rate limits resolve naturally.
  • Standard merge queue: maxReceiveCount = 5, retention 7 days. Failures here usually mean a chunk_id has been deleted from DynamoDB — short DLQ, fast triage.

When to ignore this advice

Pipelines with fewer than ~50 messages per request rarely justify the topology split — the operational overhead of three queue types and three DLQ alerts costs more than reordering at the assembler. The split earns its keep when one job emits 1,000+ messages and a single bad message must not block the rest.

What we measured

  • 22 chunks per contract → 22 FIFO messages → ~5 sec to drain
  • 22 chunks × 11 agents = 242 Standard messages → ~25 sec parallel processing
  • DLQ rate steady-state: <0.1% of messages
  • P95 end-to-end: 154 sec from upload to assembled report

Share this article

The work behind this series

Framework-agnostic agent deployment with memory persistence and observability.

Mudassir Marwat

Mudassir Marwat

Founder & CEO, Cognilium AI

Mudassir Marwat's argument is that ERP systems record decisions they never optimise.

Founder & CEO of Cognilium AI; 37 AI agents in production across four products; 4 production AI products built and operated; three clouds in production (AWSGCPAzure)
Agentic AIRAG → GraphRAG retrievalVoice AIMulti-Agent Orchestration
In short

Key takeaways

  • One queue type for a whole pipeline is the wrong default. Ordering and throughput are different requirements, and they change per stage.
  • FIFO where sequence carries meaning; Standard where work fans out and order does not matter.
  • An assembly stage needs explicit deduplication, because Standard delivery is at-least-once.
  • Dead-letter settings belong per queue — a poison message during extraction is not the same failure as one during analysis.
What goes wrong

Common mistakes to avoid

  • Choosing FIFO everywhere for safety, which serialises work that should have run in parallel.
  • Assuming exactly-once delivery on a Standard queue and skipping deduplication.
  • One shared dead-letter queue, which makes the origin of a failure unrecoverable.

Frequently Asked Questions

Find answers to common questions about the topics covered in this article.

FIFO is slower per message (300/s per group ID without batching). But for the chunk-extraction stage, ordering inside a job matters — the assembler downstream expects chunks in order. Reordering at the assembler is more expensive than the FIFO penalty.
FIFO collapses to per-group serialization. For the analysis stage, 11 specialist agents fan out per chunk — they have no inter-chunk ordering requirement and you want all 11 running simultaneously. FIFO would queue them by group ID and lose your parallelism.
For chunk extraction: job_id. All chunks for one job stay ordered; different jobs run in parallel. For other FIFO stages where ordering scope differs, pick the smallest natural ordering unit.
SQS limit is 256KB per message. We keep ChunkMessage under that with the chunk text capped at 900KB stored in S3 — the message carries the S3 key. Related-terms list capped at 50 to bound the post-processing fan-out.
FIFO chunk queue: DLQ after 3 receives. Standard analysis queue: DLQ after 10. The FIFO queue is upstream and a bad message there blocks its group; you want it out fast. The analysis queue is leaf-level — re-tries are cheap and fan-out tolerates more before declaring dead.

Still have questions?

Get in touch with our team for personalized assistance.

Contact Us

Still have a question this did not answer?

The person who wrote this article answers these. Describe your setup and what you are stuck on — you will get a straight answer, including where we think the approach is wrong.

Related Articles

Continue exploring related topics and insights from our content library.

Surviving Partial Failure in a 3,300-Call Agent Pipeline
8 min
1
Mudassir Marwat
May 5, 2026

Surviving Partial Failure in a 3,300-Call Agent Pipeline

Two-tier retries, atomic DynamoDB chunk claims, and checkpoint-based cancellation — the failure-recovery layer that lets a multi-agent contract review pipeline finish even when 5% of LLM calls fail.

words
Read Article
Supervisor-Router on Google ADK with Per-Org Tool Registration
9 min
2
Mudassir Marwat
May 5, 2026

Supervisor-Router on Google ADK with Per-Org Tool Registration

Building a multi-tenant agent platform on Google ADK where the supervisor binds only the tools each org has paid for and integrated — without forking the agent definition per tenant.

words
Read Article
Multi-Agent Orchestration on AWS Bedrock AgentCore
9 min
3
Mudassir Marwat
May 4, 2026

Multi-Agent Orchestration on AWS Bedrock AgentCore

The supervisor + specialist pattern is the most reliable way to ship multi-agent systems on AWS — here is how to wire it, observe it, and bound its cost.

words
Read Article

Explore More Insights

Discover more expert articles on AI, engineering, and technology trends.

Personalized for You

Curated content recommendations based on your current reading and interests.

Surviving Partial Failure in a 3,300-Call Agent Pipeline — Cognilium AI
Trending
122%

Surviving Partial Failure in a 3,300-Call Agent Pipeline

Same topic cluster: AWS & Google Agent Frameworks
Same author: Mudassir Marwat

Two-tier retries, atomic DynamoDB chunk claims, and checkpoint-based cancellation — the failure-recovery layer that lets a multi-agent contract review pipeline finish even when 5% of LLM calls fail.

Mudassir Marwat
8 min read
AWS & Google Agent Frameworks
Read Article
Trending
38%

Does Dynamics 365 match product receipts to invoices automatically?

High priority content
Related topic cluster: Procure-to-Pay Agent Operations

Yes, in the background, hourly or daily, where a three-way policy exists. It also has a retry limit, so some lines stop being tried altogether.

Ali Ahmed
5 min read
Procure-to-Pay Agent Operations
Read Article
Supervisor-Router on Google ADK with Per-Org Tool Registration — Cognilium AI
Trending
119%

Supervisor-Router on Google ADK with Per-Org Tool Registration

Same topic cluster: AWS & Google Agent Frameworks
Same author: Mudassir Marwat

Building a multi-tenant agent platform on Google ADK where the supervisor binds only the tools each org has paid for and integrated — without forking the agent definition per tenant.

Mudassir Marwat
9 min read
AWS & Google Agent Frameworks
Read Article
Diagram of supervisor-specialist multi-agent orchestration on AWS Bedrock AgentCore.
For You
109%

Multi-Agent Orchestration on AWS Bedrock AgentCore

Same topic cluster: AWS & Google Agent Frameworks
Same author: Mudassir Marwat

The supervisor + specialist pattern is the most reliable way to ship multi-agent systems on AWS — here is how to wire it, observe it, and bound its cost.

Mudassir Marwat
9 min read
AWS & Google Agent Frameworks
Read Article
Trending
67%

What a Dynamics 365 F&O database refresh does not copy, and what breaks after it

Same author: Mudassir Marwat
Preferred author

A refresh copies production into a sandbox, then disables every user, withholds every batch job, clears every secret and drops every endpoint. The checklist.

Mudassir Marwat
5 min read
D365 Platform Decisions
Read Article
Trending
67%

How long does Dynamics 365 F&O keep your backups, and who can restore production?

Same author: Mudassir Marwat
Preferred author

Microsoft keeps backups 28 days for production, seven for sandboxes. What a point-in-time restore does, its downtime, and what it never brings back.

Mudassir Marwat
6 min read
D365 Platform Decisions
Read Article

Smart Recommendations

Our AI analyzes topic clusters, author expertise, and content relationships to surface the most relevant articles for you.

Topic Matching
Author Expertise
Content Quality
Personal Interests

Questions on this?

Talk to an engineer

Schedule a call