This prompt is for operations teams and platform engineers who need an agent to decide which human approval queue should receive a pending action. It is not a prompt for generating the approval request itself. Use it when your agent has already determined that an action requires human sign-off and now must route that request to the correct team, shift, or escalation path. The prompt ingests action metadata, team on-call schedules, SLA windows, and current queue depth to produce a deterministic routing decision with a fallback escalation target. It is designed to be called as a structured tool within an agent workflow, not as a free-text chatbot interaction.
Prompt
Approval Queue Routing Prompt for Agent Workflows

When to Use This Prompt
Determine if the approval queue routing prompt is the right tool for your agent's human-in-the-loop workflow.
This prompt is appropriate when you have multiple approval queues with distinct ownership, such as separate teams for database changes, infrastructure modifications, and customer-facing actions. It handles load balancing across shifts, escalation when a primary queue is unresponsive, and duplicate suppression to prevent the same action from appearing in multiple queues. The prompt requires structured inputs including action type, severity classification, affected resources, team ownership mappings, on-call schedules, and current queue depths. Without this context, the routing decision will be unreliable. The output is a machine-readable routing decision with a primary queue, escalation queue, and a unique correlation ID for audit trail linkage.
Do not use this prompt when you have a single approval queue or when the agent itself should decide whether approval is needed. This prompt assumes the approval decision has already been made upstream. It is also not suitable for generating the content of the approval request—that should be handled by a separate prompt focused on risk description and justification. Before deploying, validate the routing logic against your actual on-call schedules and test edge cases such as overlapping shifts, holiday schedules, and queue saturation. For regulated environments, ensure the routing decision is logged immutably and that the correlation ID is propagated through all downstream systems to maintain an unbroken audit trail from action request to human sign-off.
Use Case Fit
Where the Approval Queue Routing Prompt delivers value and where it introduces operational risk.
Good Fit: Multi-Team Operations
Use when: your organization runs multiple approval queues across distinct teams, shifts, and on-call rotations. The prompt excels at mapping action types and severity levels to the correct owning team based on dynamic schedules. Guardrail: always provide a current on-call roster as structured input—stale routing tables are the most common cause of misrouted approvals.
Bad Fit: Single Queue or Solo Reviewer
Avoid when: all approvals flow to one person or one undifferentiated queue. The routing logic adds latency and complexity without benefit. A simpler confirmation prompt is more appropriate. Guardrail: measure queue depth and routing fan-out before deploying—if the fan-out is consistently 1:1, skip routing and use a direct escalation prompt instead.
Required Input: Live Scheduling Data
Risk: routing to off-duty or unavailable reviewers causes SLA breaches and silent approval delays. The prompt cannot infer who is actually available without explicit input. Guardrail: feed the prompt a structured availability payload (on-call schedule, shift handoff times, PTO calendar) refreshed at least once per shift change. Validate that every route target has a non-null contact method.
Required Input: Action Severity Taxonomy
Risk: without a clear severity-to-queue mapping, the model defaults to heuristic routing that may send critical actions to low-priority queues. Guardrail: provide an explicit severity taxonomy (e.g., SEV1–SEV4) with SLA targets, required reviewer roles, and escalation paths per level. Test routing decisions against known severity examples before production.
Operational Risk: Queue Starvation
Risk: load-balancing logic can inadvertently starve small teams or single reviewers by routing all ambiguous actions to the largest queue. Guardrail: implement a maximum queue depth per route and an overflow rule that triggers escalation when a queue exceeds its capacity. Monitor per-queue assignment counts in production traces.
Operational Risk: Duplicate Suppression Failures
Risk: when the same approval request arrives from multiple agent instances or retry loops, duplicate routing creates reviewer fatigue and conflicting decisions. Guardrail: generate and check an idempotency key (action type + target resource + timestamp window) before routing. If a duplicate is detected, return the existing ticket ID rather than creating a new queue entry.
Copy-Ready Prompt Template
A ready-to-use prompt for classifying and routing approval requests to the correct queue based on action type, severity, team ownership, and on-call schedules.
This template is designed to be pasted directly into your agent's tool-calling layer. It instructs the model to act as an approval router, consuming structured data about a pending action and the current operational state of your queues. The model's job is not to approve or deny the action, but to determine the single correct routing destination, handling load balancing, escalation on timeout, and duplicate suppression. Replace every square-bracket placeholder with live data from your queue management system, on-call provider (e.g., PagerDuty, Opsgenie), and action classifier before sending the prompt.
textYou are an Approval Queue Router for an agent workflow system. Your sole task is to determine the correct routing destination for a pending approval request. You do not approve or deny the action itself. You will receive a pending action and a snapshot of the current state of all approval queues. Use this information to output a single routing decision. ## INPUT - Pending Action: [ACTION_DETAILS_JSON] - Queue State Snapshot: [QUEUE_STATE_JSON] - On-Call Schedules: [ONCALL_SCHEDULES_JSON] ## ROUTING RULES Apply these rules in order. The first matching rule determines the queue. 1. **Exact Team Ownership:** If the action's `owner_team` matches a queue's `team_id` and that queue's `status` is `active`, route to that queue. 2. **Severity-Based Routing:** If no team match, route based on the action's `severity` to the queue with the matching `severity_level` and `status` `active`. 3. **Load Balancing:** If multiple active queues match the team or severity, select the queue with the lowest `active_request_count`. 4. **Escalation on Timeout:** If the selected queue's `oldest_pending_minutes` exceeds its `escalation_threshold_minutes`, do not route there. Instead, route to its `escalation_queue_id`. If the escalation queue is also timed out, route to the `default_escalation_queue_id`. 5. **Duplicate Suppression:** If the `action_id` is found in any queue's `recent_action_ids` list, output a `duplicate` status and do not route. 6. **Fallback:** If no rule matches, route to the `global_fallback_queue_id`. ## OUTPUT_SCHEMA You must output a single, valid JSON object with no other text. { "status": "routed" | "duplicate" | "no_available_queue", "action_id": "string", "target_queue_id": "string | null", "routing_reason": "string", "escalation_applied": boolean } ## CONSTRAINTS - Do not invent queue IDs. Only use IDs present in the Queue State Snapshot. - If `status` is `duplicate`, `target_queue_id` must be `null`. - The `routing_reason` must cite the specific rule number (1-6) that was applied.
To adapt this prompt, start by mapping your internal data models to the [ACTION_DETAILS_JSON] and [QUEUE_STATE_JSON] placeholders. The action details must include, at minimum, an action_id, owner_team, and severity field. The queue state should be a real-time snapshot of every active queue's ID, team ownership, current load, and escalation thresholds. For high-risk actions, such as those involving financial transactions or PII, ensure the severity field in the action details is calibrated to force human review by routing to a queue that has no auto-approval policy. Before deploying, run a suite of evals that includes a test case for each routing rule, a case for a timed-out queue, and a case with a duplicate action_id to verify the suppression logic works end-to-end.
Prompt Variables
Each placeholder must be populated before the prompt is sent. Validation notes describe what the router expects.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[ACTION_TYPE] | Classifies the tool action into a known risk category for routing | DATABASE_WRITE | Must match an enum in the routing config. Reject unknown values. |
[SEVERITY] | Determines the initial queue priority and SLA timer | HIGH | Must be one of LOW, MEDIUM, HIGH, CRITICAL. Default to HIGH if confidence < 0.9. |
[TEAM_OWNER] | Maps the action to a specific on-call team for direct assignment | platform-db-admins | Must resolve to a valid team ID in the scheduling service. Fail closed if lookup returns null. |
[ON_CALL_SCHEDULE_ID] | Identifies the active shift for the target team to find the current responder | sch-pdb-na-2025-04 | Must be a non-expired schedule. If expired, escalate to team lead with a schedule-gap alert. |
[SLA_DEADLINE_SECONDS] | Sets the maximum queue wait time before automatic escalation | 300 | Must be an integer > 0 and <= 86400. Values over 3600 require a documented exception. |
[DUPLICATE_KEY] | A unique fingerprint to suppress duplicate approval requests for the same action | db-write-users-table-abc123 | Must be generated deterministically from action + target. If a match is found in the active queue, discard and log. |
[ACTION_PAYLOAD] | The full context of the proposed action for the human reviewer | { "query": "UPDATE users...", "affected_rows": 1500 } | Must be valid JSON and under 100KB. Sanitize to remove raw credentials before queue insertion. |
[ESCALATION_CHAIN] | An ordered list of fallback targets if the primary queue times out | ["team-lead-db", "vp-eng"] | Must be a non-empty array of valid user or team IDs. If the chain is exhausted, halt the workflow and create a critical incident. |
Implementation Harness Notes
How to wire the Approval Queue Routing Prompt into a production agent workflow with validation, retries, and human-in-the-loop safeguards.
The Approval Queue Routing Prompt is not a standalone artifact; it is a decision node inside a larger agent execution loop. The prompt should be invoked immediately after a tool action is classified as requiring human approval, but before any approval request is dispatched. The model receives the action context, the available queues, and the current operational state, and it returns a structured routing decision. This decision must be validated against the actual queue registry before any message is sent, because the model can hallucinate queue names, assignees, or SLA targets that do not exist in the live system.
Wire the prompt into your agent harness with a strict contract: the input must include a resolved [ACTION_TYPE], [SEVERITY_SCORE], [TEAM_OWNERSHIP_MAP], [ON_CALL_SCHEDULE], and [QUEUE_REGISTRY] with current load metrics. The output must conform to a schema that includes target_queue_id, escalation_queue_id, routing_reason, priority_override, and duplicate_check_hash. After the model returns, run a validator that confirms the target_queue_id exists in the live queue registry, the assignee is currently on-call if the schedule requires it, and the duplicate_check_hash does not match any pending or recently resolved approval in the last N minutes. If validation fails, do not retry the prompt blindly. Log the mismatch, append the validator error to the context, and re-invoke the prompt with the corrected registry state. After two consecutive validation failures, escalate to a human operator with the full trace.
For high-risk domains—financial transactions, production configuration changes, or regulated data access—add a synchronous human review step after routing but before dispatch. The routing prompt should produce a preview of the approval request that a human can confirm or redirect. Log every routing decision with the model version, input context hash, output payload, validator results, and final dispatch action. This audit trail is critical for compliance reviews and for debugging routing drift as queues, teams, and schedules evolve. Avoid treating the routing prompt as a fire-and-forget step; it is a gated decision that must survive queue outages, stale on-call data, and model confidence degradation.
Expected Output Contract
The prompt must return a single JSON object with these fields. Validate all fields before acting on the routing decision.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
routing_decision | string enum | Must be one of: 'approve', 'escalate', 'reject', 'duplicate_suppressed'. Parse check against allowed enum values. | |
target_queue_id | string | Must match a valid queue ID from the provided [QUEUE_REGISTRY]. Non-empty string. Schema check against registry. | |
assigned_reviewer_role | string | Must match a role defined in [TEAM_ROSTER]. Non-null. If no specific reviewer, use 'on_call_rotation'. | |
priority_level | string enum | Must be one of: 'P1_critical', 'P2_high', 'P3_medium', 'P4_low'. Derived from [SEVERITY] and [SLA_WINDOW]. | |
sla_deadline_utc | ISO 8601 datetime | Must be a valid future timestamp. Calculated as now + [SLA_WINDOW]. Must not exceed [MAX_SLA_HOURS]. | |
duplicate_of_ticket_id | string or null | If routing_decision is 'duplicate_suppressed', must be a valid existing ticket ID from [ACTIVE_TICKETS]. Otherwise null. | |
escalation_reason | string or null | Required if routing_decision is 'escalate'. Must be a non-empty string from [ESCALATION_REASONS] enum. Otherwise null. | |
confidence_score | number | Float between 0.0 and 1.0. If below [CONFIDENCE_THRESHOLD], routing_decision must be 'escalate'. Retry condition if missing. |
Common Failure Modes
Approval queue routing prompts fail in predictable ways when routing logic, team state, or SLA context is ambiguous. These are the most common production failure modes and the guardrails that prevent them.
Stale On-Call Rotation Data
What to watch: The prompt routes to a team or individual based on a schedule that changed after the prompt was assembled. The approval lands with someone who is no longer on call, causing silent delays. Guardrail: Always inject the current on-call roster and rotation timestamp into [CONTEXT] at invocation time. Add a rule: if the routing target's shift ended more than 15 minutes ago, re-resolve against the live schedule before routing.
Duplicate Approval Requests
What to watch: The same action triggers multiple approval requests due to retry logic, event replay, or concurrent agent instances. Reviewers receive duplicate notifications and may approve stale or already-resolved requests. Guardrail: Include an idempotency key derived from [ACTION_ID] + [RESOURCE_ID] + [TIMESTAMP_WINDOW]. Instruct the prompt to suppress routing when a matching key already exists in the queue with a non-terminal status.
SLA Misclassification Under Load
What to watch: During high queue volume, the prompt misclassifies severity or SLA tier because it relies on keyword matching rather than structured risk signals. A critical financial transaction routes with the same priority as a low-risk config read. Guardrail: Require a structured [RISK_SCORE] input field with explicit tier mapping (P0-P4). Add a validation rule: if [RISK_SCORE] is missing or null, default to the highest SLA tier and flag for operator review rather than guessing.
Queue Starvation from Over-Escalation
What to watch: The prompt escalates too many requests to a small set of senior approvers because the routing logic treats any uncertainty as a reason to escalate. Senior reviewers become bottlenecks, and lower-severity queues sit idle. Guardrail: Add a load-balancing constraint: if a target queue or individual has more than [MAX_PENDING] items, the prompt must attempt routing to a secondary designated team before escalating. Log every override decision with the reason.
Timeout Without Escalation
What to watch: An approval request sits in a queue beyond its SLA window because the prompt does not include a timeout escalation rule. The agent that requested approval either blocks indefinitely or proceeds without authorization. Guardrail: Include an explicit [SLA_TIMEOUT_MINUTES] per severity tier. Add a rule: if no human response is received within the timeout window, automatically escalate to the next tier in the escalation chain and notify the original queue owner.
Team Ownership Ambiguity
What to watch: The prompt cannot determine which team owns an action because the [ACTION_TYPE] taxonomy is incomplete or overlaps with multiple team scopes. The request routes to a default catch-all queue where it languishes. Guardrail: Maintain a deterministic [TEAM_OWNERSHIP_MAP] as a structured input. Add a rule: if no single team matches with confidence above [CONFIDENCE_THRESHOLD], route to a triage queue with a required human assignment within [TRIAGE_TIMEOUT_MINUTES] rather than silently defaulting.
Evaluation Rubric
Run these checks against a golden dataset before deploying a new version of this prompt. Each row is a test case with expected behavior.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Correct queue assignment for high-severity action | Route to [HIGH_SEVERITY_QUEUE] when [SEVERITY_SCORE] >= [HIGH_THRESHOLD] | Routed to default or low-severity queue | Golden set of 20 high-severity test cases; assert queue == [HIGH_SEVERITY_QUEUE] |
Team ownership routing accuracy | Route to correct [TEAM_QUEUE] based on [ACTION_TYPE] and [RESOURCE_TAG] mapping | Routed to wrong team queue or fallback queue when mapping exists | Golden set of 30 team-owned actions; assert queue matches expected [TEAM_QUEUE] |
On-call schedule awareness | Route to [ON_CALL_QUEUE] when [CURRENT_TIME] falls within [SHIFT_WINDOW] for [TEAM] | Routed to team queue instead of on-call queue during active shift | Inject [CURRENT_TIME] and [SHIFT_WINDOW] pairs; assert queue == [ON_CALL_QUEUE] |
SLA-based prioritization | Assign [PRIORITY_LEVEL] based on [SLA_DEADLINE] proximity; route to [PRIORITY_QUEUE] when [TIME_REMAINING] < [SLA_THRESHOLD] | SLA-bound action routed to standard queue with [TIME_REMAINING] below threshold | Golden set of 15 SLA-sensitive cases; assert [PRIORITY_LEVEL] and queue match SLA rules |
Load balancing across equivalent queues | Distribute across [QUEUE_POOL] when multiple queues serve same [TEAM] and [SEVERITY]; no single queue exceeds [MAX_QUEUE_DEPTH] bias | All traffic routed to first matching queue; load skew > [SKEW_THRESHOLD] | Run 100 identical-routing cases; assert distribution across pool with max deviation <= [SKEW_THRESHOLD] |
Escalation on queue timeout | Escalate to [ESCALATION_QUEUE] when [QUEUE_AGE] > [TIMEOUT_MINUTES] and [ACTION_STATUS] is pending | Action remains in original queue beyond timeout without escalation flag | Golden set of 10 timeout cases; assert escalation flag set and target queue == [ESCALATION_QUEUE] |
Duplicate suppression | Detect duplicate [ACTION_ID] or [IDEMPOTENCY_KEY]; return existing [TICKET_ID] and suppress new queue entry | Duplicate creates second queue entry with new [TICKET_ID] | Submit 10 duplicate pairs; assert single [TICKET_ID] returned and queue count unchanged |
Missing required field handling | Return structured error with [MISSING_FIELDS] list when [ACTION_TYPE], [SEVERITY_SCORE], or [TEAM] is null | Prompt hallucinates routing or returns empty queue assignment | Submit 10 cases with null required fields; assert error response with [MISSING_FIELDS] populated |
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
Start with the base routing prompt and a static team-to-queue mapping. Replace dynamic schedule lookups with hardcoded on-call assignments. Use a simple severity heuristic (e.g., if 'production' in [ACTION_CONTEXT] → high) instead of a full risk scoring function.
codeYou are an approval queue router. Given an action type, severity, and team, return the target queue name and SLA tier. Action: [ACTION_TYPE] Severity: [SEVERITY] Team: [TEAM_NAME] Return JSON: {"queue": "string", "sla_minutes": number}
Watch for
- Routing to nonexistent queues when team names don't match the static map
- No duplicate suppression—identical actions generate separate approvals
- Missing timeout handling; the router has no concept of queue staleness

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