Inferensys

Prompt

Agent Role Context Requirements Specification Prompt

A practical prompt playbook for using the Agent Role Context Requirements Specification Prompt in production AI workflows. This playbook helps integration engineers define exactly what context an agent needs to operate, producing a structured context dependency manifest with tests for degraded behavior.
Wide-angle shot of a modern WeWork open floor plan with creative walls covered in AI system architecture diagrams, product team collaborating in standing desk area with industrial lighting.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the job-to-be-done, ideal user profile, required context, and explicit boundaries for the Agent Role Context Requirements Specification Prompt.

This prompt is for integration engineers and multi-agent system architects who need to formally specify what context an agent requires before it can operate correctly. The core job-to-be-done is producing a context dependency manifest—a structured, machine-readable specification that lists every piece of state, intent signal, conversation artifact, and tool output the agent needs, along with explicit fallback behavior when context is missing or degraded. Use it when you are onboarding a new specialized agent into a multi-agent system, defining handoff contracts between agents, or debugging why an agent produces unreliable outputs that trace back to missing or stale context. The manifest this prompt generates becomes the contract that orchestrators, upstream agents, and context assembly pipelines must satisfy before invoking the agent.

The ideal user is someone who already understands the agent's role and capability boundaries but needs to make its context dependencies explicit and testable. You should have a completed agent role definition and capability boundary contract before using this prompt; those artifacts define what the agent does, while this prompt defines what it needs to know to do it. Required inputs include the agent's role specification, its input/output contracts, the available context sources in your system (session state stores, conversation history, tool output caches, user profile services), and any known failure modes from previous deployments. The prompt works best when you can enumerate the concrete data types and sources available in your agent platform—vague references to 'user context' or 'conversation history' will produce a vague manifest that doesn't prevent production failures.

Do not use this prompt for defining agent capabilities, tool access policies, or role boundaries. Those belong to sibling playbooks: the Agent Role Definition Prompt Template, Agent Capability Boundary Contract Prompt, and Agent Tool Access Policy Prompt respectively. This prompt also should not be used as a substitute for handoff protocol design—the Agent Handoff and Context Transfer Prompts content group covers how to package and transmit context between agents, while this prompt covers what context must be packaged. Finally, avoid using this prompt for agents that operate with purely stateless, self-contained requests where context dependencies are trivial; the overhead of a formal manifest isn't justified when the agent only needs the current user message and nothing else. If you find yourself writing 'no external context required' for every field, you're using the wrong tool for the job.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Agent Role Context Requirements Specification Prompt delivers value and where it creates risk. Use these cards to decide if this prompt fits your integration workflow before you invest in wiring it into a multi-agent pipeline.

01

Good Fit: Multi-Agent Handoff Engineering

Use when: you are building a multi-agent system and need a machine-readable manifest of exactly what context each agent requires before it can operate. Guardrail: run the generated manifest through a handoff simulation test to confirm the orchestrator can satisfy every declared dependency before delegating a task.

02

Good Fit: Context Contract Documentation

Use when: integration engineers need a shared, versioned specification of context dependencies—session state, user intent, conversation history, tool outputs—that both agent developers and orchestrator developers can code against. Guardrail: treat the output as a living contract; re-run the prompt whenever an agent's tool access or domain scope changes.

03

Bad Fit: Single-Agent Chatbots

Avoid when: you are building a standalone chatbot with no handoff to other agents. The context dependency manifest adds specification overhead without a consumer. Guardrail: use a simpler system prompt architecture pattern instead; reserve this prompt for systems with two or more cooperating agents.

04

Bad Fit: Undefined Agent Boundaries

Avoid when: the agent's role, capabilities, and stop conditions have not been defined yet. This prompt assumes a stable role contract exists. Guardrail: complete the Agent Role Definition Prompt Template and Agent Capability Boundary Contract Prompt first, then feed their outputs as inputs here.

05

Required Input: Stable Role Contract

Risk: without a clear agent role definition, the context requirements specification will be vague or miss critical dependencies. Guardrail: require a completed role contract—purpose, scope, tool access, authority limits—as a prerequisite input. Validate that every context dependency traces back to a declared capability or tool.

06

Operational Risk: Degraded Mode Gaps

Risk: the prompt may produce a manifest that assumes all context is always available, missing degraded-mode behavior when session state is incomplete or tool outputs are stale. Guardrail: explicitly include a degraded-context test suite in the prompt's eval criteria. Require the manifest to specify fallback behavior and minimum viable context for each dependency.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for generating a context dependency manifest that specifies exactly what an agent needs to operate.

Use this template to generate a structured context requirements specification for any agent role. The prompt forces the model to enumerate every piece of context the agent depends on—session state, user intent, conversation history, tool outputs, and external data—along with the expected format, source, and degraded behavior when that context is missing or incomplete. Replace each square-bracket placeholder with your agent's specific details before use.

text
You are a context requirements analyst for multi-agent systems. Your task is to produce a complete context dependency manifest for the agent described below.

## Agent Identity
- Agent Name: [AGENT_NAME]
- Agent Role: [AGENT_ROLE_DESCRIPTION]
- Agent Scope: [AGENT_SCOPE_BOUNDARY]
- Agent Capabilities: [AGENT_CAPABILITY_LIST]
- Agent Tools Available: [AGENT_TOOL_LIST]

## Task Description
[AGENT_TASK_DESCRIPTION]

## Output Schema
Produce a JSON object with the following structure:
{
  "agent_name": "string",
  "context_dependencies": [
    {
      "dependency_id": "string",
      "dependency_name": "string",
      "category": "session_state | user_intent | conversation_history | tool_output | external_data | configuration | memory | other",
      "description": "string explaining what this context provides",
      "source": "string describing where this context originates",
      "format": "string describing the expected data shape or schema",
      "required": true | false,
      "priority": "critical | high | medium | low",
      "freshness_requirement": "string describing staleness tolerance",
      "degraded_behavior": "string describing how the agent should behave when this context is missing, stale, or incomplete",
      "fallback_value": "string or null describing a safe default when unavailable",
      "validation_rule": "string describing how to verify this context is valid before use"
    }
  ],
  "context_assembly_order": ["dependency_id_1", "dependency_id_2"],
  "minimum_viable_context": ["dependency_id"],
  "context_conflict_rules": [
    {
      "conflict_description": "string",
      "resolution_strategy": "string"
    }
  ]
}

## Constraints
[CONSTRAINTS]

## Examples
[EXAMPLES]

## Risk Level
[RISK_LEVEL]

Generate only the JSON manifest. Do not include explanatory text outside the JSON.

After copying the template, replace each placeholder with concrete details about your agent. The [CONSTRAINTS] field should include any domain-specific rules, compliance requirements, or operational limits. The [EXAMPLES] field should contain one or two worked examples of context dependencies to calibrate the model's output. Set [RISK_LEVEL] to low, medium, high, or critical to influence the thoroughness of degraded-behavior descriptions. For high-risk or critical agents, always require human review of the generated manifest before integrating it into an orchestration pipeline. Validate the output against the JSON schema programmatically, and re-prompt with the validation error if the model produces malformed JSON or omits required fields.

IMPLEMENTATION TABLE

Prompt Variables

Fill these placeholders before sending the prompt. Each variable shapes the context dependency manifest the model produces. Missing or malformed inputs are the most common cause of incomplete manifests.

PlaceholderPurposeExampleValidation Notes

[AGENT_ROLE_NAME]

Identifies the agent whose context requirements are being specified

BillingDisputeAgent

Must match a defined agent role in the system registry; null not allowed

[AGENT_CAPABILITY_SCOPE]

Describes what the agent is authorized to do, including domain boundaries and tool access

Resolves billing disputes for subscription accounts; accesses payment gateway, CRM, and refund API

Must include explicit domain boundary and tool list; check for vague scope statements

[TASK_CATEGORIES]

Lists the task types the agent is expected to handle

Refund requests, charge disputes, invoice corrections, payment method updates

Must be a concrete list of 3-10 task types; generic entries like 'support tasks' should fail validation

[TOOL_MANIFEST]

Declares available tools with input/output schemas and access constraints

refund_api: {input: transaction_id, amount, reason}, {output: refund_id, status}

Each tool must have a name, input schema, output schema, and rate limit; parse check required

[SESSION_STATE_SCHEMA]

Defines the shape of session state the agent needs to operate

{user_id, account_status, active_subscriptions, recent_transactions, conversation_turn}

Must be a typed schema with required fields marked; null allowed if agent is stateless

[USER_INTENT_SIGNALS]

Specifies how user intent is represented and passed to the agent

Intent label from classifier: {intent: 'refund_request'|'dispute'|'invoice_query', confidence: float}

Must include intent labels and confidence threshold; validate that labels match task categories

[CONVERSATION_HISTORY_FORMAT]

Defines the format and window of conversation history the agent receives

Last 10 turns as {role, content, timestamp} array; system messages excluded

Must specify turn count, field schema, and exclusion rules; parse check on history payload

[UPSTREAM_AGENT_OUTPUTS]

Lists outputs from preceding agents in the chain that this agent may consume

FraudCheckAgent: {risk_score, flags}; AccountVerificationAgent: {account_standing, verification_timestamp}

Each upstream output must have agent name, field names, and types; null allowed if agent is entry point

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the context requirements prompt into an agent registration pipeline with validation, retry logic, and human review gates.

This prompt is designed to run as a pre-deployment gate in an agent registration pipeline, not as a runtime call. When a new agent role is defined, the integration engineer submits the role contract, capability declaration, and tool manifest. The prompt produces a structured context dependency manifest that downstream orchestrators use to decide what state to package before invoking the agent. The manifest should be stored alongside the agent's role definition in your agent registry (e.g., a versioned JSON artifact in a registry service or configuration repository). Do not run this prompt at inference time; the output is a build-time artifact that shapes how the orchestration layer assembles context for each agent invocation.

Integration pattern: Wire this prompt into a CI-style agent onboarding pipeline. When a team submits a new agent role definition, the pipeline runs this prompt against the role contract and produces a context-manifest.json artifact. A schema validator checks the output against the expected manifest schema (required fields: required_context, optional_context, degradation_policy, context_sources, staleness_tolerances). If validation fails, the pipeline rejects the submission and returns structured errors. If validation passes, the manifest is versioned and stored. The orchestrator reads this manifest at agent dispatch time to assemble the correct context payload. Retry logic: If the model returns malformed JSON or misses required fields, retry once with the validation errors appended to the prompt as [PREVIOUS_ERRORS]. If the second attempt also fails, escalate to a human reviewer with the raw output and validation report. Do not auto-merge a manifest that failed validation twice.

Human review gates: For agents operating in regulated domains (finance, healthcare, legal) or agents with write-access to production systems, require human approval on the generated manifest before it becomes active. The review should confirm that required context fields are complete, degradation behavior is safe (e.g., the agent refuses rather than hallucinates when context is missing), and no sensitive data sources are inadvertently listed as required context. Model choice: Use a model with strong JSON schema adherence (GPT-4o, Claude 3.5 Sonnet, or equivalent). Avoid smaller models for this task because schema precision and field completeness are critical. Logging: Log the prompt version, model, raw output, validation result, and reviewer identity for every manifest generation. This creates an audit trail for governance reviews. Tool use: This prompt does not require tool calling. It is a pure structured generation task. If your pipeline uses a RAG system to supply the agent's existing role documentation as [ROLE_CONTRACT], inject that context before the prompt rather than relying on the model's training data.

What to avoid: Do not treat the generated manifest as optional. Orchestrators that ignore the manifest will silently drop context, causing agents to operate with incomplete state and produce degraded outputs. Do not skip the degradation behavior tests described in the eval section—agents that fail gracefully when context is missing are safer than agents that guess. Finally, version your manifests alongside agent role definitions. When an agent's capabilities change, re-run this prompt to regenerate the manifest and flag any new context dependencies that the orchestrator must satisfy.

IMPLEMENTATION TABLE

Expected Output Contract

Validate the generated context dependency manifest against this schema. Each field must satisfy the listed validation rule before the manifest is accepted by downstream orchestration or agent initialization logic.

Field or ElementType or FormatRequiredValidation Rule

manifest_id

string (UUID v4)

Must parse as valid UUID v4; reject if nil or empty

agent_role_id

string

Must match pattern ^agent-[a-z0-9-]+$; cross-reference against registered agent roles

context_dependencies

array of objects

Must be non-empty array; each element must conform to context_dependency_item schema

context_dependency_item.context_type

enum string

Must be one of: session_state, user_intent, conversation_history, tool_output, external_data, policy_context, memory_context

context_dependency_item.source

string

Must be a non-empty string identifying the producing agent, tool, or system; reject if 'unknown' or null

context_dependency_item.required_fields

array of strings

Must contain at least one field name; each field name must be a valid snake_case identifier

context_dependency_item.fallback_behavior

enum string

Must be one of: abort, use_default, ask_orchestrator, proceed_with_warning; reject unknown values

degradation_policy.default_behavior

enum string

Must be one of: abort, partial_execution, escalate; reject if missing or invalid

degradation_policy.per_dependency_overrides

array of objects

If present, each override must reference a valid context_type from context_dependencies and specify an override behavior from the fallback_behavior enum

generated_at

string (ISO 8601 UTC)

Must parse as valid ISO 8601 datetime in UTC; reject if in the future or unparseable

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when specifying agent role context requirements and how to guard against it. These failure patterns emerge when the context dependency manifest is incomplete, ambiguous, or untested against degraded conditions.

01

Implicit Context Assumptions

What to watch: The prompt assumes context fields are always present without declaring them as required dependencies. Agents silently consume stale session state, missing user intent, or empty tool outputs and produce plausible but wrong results. Guardrail: Require every context field to be explicitly declared with a presence requirement (required, optional, or conditional) and a fallback behavior when absent. Test with deliberately incomplete context payloads.

02

Context Schema Drift Between Agents

What to watch: The producing agent changes its output schema without updating the consuming agent's context requirements specification. Field renames, type changes, or semantic shifts cause silent misinterpretation at the handoff boundary. Guardrail: Version the context contract schema and validate incoming context against the expected schema at runtime. Reject or flag mismatched schema versions before the agent processes the context.

03

Over-Specification of Context Shape

What to watch: The prompt demands an exhaustive, rigid context structure that callers cannot reliably populate in production. Agents refuse to operate or hallucinate missing fields when context is slightly incomplete. Guardrail: Distinguish between must-have fields (blocking) and nice-to-have fields (degraded operation). Define a minimum viable context payload and test agent behavior when only that minimum is provided.

04

Missing Degradation Behavior Specification

What to watch: The prompt defines what context the agent needs but never specifies what the agent should do when context is incomplete, stale, or contradictory. The agent either hallucinates to fill gaps or fails with an unhelpful error. Guardrail: For every context field, specify the degradation behavior: use a default, ask for clarification, escalate, or abort. Include degradation test cases in the eval suite.

05

Context Provenance Blindness

What to watch: The prompt treats all context as equally trustworthy without tracking source, timestamp, or confidence. The agent acts on outdated user preferences, low-confidence tool outputs, or unverified session state as if they were authoritative. Guardrail: Require each context field to carry provenance metadata (source, timestamp, confidence score). Instruct the agent to weight context by recency and confidence, and to flag conflicts between sources.

06

Unbounded Context Growth in Multi-Turn Sessions

What to watch: The prompt assumes all accumulated session context is relevant and fits within the context window. Long-running agent sessions accumulate stale facts, resolved questions, and obsolete tool outputs that crowd out current intent. Guardrail: Define a context pruning policy: maximum age per field, maximum total context size, and rules for summarizing or discarding resolved items. Test with sessions that exceed the expected turn count.

IMPLEMENTATION TABLE

Evaluation Rubric

Score each generated context dependency manifest against these criteria. A passing score is 80 out of 100. Run tests before integrating the manifest into an agent harness.

CriterionPass StandardFailure SignalTest Method

Context Completeness

All required context sources from the agent's role contract are listed with a source path

Missing context source that the agent's tool or policy references

Diff manifest entries against the agent's tool access policy and input contract schemas

Degradation Behavior

Every context source has a defined fallback or degradation behavior when unavailable

Context source listed with no fallback; agent would receive null or empty string silently

Parse each context entry for a non-empty degradation field; flag any null or missing value

Schema Alignment

Context field names and types match the agent's input contract exactly

Type mismatch or renamed field that breaks the agent's input validation

Validate manifest fields against the agent's input contract JSON Schema using a schema validator

Source Grounding

Every context entry cites its origin: session store, tool output, user input, or static config

Context entry with no origin tag or ambiguous source description

Regex check for origin field presence; sample 5 entries and trace to declared source

Staleness Rules

Time-sensitive context includes a max-age or invalidation condition

Session timestamp or tool output listed without a TTL or refresh trigger

Parse each entry for a staleness field; flag entries with temporal data but no max-age

Minimal Viable Context

Manifest declares a minimum set of context required for the agent to attempt any task

No minimum set declared; agent would attempt tasks with empty context

Check for a dedicated minimum_context block; verify it is a strict subset of the full manifest

Conflict Resolution

Manifest specifies which source wins when the same field appears in multiple context sources

Duplicate field across sources with no priority or merge rule

Detect duplicate field names across entries; verify a priority or merge strategy is declared

Privacy and PII Marking

Context entries containing user data are tagged with a sensitivity level and retention limit

User email, name, or ID listed without a sensitivity tag or retention policy

Scan field names and descriptions for PII indicators; verify sensitivity and retention fields are populated

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base prompt template and remove strict output schema requirements. Replace the full JSON manifest with a structured markdown table. Use a single model call without validation loops. Focus on getting a reasonable context dependency list, not a production-grade manifest.

code
You are analyzing an agent role to determine what context it needs to operate.

Agent Role: [ROLE_DESCRIPTION]
Task Types: [TASK_LIST]

List every context dependency this agent requires, grouped by category (session state, user intent, conversation history, tool outputs, external data). For each dependency, note whether it is required or optional.

Output as a markdown table with columns: Dependency, Category, Required/Optional, Source, Notes

Watch for

  • Missing edge-case dependencies (degraded mode, empty state, stale data)
  • Overly broad categories that hide specific requirements
  • No distinction between hard requirements and nice-to-have context
  • The model may skip tool-output dependencies entirely
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.