Inferensys

Prompt

Task Uniqueness Scoring Prompt for Agent Orchestrators

A practical prompt playbook for using Task Uniqueness Scoring Prompt for Agent Orchestrators in production AI workflows.
Engineer reviewing agent handoff workflow on laptop, task routing diagrams visible, technical office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Understand the job-to-be-done, required context, and boundaries for the Task Uniqueness Scoring Prompt.

This prompt is designed for orchestration engineers building priority queues and task routers in multi-agent systems. Its job is to score an incoming task against a registry of active workstreams to determine semantic uniqueness. The output is a calibrated confidence score that drives routing decisions: assign the task to an existing workstream if it is a duplicate, or create a new workstream if it is unique. Use this prompt when your system needs to prevent duplicate agent work, reduce wasted compute, and avoid reconciliation debt caused by multiple agents unknowingly tackling the same problem.

This prompt assumes you already have a structured registry of active workstreams with canonical fingerprints and that you can supply both the incoming task and the active workstream context at inference time. The registry should include workstream IDs, intent descriptions, entity references, and constraint summaries. Without this structured context, the model cannot perform a meaningful comparison. The prompt works best when workstreams have clear, non-overlapping boundaries and when incoming tasks are well-formed enough to extract a semantic fingerprint. If your workstreams are poorly scoped or your tasks are ambiguous fragments, the confidence scores will be unreliable and should not be used for automated routing.

Do not use this prompt as a general-purpose similarity scorer, a content deduplication engine for documents, or a replacement for deterministic idempotency keys on side-effect-producing operations. It is not designed for real-time sub-millisecond routing decisions where latency budgets are tight; model inference adds non-trivial overhead. For high-throughput systems, consider using this prompt to calibrate a faster embedding-based classifier rather than calling it on every task. Always pair the confidence score with a threshold that triggers human review for borderline cases, especially when routing errors could cause missed deadlines, double-processing of financial transactions, or conflicting state mutations.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Task Uniqueness Scoring Prompt delivers value and where it introduces risk. Use this to decide if semantic deduplication belongs in your agent orchestration layer.

01

Good Fit: High-Volume Agent Queues

Use when: You have an orchestrator dispatching hundreds of tasks per minute to a pool of agents, and duplicate work wastes compute and creates reconciliation debt. Guardrail: Pair the uniqueness score with a configurable similarity threshold so routing decisions are tunable per workstream.

02

Bad Fit: Strict Deterministic Deduplication

Avoid when: You need exact-match deduplication on structured keys (e.g., order IDs, transaction hashes). Semantic scoring is probabilistic and can miss near-duplicates or flag false positives. Guardrail: Use deterministic idempotency keys for exact-match scenarios and reserve semantic scoring for unstructured or natural-language task payloads.

03

Required Inputs

What you need: An incoming task payload with intent description, entities, and constraints; a registry of active workstream fingerprints; and a similarity threshold. Guardrail: Validate that the active workstream registry is fresh—stale fingerprints cause false negatives and missed duplicates.

04

Operational Risk: Threshold Drift

What to watch: The similarity threshold that worked during testing may drift in production as task diversity changes, causing either duplicate leakage or over-blocking. Guardrail: Log every scoring decision with the threshold used, the top match score, and the routing outcome. Review the distribution weekly to recalibrate.

05

Operational Risk: Cross-Tenant Leakage

What to watch: In multi-tenant systems, a uniqueness check that scans across tenant boundaries can leak task metadata or incorrectly block a tenant's task because it resembles another tenant's work. Guardrail: Scope every uniqueness lookup to a single tenant partition and enforce tenant isolation at the registry query level.

06

When to Escalate Instead of Score

What to watch: Tasks with borderline scores (e.g., 0.65–0.80 similarity) create ambiguity—routing automatically risks both duplicate work and false blocking. Guardrail: Define a gray zone where tasks are flagged for human review or placed in a holding queue rather than auto-routed. Log gray-zone decisions for eval calibration.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt that scores an incoming task against the active workstream for semantic uniqueness, returning a confidence score to drive routing decisions.

This prompt is the core instruction you will paste into your orchestration layer. It is designed to be stateless: it receives a snapshot of the active workstream and a candidate task, then returns a structured uniqueness assessment. All dynamic values are represented as square-bracket placeholders that your application must replace at runtime. The prompt enforces a strict JSON output contract so that downstream routing logic can parse the result without ambiguity.

code
You are a task deduplication scorer for an agent orchestration system. Your job is to compare a candidate task against a list of active tasks and determine whether the candidate is semantically unique or a duplicate of existing work.

## INPUT
[CANDIDATE_TASK]
[ACTIVE_TASKS]

## TASK DEFINITION
- CANDIDATE_TASK: A single task object with fields `id`, `description`, `intent`, `entities`, and `constraints`.
- ACTIVE_TASKS: A JSON array of task objects currently in progress, each with the same schema as CANDIDATE_TASK.

## SCORING RULES
1. Compare the candidate task's `intent`, `entities`, and `constraints` against each active task.
2. A task is a duplicate if it would produce substantially the same outcome, even if the wording differs.
3. Consider partial overlap: if the candidate task is a subset of an active task, flag it as a duplicate.
4. If the candidate task is broader than an active task but fully contains it, flag it as a superset (still a duplicate for routing purposes).
5. Ignore differences in phrasing, synonyms, or surface-level formatting.
6. If no active tasks are semantically equivalent, the task is unique.

## OUTPUT SCHEMA
Return ONLY a valid JSON object with this exact structure:
{
  "uniqueness_score": <float between 0.0 and 1.0, where 1.0 is completely unique and 0.0 is an exact duplicate>,
  "is_duplicate": <boolean>,
  "matched_task_id": <string or null>,
  "overlap_type": <"exact" | "subset" | "superset" | "partial" | "none">,
  "rationale": <string explaining the decision in one sentence>
}

## CONSTRAINTS
- Do not return any text outside the JSON object.
- If no active tasks exist, return uniqueness_score 1.0, is_duplicate false, matched_task_id null, overlap_type "none".
- If multiple active tasks match, select the one with the highest semantic overlap.
- The rationale must reference specific intent, entity, or constraint overlap.

To adapt this template, replace [CANDIDATE_TASK] with a serialized task object and [ACTIVE_TASKS] with a JSON array of in-flight tasks from your workstream registry. If your task schema differs, update the field names in the SCORING RULES section to match your domain model. For high-throughput systems, consider pre-filtering [ACTIVE_TASKS] to only include tasks from the same tenant, session, or time window before passing them into the prompt. Always validate the output JSON against the schema before routing—if the model returns malformed JSON, retry once with a stricter format reminder, then escalate to a human reviewer if the retry also fails.

IMPLEMENTATION TABLE

Prompt Variables

Required and optional inputs for the Task Uniqueness Scoring Prompt. Each variable must be populated before the prompt is assembled and sent to the model. Validation notes describe how to verify the input is well-formed before execution.

PlaceholderPurposeExampleValidation Notes

[INCOMING_TASK]

The new task payload to score for uniqueness against the active workstream

{"task_id": "t-992", "intent": "update billing address", "entities": ["acct_451"], "constraints": ["eu-region"]}

Must be valid JSON with non-empty intent field. Reject if intent is null or missing. Parse check required before prompt assembly.

[ACTIVE_WORKSTREAM]

Array of currently assigned or in-flight tasks with their fingerprints and status

[{"task_id": "t-881", "fingerprint": "billing-address-change-acct_451", "status": "in_progress", "agent_id": "agent-12"}]

Must be a JSON array. Empty array is valid (no active work). Each entry must have task_id and fingerprint fields. Schema check required.

[RECENTLY_COMPLETED_WINDOW_HOURS]

Time window in hours for recently completed tasks to include in deduplication scope

4

Must be a positive integer between 1 and 72. Null allowed if no completed-task lookup is desired. Range check required.

[SIMILARITY_THRESHOLD]

Minimum semantic similarity score (0.0 to 1.0) that triggers a duplicate flag

0.82

Must be a float between 0.0 and 1.0. Default 0.80 if not specified. Values below 0.70 increase false-positive risk. Range check required.

[TENANT_ISOLATION_ID]

Tenant or workspace identifier to scope deduplication checks and prevent cross-tenant leakage

"tenant-eu-prod-3"

Must be a non-empty string. Required for multi-tenant systems. Reject if null in multi-tenant deployments. Presence check required.

[OUTPUT_CONFIDENCE_FORMAT]

Specifies whether confidence scores use numeric, categorical, or both formats in the output

"numeric_and_categorical"

Must be one of: "numeric_only", "categorical_only", "numeric_and_categorical". Default "numeric_and_categorical". Enum check required.

[AGENT_SPECIALIZATION_CONTEXT]

Optional description of the agent's role and scope to weight ownership claims in arbitration

"billing-agent: handles payment methods, invoices, address changes"

Null allowed. If provided, must be a non-empty string under 500 characters. Used for tie-breaking when similarity scores are close. Length check required.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Task Uniqueness Scoring Prompt into an agent orchestrator with validation, retries, and routing logic.

This prompt is designed to be called synchronously by an orchestrator or task router before a new task is assigned to an agent. The orchestrator should maintain an in-memory or database-backed registry of active workstreams, each represented by a structured fingerprint containing intent, entities, and constraints. When a new task arrives, the orchestrator constructs the prompt by populating the [INCOMING_TASK] and [ACTIVE_WORKSTREAMS] placeholders. The [ACTIVE_WORKSTREAMS] list should be filtered to include only workstreams that are semantically close enough to be potential duplicates—passing every active workstream for a large fleet will blow out the context window and increase latency. A lightweight pre-filter using embedding cosine similarity or keyword overlap against the task fingerprint is recommended before invoking the LLM.

The model response must be parsed as JSON and validated against a strict schema: a uniqueness_score (float, 0.0–1.0), a confidence field (float, 0.0–1.0), a most_similar_workstream_id (string or null), and a rationale (string). If the JSON parse fails or required fields are missing, the orchestrator should retry once with a repair prompt that includes the raw output and the expected schema. If the retry also fails, the task should be routed to a human review queue with the raw output attached. Do not silently default to "unique" or "duplicate" on parse failure—this creates a risk of either duplicate execution or dropped tasks.

For routing decisions, implement a two-threshold system. If uniqueness_score is above 0.8 and confidence is above 0.7, the task is considered novel and can be dispatched to an available agent. If uniqueness_score is below 0.3 and confidence is above 0.7, the task is a likely duplicate and should be blocked or merged with the existing workstream. Scores between 0.3 and 0.8, or any score with confidence below 0.7, should trigger a human-in-the-loop review. Log every scoring result—including the prompt, response, thresholds applied, and routing decision—to enable calibration against human-labeled duplicates over time. This log becomes your eval dataset for tuning thresholds and detecting drift in the model's scoring behavior.

Model choice matters here. Use a model with strong semantic comparison capabilities and reliable JSON output (e.g., GPT-4o, Claude 3.5 Sonnet). Avoid smaller or older models that may produce inconsistent scores or hallucinate workstream IDs. Set temperature=0 to maximize score stability across repeated calls. If your orchestrator processes high task volumes, consider batching multiple incoming tasks into a single prompt to amortize latency, but keep the batch size small (3–5 tasks) to avoid degrading comparison quality. Finally, implement a TTL on workstream fingerprints in the active registry—stale workstreams that haven't been updated in a configurable window should be evicted to prevent false duplicate matches against completed or abandoned tasks.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the structured JSON payload the orchestrator expects after scoring a task for semantic uniqueness. Use this contract to validate model output before routing decisions.

Field or ElementType or FormatRequiredValidation Rule

uniqueness_score

number (0.0 to 1.0)

Must be a float between 0 and 1 inclusive. Parse check: JSON number type. Reject if out of range.

confidence

number (0.0 to 1.0)

Must be a float between 0 and 1 inclusive. Represents model certainty in the score. Reject if confidence < 0.5 and score is used for automatic routing.

matched_workstream_id

string or null

If score > 0.7, must be a non-empty string matching an active workstream ID from [ACTIVE_WORKSTREAMS]. If no match, must be null. Schema check: null allowed only when score <= 0.3.

match_rationale

string

Must be 1-3 sentences explaining the strongest evidence for or against a match. Cannot be empty. Approval required if rationale contradicts the score.

overlapping_entities

array of strings

List of entity names present in both [INCOMING_TASK] and the matched workstream. Must be empty array if no match. Each string must be non-empty.

overlapping_intents

array of strings

List of intent labels shared between [INCOMING_TASK] and the matched workstream. Must be empty array if no match. Validate against [INTENT_TAXONOMY] if provided.

recommended_action

string enum

Must be one of: 'route_new', 'queue_for_merge', 'discard_duplicate', 'escalate_for_review'. Action must be consistent with score: 'discard_duplicate' requires score >= 0.9, 'route_new' requires score <= 0.3.

fingerprint_match

boolean

Indicates whether the generated fingerprint of [INCOMING_TASK] exactly matches any fingerprint in [ACTIVE_WORKSTREAMS]. Used as a hard deduplication signal. If true, score must be >= 0.95.

PRACTICAL GUARDRAILS

Common Failure Modes

Task uniqueness scoring fails in predictable ways. These are the most common failure modes when scoring incoming tasks against active workstreams, with concrete guardrails to prevent each one.

01

Semantic False Positives

What to watch: The scorer flags two tasks as duplicates because they share keywords or entities, but the underlying intents are different. For example, 'Update the billing address for Acme Corp' and 'Update the shipping address for Acme Corp' look similar but require distinct actions. Guardrail: Include intent-level comparison in the prompt, not just entity overlap. Require the model to articulate the core action verb and target object before scoring. Calibrate thresholds against a human-labeled dataset that includes near-miss pairs.

02

Threshold Drift Under Load

What to watch: As the active workstream grows, the scorer becomes more likely to find a 'close enough' match and inflate similarity scores. A task that would score 0.3 against 10 workstreams might score 0.7 against 500, causing false deduplication. Guardrail: Normalize scores by the size of the active workstream or use top-k comparison with a fixed k. Log score distributions over time and alert when the mean similarity score trends upward without a corresponding change in task diversity.

03

Stale Workstream Contamination

What to watch: Completed, abandoned, or expired workstreams remain in the comparison set and cause new tasks to be incorrectly flagged as duplicates. A task that looks like something finished three hours ago gets blocked. Guardrail: Enforce workstream TTLs and status filters in the comparison query. Only compare against active and pending workstreams. Include a staleness check in the prompt that asks the model to consider whether the existing workstream is still relevant before scoring.

04

Cross-Tenant Score Leakage

What to watch: In multi-tenant systems, the scorer compares a task from Tenant A against workstreams from Tenant B and finds a semantic match, causing incorrect deduplication or, worse, revealing that another tenant is working on something similar. Guardrail: Enforce tenant isolation at the retrieval layer before the prompt ever sees the data. The comparison set must be scoped to the requesting tenant only. Add a prompt-level assertion that rejects comparisons crossing tenant boundaries and log any cross-tenant similarity that would have been flagged.

05

Overfitting to Surface Text

What to watch: The scorer relies too heavily on literal string overlap, missing semantic duplicates that use different wording. 'Fix the login bug' and 'Resolve the authentication failure on the sign-in page' describe the same task but share almost no tokens. Guardrail: Use embedding-based pre-filtering before the LLM scoring step. Instruct the model to paraphrase both tasks into a canonical action-object form before comparing. Include few-shot examples that pair lexically dissimilar duplicates with lexically similar non-duplicates.

06

Uncalibrated Confidence Outputs

What to watch: The model outputs a confidence score of 0.85 for a duplicate match, but the actual precision at that threshold is 0.40. Routing decisions based on uncalibrated scores cause both false deduplication and missed duplicates. Guardrail: Maintain a calibration curve from human-labeled evaluation data. Map raw model scores to empirical precision and recall at each threshold. Reject routing decisions when the calibrated confidence falls below the operational threshold. Run recalibration weekly as task distributions shift.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality and calibration of the Task Uniqueness Scoring Prompt before deploying it to production routing. Each row defines a pass standard, a failure signal, and a concrete test method.

CriterionPass StandardFailure SignalTest Method

Semantic Duplicate Recall

Score >= 0.85 for human-labeled duplicate pairs

Score < 0.50 for known duplicates

Run against a golden dataset of 50 confirmed duplicate task pairs and 50 distinct pairs; measure recall at threshold 0.80

Semantic Distinct Precision

Score <= 0.30 for human-labeled distinct task pairs

Score > 0.70 for known distinct pairs

Run against the same golden dataset; measure precision at threshold 0.80

Score Calibration

Mean score for duplicates minus mean score for distincts >= 0.50

Overlapping score distributions between duplicate and distinct classes

Plot score histograms for duplicate vs distinct sets; compute separation margin

Output Schema Compliance

Valid JSON with fields [TASK_ID], [UNIQUENESS_SCORE], [RATIONALE], [CONFIDENCE] present

Missing required fields or malformed JSON

Parse output with JSON schema validator; check field presence and types

Confidence Alignment

[CONFIDENCE] value correlates with score distance from decision boundary (r >= 0.6)

High confidence on borderline scores or low confidence on extreme scores

Compute Pearson correlation between confidence and absolute score distance from 0.5

Cross-Tenant Isolation

Score <= 0.20 for tasks from different tenants with similar wording

Score > 0.50 for cross-tenant task pairs

Test with 20 cross-tenant task pairs that share phrasing but differ in tenant-specific entities

Rationale Grounding

[RATIONALE] references specific fields from [ACTIVE_WORKSTREAM] and [INCOMING_TASK]

Rationale is generic, empty, or hallucinates entities not in input

Manual review of 30 rationales; check for entity grounding and specificity

Latency Budget

Response completes within 2 seconds for workstreams with <= 50 active tasks

Timeouts or > 5 second responses under normal load

Load test with 50 active workstream entries; measure p95 response time over 100 requests

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single frontier model. Replace [ACTIVE_WORKSTREAM_REGISTRY] with a flat JSON array of task descriptions. Skip strict schema validation and use a simple uniqueness_score float between 0 and 1. Log raw outputs for calibration.

Watch for

  • Scores clustering around 0.5 without clear separation
  • Model treating near-duplicates as unique when phrasing differs
  • No baseline comparison against human-labeled pairs
Prasad Kumkar

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.