This prompt is for architects and platform engineers who need to review a publish-subscribe topology before it reaches production. It takes a topology specification as input and produces a structured assessment identifying fan-out risks, coupling points, orphaned subscribers, circular event flows, and dead letter routing gaps. Use this prompt during architecture review gates, pre-implementation design sessions, or when onboarding new services into an existing event-driven system. The output is designed to be actionable: each finding includes a severity rating and a concrete recommendation.
Prompt
Pub-Sub Topology Evaluation Prompt

When to Use This Prompt
Defines the job-to-be-done, ideal user, required context, and boundaries for the Pub-Sub Topology Evaluation Prompt.
Do not use this prompt for runtime debugging of a live system or for reviewing code-level implementation details. It belongs in the design review phase, before code is written. The prompt expects a topology specification that includes publishers, subscribers, topics, queues, routing rules, and dead letter configurations. If you only have a partial topology or a single service's event bindings, this prompt will produce incomplete results. Pair this prompt with the Event-Driven Anti-Pattern Detection Prompt for a broader design review, or with the Dead Letter Queue Design Prompt when DLQ gaps are the primary concern.
The ideal user is someone who can authoritatively describe the topology and act on the findings. This is typically a staff engineer, solution architect, or platform team lead. The prompt assumes the reviewer understands event-driven patterns and can interpret coupling and fan-out assessments. If the reviewer is new to pub-sub architectures, supplement the output with the Event-Driven System Failure Mode Analysis Prompt to build intuition about what breaks first in production. After running this prompt, feed the findings into your architecture decision record process and use the severity ratings to prioritize remediation before implementation begins.
Use Case Fit
Where the Pub-Sub Topology Evaluation Prompt delivers value and where it introduces risk. Use these cards to decide if this prompt fits your current architecture review stage.
Good Fit: Pre-Implementation Design Review
Use when: you have a draft topology diagram or event flow specification before any code is written. Guardrail: The prompt catches fan-out risks and circular flows early, preventing costly refactoring. Pair with a concrete topology spec to ground the analysis.
Bad Fit: Runtime Debugging
Avoid when: you are troubleshooting a live production incident with partial logs. Guardrail: This prompt analyzes static design, not dynamic runtime behavior. Use an observability prompt or trace analysis playbook for live debugging instead.
Required Input: Topology Specification
What to watch: The prompt requires a structured description of publishers, subscribers, topics, and routing rules. Guardrail: Without a concrete topology spec, the model will generate generic advice. Provide a diagram description or structured list of event flows to get actionable output.
Operational Risk: Orphaned Subscriber Detection
What to watch: The prompt may miss subscribers that are implicitly coupled but not explicitly listed in the spec. Guardrail: Cross-reference the prompt's output against your service registry or API gateway routes to catch subscribers that exist in production but not in the design document.
Operational Risk: Circular Event Flow False Positives
What to watch: The prompt may flag intentional event loops (e.g., saga orchestration) as circular flows. Guardrail: Review flagged circular flows against known saga patterns and compensation chains before treating them as defects. Add a [CONSTRAINTS] block to exclude known intentional loops.
Required Input: Dead Letter Routing Rules
What to watch: The prompt's dead letter analysis is only as good as the DLQ configuration you provide. Guardrail: Include explicit DLQ routing rules, retry policies, and poison message handling in the [CONTEXT] to get a complete assessment. Missing DLQ config leads to false confidence in error handling coverage.
Copy-Ready Prompt Template
Paste this prompt into your AI workflow to evaluate a pub-sub topology and identify fan-out risks, coupling points, and dead letter routing gaps.
The prompt below is designed to be dropped directly into your AI-assisted architecture review workflow. It instructs the model to act as a distributed systems reviewer and systematically assess a publish-subscribe topology specification. The template uses square-bracket placeholders that you must replace with your actual topology description, the specific risks you want to surface, and the output format your downstream tooling expects. Do not leave any placeholder unresolved when you send the prompt to the model.
textYou are a distributed systems architect reviewing a publish-subscribe topology. Your task is to produce a structured topology assessment that identifies risks, coupling points, and operational gaps. ## Topology Specification [TOPOLOGY_SPECIFICATION] ## Review Constraints Focus your analysis on the following specific risk areas: [RISK_AREAS] ## Output Schema Return your assessment as a valid JSON object conforming to this structure: { "topology_summary": "A concise description of the topology's purpose and primary data flows.", "fan_out_risks": [ { "topic_or_exchange": "string", "subscriber_count": "number", "risk_description": "string", "severity": "high|medium|low", "mitigation": "string" } ], "coupling_points": [ { "location": "string", "coupling_type": "temporal|schema|routing|infrastructure", "description": "string", "impact": "string" } ], "dead_letter_routing_gaps": [ { "queue_or_subscriber": "string", "gap_description": "string", "recommendation": "string" } ], "orphaned_subscribers": [ { "subscriber": "string", "evidence": "string" } ], "circular_event_flows": [ { "cycle": ["string"], "risk": "string" } ], "overall_risk_score": "high|medium|low", "critical_recommendations": ["string"] } ## Instructions - If the topology specification is incomplete, note missing information in the `topology_summary` field and proceed with the available data. - For every risk identified, provide a concrete, actionable mitigation. - Flag any subscriber that appears to have no corresponding publisher as an orphaned subscriber. - Detect circular event flows where a published event can trigger a chain that leads back to the original publisher. - If no issues are found in a category, return an empty array for that field. - Do not invent topology details not present in the specification.
After pasting the template, replace [TOPOLOGY_SPECIFICATION] with a detailed description of your pub-sub system. This should include topic or exchange names, subscriber lists, message schemas, routing keys, queue bindings, and any dead letter queue configuration. For [RISK_AREAS], list the specific failure modes you are most concerned about, such as "fan-out saturation under peak load," "tight temporal coupling between OrderService and PaymentService," or "missing DLQ for fraud detection events." If you are integrating this prompt into an automated pipeline, ensure the JSON output is validated against the schema before it is stored in your architecture decision log. For high-severity findings, route the output for human review before accepting the assessment.
Prompt Variables
Required inputs for the Pub-Sub Topology Evaluation Prompt. Each variable must be populated before execution to ensure the model can reason accurately about fan-out risks, coupling points, and dead letter routing gaps.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[TOPOLOGY_DEFINITION] | Full description of the pub-sub topology including topics, queues, subscriptions, and routing rules | Topic: order-events with subscriptions: payment-service, inventory-service, notification-service. DLQ: order-dlq with 3-day retention. | Must contain at least one topic and one subscriber. Parse check: non-empty string with minimum 50 characters. |
[EVENT_CATALOG] | List of all event types flowing through the topology with their schemas and producers | order-placed (schema: OrderPlacedV2), payment-captured (schema: PaymentCapturedV1), inventory-reserved (schema: InventoryReservedV1) | Each event must have a name and schema version. Schema check: array of objects with 'event_name' and 'schema_version' fields. |
[SUBSCRIBER_MANIFEST] | Mapping of subscribers to the events they consume, including processing guarantees | payment-service subscribes to order-placed with at-least-once delivery. inventory-service subscribes to order-placed and payment-captured. | Every subscriber must be linked to at least one event type. Null check: no orphaned subscribers with empty event subscriptions. |
[ROUTING_RULES] | Explicit routing configuration including filter policies, message selectors, and fan-out patterns | order-events topic fans out to all three services. payment-captured events routed only to inventory-service via message filter. | Must describe fan-out vs filtered routing for each topic. Parse check: routing rules must reference topics and subscribers from [TOPOLOGY_DEFINITION]. |
[DLQ_CONFIGURATION] | Dead letter queue settings including retention, replay mechanisms, and alerting thresholds | order-dlq: max-retries=3, retention=72h, alert-threshold=50 messages in 5 minutes, replay via admin API. | Must include retention period and max retry count. Validation: retention must be a positive integer with unit (h/d), max-retries must be >= 1. |
[OBSERVABILITY_SURFACE] | Current monitoring setup including metrics, traces, and correlation ID propagation | Metrics: consumer lag on all subscriptions. Tracing: correlation-id propagated via X-Correlation-ID header. Alerts: DLQ depth > 10 triggers PagerDuty. | Must list at least one metric and one alert condition. Null check: false if no observability exists, which is itself a finding. |
[CONSTRAINTS] | Non-functional requirements and constraints that bound the evaluation | Latency: p99 < 200ms for payment processing. Ordering: FIFO required for inventory-reserved events. Durability: no message loss tolerated. | Each constraint must have a measurable threshold or boolean requirement. Schema check: array of objects with 'type' and 'threshold' fields. |
Implementation Harness Notes
How to wire the Pub-Sub Topology Evaluation Prompt into an architecture review workflow or CI pipeline.
This prompt is designed to be integrated into a pre-merge architecture review pipeline, not run as a one-off chat. The primary integration point is a pull request or design document review where a proposed pub-sub topology diagram (in Mermaid, PlantUML, or structured JSON) is submitted alongside a context document describing the system's non-functional requirements. The harness should extract the topology specification and context, inject them into the prompt's [TOPOLOGY_SPEC] and [CONTEXT] placeholders, and route the output to a structured review comment on the PR. Because the prompt identifies high-severity risks like orphaned subscribers and circular event flows, the harness must treat a risk_level: critical finding as a blocking review, not a suggestion.
The implementation should wrap the LLM call in a validation layer that parses the expected JSON output schema before posting results. If the model returns malformed JSON or missing required fields (topology_id, risks, coupling_points), the harness should retry once with a stricter repair prompt that includes the raw output and a request to fix the schema. After two failures, the harness must escalate to a human reviewer via a labeled comment (e.g., ⚠️ topology-eval-bot failed to produce valid output). For model choice, use a model with strong structured output support and a context window large enough to hold the full topology spec plus evaluation criteria—GPT-4o or Claude 3.5 Sonnet are appropriate defaults. Set temperature=0 to maximize deterministic, repeatable evaluations across PR revisions.
Log every evaluation run as an audit event: capture the topology spec hash, the prompt version, the model identifier, the raw and parsed outputs, and the review decision (approved, changes requested, or escalated). This log becomes evidence for governance reviews and helps debug false positives when the prompt flags a pattern that is intentional. Do not cache evaluations across topology changes—a single subscriber addition can invalidate a prior clean assessment. Finally, pair this prompt with a human-in-the-loop rule: any risk_level: critical finding must be acknowledged by an architect before the PR can merge, even if the bot's comment is the only blocker.
Expected Output Contract
Fields, format, and validation rules for the Pub-Sub Topology Evaluation response. Use this contract to parse, validate, and integrate the model output into downstream review tools or dashboards.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
topology_summary | object | Must contain name, total_topics, total_subscribers, and total_publishers as integers. Reject if any count is negative. | |
topology_summary.name | string | Must match the [TOPOLOGY_NAME] input placeholder exactly. Case-sensitive match required. | |
fan_out_risks | array of objects | Each object must have topic, subscriber_count, and risk_level fields. risk_level must be one of low, medium, high, critical. Reject unknown risk levels. | |
coupling_points | array of objects | Each object must have description, publisher, subscriber, and coupling_type fields. coupling_type must be one of temporal, schema, routing, or semantic. Reject missing coupling_type. | |
dead_letter_routing_gaps | array of objects | Each object must have topic, subscriber, gap_description, and severity fields. severity must be one of warning or critical. Reject if severity is missing. | |
orphaned_subscribers | array of strings | Each entry must be a subscriber identifier string. If no orphans found, array must be empty, not null. Reject null value. | |
circular_event_flows | array of objects | Each object must have cycle_path as an array of topic names in order and detection_confidence as a float between 0.0 and 1.0. Reject if cycle_path has fewer than 2 topics. | |
overall_risk_score | string | Must be one of low, medium, high, or critical. Reject if score does not match the highest severity found in fan_out_risks, coupling_points, or dead_letter_routing_gaps. |
Common Failure Modes
Pub-sub topology evaluation fails in predictable ways. These cards cover the most common failure modes when using an LLM to review asynchronous architectures and how to prevent them.
Orphaned Subscriber Blind Spot
What to watch: The model misses subscribers that consume events but are never produced by any publisher in the documented topology. This happens when the prompt only includes publisher-to-subscriber mappings and omits a reverse subscriber-to-publisher check. Guardrail: Require the prompt to generate a subscriber-origin matrix. Add an eval that flags any subscriber with zero upstream producers.
Circular Event Flow Undetected
What to watch: The model fails to detect circular dependencies where Event A triggers Event B, which eventually triggers Event A again, creating infinite loops. This occurs when the topology is described linearly rather than as a directed graph. Guardrail: Instruct the prompt to construct a dependency graph and explicitly check for cycles. Add a test case with a known circular flow to validate detection.
Dead Letter Routing Gap
What to watch: The model overlooks subscribers that lack a dead letter queue configuration, assuming the happy path covers all cases. This is common when the prompt focuses on routing rules rather than failure destinations. Guardrail: Add a constraint requiring the prompt to enumerate every subscriber and verify a DLQ or dead letter topic is configured. Flag any subscriber without a poison message destination.
Fan-Out Amplification Overlooked
What to watch: The model fails to identify that a single publisher fanning out to many subscribers creates a multiplicative failure risk—if the publisher sends a malformed event, all downstream consumers are impacted simultaneously. Guardrail: Require the prompt to calculate fan-out ratios per topic and flag ratios above a configurable threshold. Include a blast-radius analysis in the output schema.
Implicit Temporal Coupling Missed
What to watch: The model treats all subscribers as independent when some have implicit ordering or timing dependencies—Subscriber B must process Event X before Subscriber C processes Event Y. The prompt misses these because they are rarely documented explicitly. Guardrail: Add a section in the prompt template for explicit ordering constraints. If the user cannot provide them, flag the topology as having undocumented temporal assumptions.
Schema Incompatibility Cascade
What to watch: The model evaluates routing correctness but ignores whether event schemas are compatible between publishers and subscribers. A subscriber expecting field order_id will silently fail if the publisher sends orderId. Guardrail: Extend the prompt to cross-reference event schemas at each publish-subscribe boundary. Add an eval that checks for field name mismatches, missing required fields, and type conflicts.
Evaluation Rubric
Test criteria for evaluating the Pub-Sub Topology Evaluation Prompt's output quality before production deployment. Each criterion targets a specific failure mode common in topology assessments.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Fan-Out Risk Identification | Output identifies at least one fan-out point per topic with >1 subscriber and quantifies the blast radius | No fan-out risks listed when topology contains topics with multiple subscribers | Provide a topology with 3 topics, one having 4 subscribers; check output for explicit fan-out risk section |
Orphaned Subscriber Detection | Output flags any subscriber with no active publisher for its subscribed topic | Orphaned subscriber present in topology but not mentioned in assessment | Inject a subscriber bound to a topic with zero publishers; verify output contains 'orphaned subscriber' warning |
Circular Event Flow Detection | Output identifies any cycle where event A triggers event B which triggers event A | Circular path exists in topology but output claims no cycles found | Create a 3-node circular chain (Topic1->Topic2->Topic3->Topic1); check for cycle detection in output |
Dead Letter Routing Gap Analysis | Output lists every topic without a configured DLQ and assigns a risk level to each gap | Topic with no DLQ is omitted from gap analysis or marked as low risk without justification | Supply topology where 2 of 5 topics lack DLQ config; verify both appear in gap analysis with risk ratings |
Coupling Point Enumeration | Output identifies temporal coupling points where synchronous calls exist in an otherwise async topology | Synchronous HTTP call between services is present but not flagged as coupling risk | Include a service that makes a synchronous REST call after consuming an event; check for coupling warning |
Schema Registry Dependency Check | Output notes whether a schema registry is present and flags topics without registered schemas | Topics without schemas are not mentioned when schema registry is absent from topology | Provide topology with no schema registry and 3 untyped topics; verify output recommends schema registration |
Consumer Lag Sensitivity Assessment | Output identifies which consumers are sensitive to processing delays and recommends lag monitoring thresholds | No mention of consumer lag sensitivity even when order-dependent consumers exist | Include a consumer that must process events in sequence within 30s; check for lag sensitivity note in output |
Retry Storm Risk Flag | Output warns when a topic's retry policy could amplify traffic under partial failure | Unbounded retry configured on a topic with 10+ consumers but no amplification warning appears | Configure max_retries=infinite on a topic with 5 consumers; verify output flags retry storm risk |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single topology description and lighter validation. Drop the formal [OUTPUT_SCHEMA] requirement and ask for a narrative assessment instead. Accept plain-text output with a checklist format rather than structured JSON.
Prompt snippet
codeAnalyze this pub-sub topology for risks: [TOPOLOGY_DESCRIPTION] List fan-out risks, coupling points, and dead letter gaps.
Watch for
- Missing schema checks letting vague prose through
- Overly broad instructions producing unfocused output
- No quantitative scoring, making comparison across topologies impossible

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us