Inferensys

Prompt

Sub-Task Completion Criteria Definition Prompt Template

A practical prompt playbook for defining unambiguous done conditions for sub-tasks in production multi-agent systems.
Developer reviewing multi-agent chat interface on laptop, agent conversation logs visible, casual coding session at WeWork desk.
PROMPT PLAYBOOK

When to Use This Prompt

Define machine-readable completion criteria for sub-tasks so orchestrators can determine when work is finished, acceptable, or failed.

This prompt is for agent framework developers and orchestration engineers who need to eliminate ambiguity from sub-task completion. When an orchestrator dispatches work to a specialized agent, it must know exactly when that work is finished, whether the output is acceptable, and what conditions constitute failure. Without explicit criteria, orchestrators hang on ambiguous outputs, accept incomplete results, or escalate unnecessarily—each failure mode compounding across multi-agent pipelines. Use this prompt during the decomposition phase, after tasks are identified but before they are dispatched, to generate measurable criteria, acceptance tests, output assertions, and timeout conditions for every sub-task.

The prompt expects you to provide the sub-task description, the agent's capability contract, the expected output schema, and any domain constraints. It produces a structured completion definition that includes: pass/fail assertions with concrete thresholds, edge-case coverage checks, timeout and retry boundaries, and explicit conditions that trigger escalation rather than retry. For high-risk workflows—such as financial calculations, clinical data extraction, or security-sensitive operations—the generated criteria should include human-review gates and evidence-grounding requirements. Wire the output directly into your orchestrator's validation layer so that no sub-task result is accepted without automated verification against the criteria defined here.

Do not use this prompt for trivial tasks where completion is self-evident (e.g., 'return the current timestamp') or for tasks whose success can only be judged by end-user satisfaction. It is also not a replacement for runtime monitoring—this prompt defines static criteria before execution, not dynamic anomaly detection during execution. After generating criteria, run them through your eval harness to check for ambiguity, missing edge cases, and false-positive/false-negative rates before deploying to production orchestration. If the criteria cannot be expressed as machine-checkable assertions, the sub-task itself likely needs further decomposition.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works and where it does not. Use these cards to decide whether the Sub-Task Completion Criteria Definition Prompt Template is the right tool before integrating it into your agent orchestration layer.

01

Good Fit: Deterministic Sub-Tasks

Use when: the sub-task has a clear, measurable output—structured data, a classification label, a generated artifact with a known schema. Guardrail: define acceptance criteria as executable assertions (schema validation, value ranges, required fields) rather than prose descriptions. Ambiguous criteria produce ambiguous completion signals.

02

Bad Fit: Open-Ended Exploration

Avoid when: the sub-task is exploratory research, creative ideation, or requires subjective judgment without a ground-truth reference. Guardrail: for open-ended tasks, replace completion criteria with a time-box or iteration limit and route the output to a human reviewer or a separate summarization agent instead of an automated gate.

03

Required Inputs

What you must provide: a precise sub-task description, the expected output schema, measurable success conditions, timeout thresholds, and any dependency outputs from upstream agents. Guardrail: missing any of these inputs causes the orchestrator to stall or accept invalid results. Validate input completeness before invoking the prompt.

04

Operational Risk: Criteria Drift

What to watch: completion criteria that made sense during design become too strict or too loose as agent behavior evolves, causing false rejections or silent acceptance of bad outputs. Guardrail: version your criteria alongside your prompts, log pass/fail rates per criterion, and set review triggers when rejection rates shift by more than 20% between deployments.

05

Operational Risk: Timeout Cascades

What to watch: a sub-task that never satisfies its completion criteria blocks downstream agents indefinitely, consuming resources and delaying the entire workflow. Guardrail: always pair completion criteria with a hard timeout and a fallback action—escalate, return partial results, or route to a human. Never allow unbounded wait states in production orchestration.

06

When to Skip This Prompt

Avoid when: the sub-task is trivial, the output is already validated by the receiving agent's input contract, or the orchestrator has a simpler built-in completion check. Guardrail: adding formal completion criteria to every sub-task creates unnecessary latency and maintenance overhead. Reserve this prompt for sub-tasks where ambiguity in 'done' has caused production incidents.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for defining unambiguous completion criteria for sub-tasks, ready to copy into your agent framework.

This prompt template produces measurable done conditions for a single sub-task. It generates acceptance tests, output assertions, timeout conditions, and edge-case checks so that an orchestrator can programmatically determine completion without ambiguity. Use it when you are decomposing a complex request and need each sub-task to carry its own verifiable contract. Do not use this prompt for tasks that require subjective human judgment as the primary completion signal—those workflows need a human-in-the-loop handoff instead.

text
You are a sub-task completion criteria designer for a multi-agent orchestration system. Your job is to define unambiguous, machine-verifiable done conditions for a single sub-task. Return only the structured output described below.

## INPUT
Sub-Task Description: [SUB_TASK_DESCRIPTION]
Sub-Task ID: [SUB_TASK_ID]
Assigned Agent Role: [AGENT_ROLE]
Expected Output Type: [OUTPUT_TYPE]
Parent Task Context: [PARENT_TASK_CONTEXT]
Risk Level: [RISK_LEVEL]

## CONSTRAINTS
- All criteria must be verifiable by an automated validator without human interpretation.
- Include explicit timeout and resource limits.
- Define what constitutes partial success versus complete failure.
- Specify edge cases that must be handled, not ignored.
- For high-risk tasks, include mandatory evidence or citation requirements.
- Output must conform to the schema below exactly.

## OUTPUT_SCHEMA
{
  "sub_task_id": "string",
  "completion_criteria": {
    "required_output_fields": ["field_name"],
    "field_assertions": [
      {
        "field": "field_name",
        "type": "string | number | boolean | array | object",
        "required": true,
        "validation_rule": "description of rule",
        "example_valid_value": "example",
        "example_invalid_value": "example"
      }
    ],
    "quality_thresholds": [
      {
        "metric": "metric_name",
        "minimum": 0.0,
        "maximum": 1.0,
        "description": "what this threshold measures"
      }
    ],
    "acceptance_tests": [
      {
        "test_id": "string",
        "description": "what this test verifies",
        "pass_condition": "condition",
        "fail_condition": "condition"
      }
    ],
    "edge_cases": [
      {
        "case": "description of edge case",
        "expected_behavior": "how the agent must handle it",
        "failure_if_ignored": true
      }
    ],
    "timeout_seconds": 0,
    "max_retries": 0,
    "partial_success_definition": "what constitutes partial success",
    "complete_failure_definition": "what constitutes complete failure"
  },
  "evidence_requirements": [
    {
      "evidence_type": "citation | source_reference | trace_log | output_snapshot",
      "description": "what evidence must accompany the output",
      "mandatory_for_acceptance": true
    }
  ],
  "escalation_triggers": [
    {
      "condition": "condition that triggers escalation",
      "escalation_target": "human_review | supervisor_agent | fallback_workflow",
      "priority": "low | medium | high | critical"
    }
  ]
}

## INSTRUCTIONS
1. Analyze the sub-task description and identify all outputs the agent must produce.
2. For each output field, define a type, a validation rule, and valid/invalid examples.
3. Define at least three acceptance tests that cover the happy path and one failure path.
4. Identify at least two edge cases the agent must handle explicitly.
5. Set timeout and retry limits appropriate to the risk level.
6. Define what partial success looks like so the orchestrator can salvage partial results.
7. Specify evidence requirements—what must the agent attach to prove its work?
8. Define escalation triggers for when the agent cannot meet criteria after retries.
9. Return only valid JSON matching the OUTPUT_SCHEMA. No additional text.

To adapt this template, replace each square-bracket placeholder with concrete values from your task decomposition step. The [SUB_TASK_DESCRIPTION] should come directly from your decomposition prompt output. Set [RISK_LEVEL] to low, medium, high, or critical—this drives timeout, retry, and evidence strictness. For high-risk tasks, always require citation evidence and set mandatory_for_acceptance to true. Wire the output of this prompt into your orchestrator's validation gate so that no sub-task result is accepted until all acceptance_tests pass. If a sub-task produces partial success, use the partial_success_definition to decide whether to salvage results or escalate.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the Sub-Task Completion Criteria Definition prompt needs to produce unambiguous, testable done conditions for agent orchestrators.

PlaceholderPurposeExampleValidation Notes

[SUB_TASK_NAME]

Unique identifier for the sub-task being defined

fetch_customer_invoice_history

Must match the task ID used in the dependency graph. Parse check: non-empty string, no special characters except underscores and hyphens.

[SUB_TASK_DESCRIPTION]

Natural language description of what the sub-task is supposed to accomplish

Retrieve all invoices for customer ID 48291 from the billing system for the last 12 months

Must be a complete sentence. Null not allowed. Parse check: minimum 20 characters. Human review required if description is ambiguous.

[EXPECTED_OUTPUT_SCHEMA]

The exact data shape, fields, types, and constraints the sub-task output must satisfy

{"invoices": [{"id": "string", "date": "ISO8601", "amount": "float", "status": "paid|unpaid|disputed"}]}

Must be a valid JSON Schema or TypeScript interface definition. Schema check: parseable by a JSON Schema validator. Required fields must be explicitly marked.

[ACCEPTANCE_TESTS]

Concrete pass/fail test cases the orchestrator can run against the sub-task output

Test 1: Output contains invoices array. Test 2: All date fields parse as valid ISO8601. Test 3: Status field contains only allowed enum values.

Each test must be executable by a validation function. Parse check: array of test objects with 'name', 'assertion', and 'severity' fields. At least one test required.

[TIMEOUT_SECONDS]

Maximum wall-clock time the sub-task is allowed before the orchestrator considers it failed

30

Must be a positive integer. Null not allowed. Validation: if timeout exceeds 300, require explicit justification in [CONSTRAINTS]. Retry condition: timeout triggers escalation per [ESCALATION_POLICY].

[CONFIDENCE_THRESHOLD]

Minimum confidence score the sub-agent must report for the orchestrator to accept the output without human review

0.85

Must be a float between 0.0 and 1.0. Validation: if below 0.7, flag for review. If set to 1.0, require human approval for all outputs. Null allowed only if sub-task is informational.

[DEPENDENCY_INPUTS]

List of upstream sub-task outputs this sub-task requires before it can start

["fetch_customer_profile", "validate_account_status"]

Must reference valid [SUB_TASK_NAME] values from the decomposition plan. Parse check: array of strings. Null allowed only for root tasks. Validation: cross-reference against dependency graph for missing or circular dependencies.

[ESCALATION_POLICY]

Conditions and routing instructions for when the sub-task fails, times out, or produces low-confidence output

On timeout: retry once, then escalate to human_review_queue. On confidence < 0.85: route to supervisor_agent.

Must define actions for timeout, validation failure, and low confidence. Parse check: structured object with trigger conditions and target routing. Approval required if escalation target is a human-facing system.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the sub-task completion criteria prompt into an orchestrator or agent framework with validation, retries, and observability.

This prompt is designed to be called by an orchestrator after task decomposition but before sub-task dispatch. The orchestrator should invoke it once per sub-task, passing the sub-task description, expected output type, and any domain constraints. The prompt returns structured completion criteria that the orchestrator stores alongside the sub-task contract. These criteria become the acceptance gate that downstream validators use to determine whether a sub-agent's output is complete. Do not call this prompt during live execution of the sub-task itself—it is a planning-phase prompt that runs before work begins.

Wire the prompt into your orchestration pipeline as a synchronous pre-dispatch step. After receiving the criteria JSON, validate that every criterion includes a measurable condition (not vague language like 'good enough'), an acceptance test (a specific check that can be automated), and a timeout or staleness threshold. If the prompt returns criteria with missing fields or unmeasurable conditions, retry once with a stronger constraint instruction. Log the raw criteria output, the validation result, and any retries to your observability layer. For high-risk domains such as healthcare or finance, route criteria that fail validation to a human reviewer before the sub-task is dispatched. The orchestrator should store the validated criteria as part of the sub-task's execution contract so that the completion-checking agent can reference them later.

Model choice matters here. Use a model with strong instruction-following and structured output capabilities—GPT-4o, Claude 3.5 Sonnet, or equivalent. Avoid smaller models that may collapse criteria into vague bullet points. If you are using a framework like LangGraph, CrewAI, or a custom orchestrator, treat this prompt as a tool call that returns typed JSON. Set a timeout of 10–15 seconds and a max token limit appropriate for your sub-task complexity (typically 500–1000 tokens). The most common production failure is criteria that pass structural validation but are too ambiguous for automated checking—add an eval step that samples criteria and tests whether a human can unambiguously determine pass/fail from the criterion alone. If ambiguity exceeds 20% in your eval set, tighten the prompt's [CONSTRAINTS] block or add few-shot examples of measurable criteria.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, format, and validation rules for the sub-task completion criteria generated by this prompt. Use this contract to wire the prompt into an orchestrator's evaluation loop.

Field or ElementType or FormatRequiredValidation Rule

criteria_id

string (UUID)

Must be a valid UUID v4 string. Parse check.

sub_task_id

string

Must match the [SUB_TASK_ID] input exactly. Schema check.

acceptance_tests

array of objects

Array length >= 1. Each object must contain 'test_id' (string), 'condition' (string), and 'expected_result' (string). Schema check.

output_assertions

array of objects

Array length >= 1. Each object must contain 'field' (string), 'operator' (enum: equals, contains, matches_regex, is_not_null, greater_than, less_than), and 'value' (string or number). Enum check on operator.

timeout_seconds

integer

Must be > 0 and <= [MAX_TIMEOUT_SECONDS]. Range check.

required_output_fields

array of strings

Array length >= 1. Each string must match a field name in the sub-task's output schema. Schema cross-reference check.

confidence_threshold

float

Must be between 0.0 and 1.0 inclusive. Range check. If null, orchestrator uses default threshold.

edge_case_triggers

array of objects

If present, each object must contain 'trigger_condition' (string) and 'expected_behavior' (string). Null allowed.

PRACTICAL GUARDRAILS

Common Failure Modes

Sub-task completion criteria fail silently when conditions are ambiguous, untestable, or ignore edge cases. These are the most common failure modes and how to prevent them before they reach production.

01

Vague Acceptance Language

What to watch: Criteria like 'the output should be good' or 'the agent should try its best' are impossible to validate programmatically. Orchestrators cannot determine completion, causing infinite loops or premature handoffs. Guardrail: Require every criterion to be a Boolean-checkable assertion with a concrete threshold, schema field, or pass/fail test.

02

Missing Edge-Case Coverage

What to watch: Completion criteria that only cover the happy path pass validation but fail when inputs are empty, null, malformed, or adversarial. The orchestrator accepts broken outputs. Guardrail: Include explicit edge-case assertions for empty inputs, boundary values, and known failure patterns. Run criteria against a curated edge-case dataset before deployment.

03

Timeout Without Partial Results

What to watch: A sub-task hits its time limit and the orchestrator receives nothing usable, forcing a full retry or dead-end escalation. Guardrail: Define a partial-result contract that sub-agents must flush before timeout. Include a minimum-viable-output schema so the orchestrator can decide whether to proceed, retry, or escalate with evidence.

04

Criteria Drift Across Agents

What to watch: Different sub-agents interpret the same completion language differently because criteria are written in natural language without shared operational definitions. Guardrail: Publish a shared criteria glossary with concrete examples and counterexamples. Validate that each agent's output passes the same automated assertion suite before handoff.

05

Overly Strict Criteria Blocking Progress

What to watch: Criteria that demand 100% confidence or perfect completeness cause sub-tasks to loop indefinitely or escalate unnecessarily when approximate results would be sufficient. Guardrail: Define acceptable confidence bands and completeness thresholds per sub-task type. Include a 'good enough' gate with explicit trade-off documentation.

06

Unvalidated Output Shape

What to watch: The sub-agent returns content that passes semantic checks but violates the expected schema, breaking downstream agents that depend on structured fields. Guardrail: Add a schema validation gate before any semantic criteria run. Reject outputs that fail field-level type, enum, or required-field checks immediately, with a structured error for the retry loop.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test whether a generated sub-task completion criteria definition is unambiguous, measurable, and safe to use in an automated orchestrator. Each criterion targets a known failure mode in multi-agent delegation.

CriterionPass StandardFailure SignalTest Method

Criteria Measurability

Every criterion references a concrete, computable check (schema field, count, boolean, threshold) with no vague adjectives.

Criteria contains words like 'good', 'reasonable', 'sufficient', or 'appropriate' without a measurable anchor.

Parse criteria list; flag any entry lacking a numeric threshold, enum membership, or boolean assertion.

Output Schema Coverage

Every required field in [OUTPUT_SCHEMA] is referenced by at least one completion criterion. Optional fields are explicitly marked as optional.

A required field in the output schema has no corresponding validation criterion, or an optional field is treated as required.

Diff criteria field references against [OUTPUT_SCHEMA] required fields; flag missing coverage.

Edge-Case Handling

Criteria explicitly address null inputs, empty lists, zero values, and boundary conditions where applicable.

Criteria assume happy-path inputs only; no mention of null, empty, or boundary behavior.

Inject edge-case [INPUT] variants; check whether criteria produce a clear pass/fail signal or ambiguous result.

Timeout and Non-Completion

Criteria define a maximum wall-clock or step-count timeout and specify the output state on timeout (null, partial, error code).

No timeout condition defined, or timeout behavior is unspecified.

Simulate a stalled sub-task; verify the orchestrator receives an explicit timeout signal rather than hanging.

Ambiguity Score Below Threshold

An automated ambiguity check (e.g., LLM judge with rubric) scores the criteria set below a predefined ambiguity threshold.

Ambiguity score exceeds threshold, indicating multiple reasonable interpretations of the same criterion.

Run criteria through an LLM judge prompt; flag if score > [AMBIGUITY_THRESHOLD].

Assertion Testability

Each criterion can be converted into a deterministic assertion (unit test, JSON Schema check, regex match) without human judgment.

A criterion requires subjective human interpretation to evaluate (e.g., 'the tone should be professional').

Attempt to write an automated assertion for each criterion; flag any that cannot be expressed as code.

Conflict-Free Criteria

No two criteria contradict each other (e.g., one requires a field to be present while another allows null).

Two criteria produce incompatible pass/fail signals on the same valid output.

Generate outputs that satisfy each criterion individually; check for pairwise conflicts using a SAT-like enumeration over small output spaces.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a frontier model and manual review of generated criteria. Drop strict schema enforcement in favor of a checklist format. Accept natural-language completion conditions without requiring machine-readable assertions.

code
[SUB_TASK_DESCRIPTION]: "Fetch user account balance"
[EXPECTED_OUTPUT_TYPE]: "numeric value with currency code"
[CONSTRAINTS]: "must be from the last 24 hours"

Generate 3-5 completion criteria as a bulleted checklist.

Watch for

  • Criteria that are too vague to evaluate programmatically (e.g., "looks correct")
  • Missing timeout conditions—agents hang indefinitely
  • No distinction between partial and full completion
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.