Inferensys

Prompt

Agent Role Decomposition Prompt for Complex Domains

A practical prompt playbook for using Agent Role Decomposition Prompt for Complex Domains in production AI workflows.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Understand the job-to-be-done, ideal user profile, required inputs, and explicit boundaries for the Agent Role Decomposition Prompt.

System designers and platform engineers use this prompt when they need to break a complex domain—such as customer support, financial operations, or healthcare administration—into a set of well-scoped, non-overlapping agent roles. The prompt produces a role hierarchy with specialization rationale, interaction contracts, and completeness checks against domain coverage requirements. Use this before writing individual agent system prompts or building orchestration logic. The ideal user has deep domain knowledge and understands the operational workflows that agents will automate; they are not looking for a generic list of AI personas but a structured decomposition that prevents duplicated work, conflicting actions, and handoff failures in production multi-agent systems.

This prompt requires several concrete inputs to produce useful output. You must supply a [DOMAIN_DESCRIPTION] that captures the full scope of work, including task types, user intents, and operational boundaries. A [DOMAIN_TAXONOMY] of existing capability areas, service categories, or team responsibilities helps the model ground its decomposition in real organizational structure rather than inventing arbitrary divisions. Include [CONSTRAINTS] such as regulatory requirements, latency budgets, tool access limits, and human-review triggers that shape where boundaries must fall. Optionally provide [EXISTING_AGENT_ROLES] if you are extending or refactoring an existing multi-agent system rather than designing from scratch. The prompt works best when the domain has at least three distinct capability areas; for simpler domains with one or two clear functions, a single-agent system prompt is more appropriate and this decomposition step adds unnecessary complexity.

Do not use this prompt for simple single-agent workflows, domains with fewer than three distinct capability areas, or situations where the task routing logic is already well-understood and stable. Avoid using it as a one-time design exercise without follow-up validation—the output is a starting point for iteration, not a final architecture. After generating the role decomposition, you must validate it against real use cases, test for boundary conflicts using the sibling Agent Role Conflict Detection Prompt, and verify coverage completeness with the Agent Role Validation Prompt Against Use Cases. If the domain involves high-risk decisions in regulated industries, add a human review step before deploying any agent roles derived from this decomposition. The next step after this prompt is to take each generated role and feed it into the Agent Role Definition Prompt Template to produce a full role contract with scope, authority, and stop conditions.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Agent Role Decomposition Prompt works, where it fails, and what you must provide before running it.

01

Good Fit: Greenfield Multi-Agent Design

Use when: You are designing a new multi-agent system from scratch and need a principled role hierarchy before writing any agent code. Why it works: The prompt forces explicit separation of concerns, capability boundaries, and interaction contracts before implementation begins, preventing expensive refactoring later.

02

Bad Fit: Single-Agent or Monolithic Systems

Avoid when: Your system uses a single agent with a flat tool list or a monolithic prompt. Risk: The decomposition output will over-engineer role boundaries that add orchestration overhead without benefit. Use simpler role definition prompts instead.

03

Required Input: Complete Domain Coverage Map

What to watch: Running this prompt without a documented domain coverage map produces roles with gaps or overlaps. Guardrail: Provide a structured list of all tasks, capabilities, and domain boundaries the system must cover before invoking decomposition. The prompt checks completeness against this map.

04

Operational Risk: Role Proliferation

What to watch: The prompt may generate too many fine-grained roles, creating orchestration complexity and handoff latency. Guardrail: Set a maximum role count constraint in [CONSTRAINTS] and require a justification for each role that passes a minimum-responsibility threshold.

05

Operational Risk: Implicit Authority Conflicts

What to watch: Two roles may claim authority over the same action without explicit conflict. Guardrail: Run the output through the Agent Role Conflict Detection Prompt as a follow-up step. Require pairwise authority checks before accepting the decomposition.

06

Input Dependency: Tool and Capability Inventory

What to watch: Roles defined without knowledge of available tools produce contracts that cannot be executed. Guardrail: Provide a complete tool inventory with access policies as part of [CONTEXT]. Each role must map its responsibilities to specific available tools or flag capability gaps explicitly.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt for decomposing a complex domain into a set of well-scoped, non-overlapping agent roles with clear interaction contracts.

This prompt template is designed to be placed directly into your orchestration layer or prompt management system. It instructs the model to act as a system architect, analyzing a provided domain description and producing a structured decomposition of agent roles. The output includes a role hierarchy, specialization rationale, and interaction contracts, which are essential for preventing duplicated work and handoff failures in multi-agent systems. Before using this template, ensure you have a clear, written description of the domain, its core workflows, and any known constraints.

text
You are a principal system architect specializing in multi-agent AI systems. Your task is to decompose a complex domain into a set of well-scoped, specialized agent roles. The goal is to maximize separation of concerns, minimize overlapping responsibilities, and define clear interaction contracts between agents.

## Domain to Decompose
[DOMAIN_DESCRIPTION]

## Constraints
- [CONSTRAINT_1, e.g., 'Agents cannot share tool access']
- [CONSTRAINT_2, e.g., 'All customer-facing actions require a human approval agent']
- [CONSTRAINT_3]

## Output Schema
Produce a JSON object with the following structure:
{
  "domain_summary": "A one-paragraph summary of the domain as understood.",
  "role_hierarchy": [
    {
      "role_id": "string",
      "role_name": "string",
      "specialization_rationale": "Why this role is distinct and necessary.",
      "owned_capabilities": ["capability_1", "capability_2"],
      "explicit_exclusions": ["task_type_to_reject"],
      "interaction_contracts": [
        {
          "interacts_with": "role_id",
          "handoff_trigger": "Condition for initiating interaction.",
          "input_schema": { "field": "type_description" },
          "output_schema": { "field": "type_description" },
          "expected_preconditions": ["state_or_condition"],
          "guaranteed_postconditions": ["state_or_condition"]
        }
      ],
      "stop_conditions": ["condition_to_halt_immediately"]
    }
  ],
  "coverage_assessment": {
    "covered_workflows": ["workflow_from_domain"],
    "uncovered_workflows": ["workflow_with_no_owner"],
    "overlap_risks": ["description_of_potential_conflict"]
  }
}

## Instructions
1. Analyze [DOMAIN_DESCRIPTION] to identify distinct areas of responsibility.
2. Create a role for each distinct area. A role should be defined by what it owns, not by a single task.
3. For every role, explicitly state what it does NOT do to prevent overlap.
4. Define interaction contracts only between roles that must communicate. A contract must specify the trigger, the data passed, and the state guarantees.
5. After defining all roles, perform a coverage assessment to identify any gaps or overlaps in the proposed architecture.
6. If the domain is high-risk ([RISK_LEVEL] is 'high'), ensure every role that takes an action has a corresponding stop condition and a clear escalation path to a human or an arbiter agent.

To adapt this prompt, replace the square-bracket placeholders with your specific context. The [DOMAIN_DESCRIPTION] should be a dense, factual description of the problem space, such as 'enterprise IT incident management from alert to resolution.' The [CONSTRAINT] placeholders are critical for grounding the decomposition in your operational reality; common constraints include security policies, data residency requirements, or existing system integrations. The [RISK_LEVEL] input ('low', 'medium', 'high') controls the strictness of stop conditions and escalation paths in the generated roles. After generating the role set, you must validate the output against your known use cases before integrating it into an orchestrator. A common failure mode is generating roles that are logically distinct but share the same underlying tool or data source, which creates a hidden coupling that the coverage assessment might miss. Always review the explicit_exclusions and owned_capabilities for each role pair to ensure true separation of concerns.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Agent Role Decomposition Prompt. Each variable must be populated before execution to ensure the model can analyze the domain, propose roles, and validate coverage.

PlaceholderPurposeExampleValidation Notes

[DOMAIN_NAME]

Identifies the complex domain to decompose into agent roles.

Healthcare Claims Adjudication

Must be a non-empty string. Reject if generic terms like 'stuff' or 'things' are used.

[DOMAIN_DESCRIPTION]

Provides a concise summary of the domain's scope, key workflows, and primary actors.

Processes insurance claims from submission through payment, involving providers, payers, and members.

Must be 2-5 sentences. Reject if it contains no verbs or describes no actions.

[CORE_CAPABILITIES]

Lists the distinct functional capabilities the system must support, used to seed role generation.

Claim intake validation, medical necessity review, benefits verification, payment calculation, denial letter generation.

Must be a list of 5-15 items. Reject if items are duplicates or describe outcomes instead of capabilities.

[CONSTRAINTS]

Defines non-functional and regulatory boundaries that shape role scope and authority.

HIPAA compliance required. No agent may approve claims above $50,000 without human review. All denials must cite a specific policy clause.

Must include at least one regulatory or safety constraint. Reject if constraints are purely stylistic.

[EXISTING_ROLES]

Lists any pre-existing agent roles to avoid duplication and ensure compatibility.

Fraud Detection Agent, Member Portal Agent

Can be null or an empty list. If provided, each role must have a name and a one-line description.

[OUTPUT_SCHEMA]

Specifies the exact JSON schema for the decomposed role hierarchy and interaction contracts.

{ roles: [{ name, rationale, capabilities, boundaries, handoff_contracts }], coverage_gaps: [] }

Must be a valid JSON Schema object. Reject if it lacks a roles array or a coverage_gaps field.

[COVERAGE_THRESHOLD]

Sets the minimum percentage of core capabilities that must be assigned to at least one role.

0.95

Must be a float between 0.0 and 1.0. Reject if below 0.8 for production use. Triggers a completeness re-check if not met.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the role decomposition prompt into a system design workflow with validation, iteration, and human review gates.

This prompt is a design-time tool, not a runtime agent. It should be integrated into a system architect's workflow—typically a CLI, internal tool, or design review pipeline—where the output is consumed by a human who makes final decisions about agent boundaries. The prompt expects a domain description and optionally existing role definitions, and it returns a structured decomposition with roles, responsibilities, interaction contracts, and coverage analysis. Because the output shapes a multi-agent architecture, treat it as a design artifact that requires review before implementation.

Wire the prompt into a tool that collects [DOMAIN_DESCRIPTION], [EXISTING_ROLES] (if any), and [COVERAGE_REQUIREMENTS]. Before calling the model, validate that the domain description is substantive—reject inputs under 200 characters or those that are purely generic. After receiving the output, run a structural validator that checks: (1) every role has a unique identifier, (2) every responsibility maps to exactly one primary role, (3) interaction contracts reference valid role IDs, and (4) the coverage matrix addresses all required domain areas. Log any validation failures and surface them to the architect with the raw output for comparison. For high-stakes domains like healthcare or finance, add a mandatory human review step that requires explicit sign-off on role boundaries before any agent implementation begins.

Model choice matters here. Use a model with strong reasoning and structured output capabilities—GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro are appropriate. Set temperature low (0.0–0.2) to reduce variance in role boundary decisions. If the output fails structural validation, do not silently retry with the same input. Instead, feed the validation errors back into a correction prompt that includes the original output and the specific failures, asking the model to repair only the invalid sections. Limit correction attempts to two retries; if validation still fails, escalate to a human with the full failure log. Store every decomposition attempt, validation result, and human decision in a versioned design log so teams can trace why agent boundaries were drawn the way they were.

IMPLEMENTATION TABLE

Expected Output Contract

Validate the structure and content of the agent role decomposition output before passing it to downstream orchestration or documentation systems.

Field or ElementType or FormatRequiredValidation Rule

role_hierarchy

Array of objects

Must contain at least 2 roles. Each object must have a unique role_id string and a parent_role_id string or null for root roles.

role_hierarchy[].role_id

String (snake_case)

Must match pattern ^[a-z]+(_[a-z]+)*$. Must be unique across all roles in the hierarchy.

role_hierarchy[].specialization_rationale

String

Must be 50-500 characters. Must reference at least one domain-specific capability or constraint from [DOMAIN_DESCRIPTION].

interaction_contracts

Array of objects

Must contain at least one contract for every pair of roles that interact. Each object requires source_role_id, target_role_id, and handoff_schema.

interaction_contracts[].handoff_schema

Object

Must include required_context (array of strings) and output_artifact (string describing the payload type). No empty arrays.

domain_coverage_report

Object

Must contain covered_capabilities (array) and uncovered_gaps (array). covered_capabilities must reference at least 80% of items from [REQUIRED_CAPABILITIES].

domain_coverage_report.uncovered_gaps

Array of strings

Each entry must explain why a capability from [REQUIRED_CAPABILITIES] is not covered and propose a mitigation or escalation path.

separation_of_concerns_check

Object

Must contain overlap_pairs (array of role_id pairs with overlapping responsibilities) and conflict_notes (string). If no overlaps, overlap_pairs must be an empty array and conflict_notes must state 'No overlaps detected.'

PRACTICAL GUARDRAILS

Common Failure Modes

Agent role decomposition fails silently in production. These are the most common failure patterns when breaking a complex domain into specialized agents, with concrete mitigations to catch them before they reach users.

01

Overlapping Responsibility Claims

What to watch: Two or more agents claim ownership of the same sub-task, producing duplicated work, conflicting outputs, or deadlocked handoffs. This happens when role boundaries are described in fuzzy natural language rather than explicit capability contracts. Guardrail: Run pairwise overlap analysis across all role definitions before deployment. Require each agent to declare explicit exclusions alongside capabilities. Use a structured scope-of-work declaration with enumerated task types, not free-text role descriptions.

02

Coverage Gaps in the Domain

What to watch: The decomposed roles collectively miss an entire sub-domain, edge case, or task category. The orchestrator has no agent to route to, producing silent failures, fallback loops, or hallucinated responses from an unqualified agent. Guardrail: Map every required use case from the domain specification to at least one responsible agent before accepting the decomposition. Use a responsibility matrix prompt to detect unassigned rows. Validate coverage with a labeled test suite of domain tasks.

03

Handoff Context Loss Between Agents

What to watch: Agent A completes its work but passes incomplete or malformed context to Agent B. Missing user intent, dropped constraints, or stripped evidence causes downstream agents to operate on degraded information. Guardrail: Define explicit input/output contracts with required fields, types, and validation rules for every handoff boundary. Test handoff payloads against the receiving agent's input schema before routing. Reject malformed handoffs rather than silently processing them.

04

Authority Conflicts and Contradictory Instructions

What to watch: Two agents issue conflicting directives, or one agent overrides another's output without arbitration. The system produces inconsistent results that erode user trust and create reconciliation debt downstream. Guardrail: Implement an explicit arbitration policy with precedence rules, confidence thresholds, and escalation paths. Use a conflict detection prompt to scan role definitions for contradictory stop conditions, tool access grants, or decision authority before deployment.

05

Agent Refuses or Escalates Too Aggressively

What to watch: Overly conservative stop conditions cause agents to refuse valid requests or escalate tasks that they are fully capable of handling. The system becomes brittle and forces unnecessary human intervention. Guardrail: Test refusal boundaries with adversarial and edge-case inputs during role validation. Calibrate stop conditions against a labeled dataset of in-scope and out-of-scope requests. Include explicit examples of what the agent should handle versus escalate in the role definition prompt.

06

Orchestrator Routes to the Wrong Agent

What to watch: The orchestrator misclassifies a task and delegates it to an agent lacking the required capability or domain knowledge. The receiving agent either hallucinates, refuses silently, or produces low-quality output that passes superficial validation. Guardrail: Validate routing accuracy against a labeled delegation dataset with known correct assignments. Include confidence scores and fallback options in every routing decision. Monitor production traces for routing mismatches where the assigned agent's scope declaration excludes the actual task.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the output of the Agent Role Decomposition Prompt before integrating it into a multi-agent orchestration system. Each criterion targets a specific failure mode in role decomposition.

CriterionPass StandardFailure SignalTest Method

Domain Coverage Completeness

Every subdomain listed in [DOMAIN_DESCRIPTION] is assigned to at least one agent role with explicit rationale

A subdomain from the input is missing from the role hierarchy output

Parse output JSON, extract all assigned subdomains, diff against [DOMAIN_DESCRIPTION] subdomain list

Separation of Concerns

No two agent roles share primary responsibility for the same task type or capability

Two role definitions claim ownership of the same action verb or capability in their scope declarations

Extract capability lists per role, run pairwise intersection check, flag any overlap above 0%

Interaction Contract Validity

Every handoff or interaction between roles includes input schema, output schema, and preconditions

A handoff reference exists between two roles but lacks a typed contract or precondition

Parse all interaction edges from output, verify each edge has non-null schema and precondition fields

Escalation Path Completeness

Every role has a defined escalation target for out-of-scope, low-confidence, and policy-triggered scenarios

A role definition contains no escalation target or uses a circular self-reference

For each role, check that escalation.target is non-null and not equal to the role's own identifier

Boundary Refusal Clarity

Each role includes explicit stop conditions with trigger phrases and refusal language

A role's stop conditions are empty, generic, or duplicate the system-level refusal policy without role-specific triggers

Extract stop_conditions array per role, verify length >= 1 and each entry contains a unique trigger and refusal message

Role Hierarchy Rationale

The specialization rationale explains why each role exists and why the decomposition depth is appropriate

Rationale is missing, circular, or justifies roles with generic statements like 'improves modularity'

Parse rationale field, check for presence of domain-specific justification and depth explanation, reject generic boilerplate

Conflict Detection Output

The output includes a pairwise conflict report identifying any overlapping responsibilities with severity ratings

No conflict report present, or report claims zero conflicts when coverage overlap exists

Run overlap analysis on output roles, compare against the conflict report in the output, flag mismatches

Output Schema Conformance

The output matches the [OUTPUT_SCHEMA] exactly with all required fields present and correctly typed

Required fields are missing, types are wrong, or extra undeclared fields appear

Validate output JSON against [OUTPUT_SCHEMA] using a schema validator, reject on any violation

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a frontier model (GPT-4o, Claude 3.5 Sonnet). Remove the [OUTPUT_SCHEMA] constraint and ask for a markdown table instead. Drop the completeness checklist and interaction contract sections. Focus on getting a reasonable role breakdown first.

code
You are a system architect. Break down [DOMAIN] into specialized agent roles. For each role, provide:
- Role name
- Core responsibility (1 sentence)
- 3 capabilities
- 3 explicit exclusions

Watch for

  • Roles that overlap significantly without clear boundaries
  • Missing domain coverage for edge-case workflows
  • Overly broad roles that should be split further
  • No validation of the output structure before iterating
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.