This prompt is designed for orchestration engineers and platform builders who need to produce a standardized, machine-readable handoff record when one agent transfers work to another. The primary job-to-be-done is generating a structured payload that captures the current task state, completed steps, pending actions, unresolved ambiguities, and relevant context—ensuring the receiving agent can resume work without re-discovering what already happened. Use this when your multi-agent system has explicit handoff points between specialized agents, and you need traceable, auditable context transfers rather than ad-hoc message passing.
Prompt
Multi-Agent Handoff Record Prompt Template

When to Use This Prompt
Define the job, ideal user, required context, and constraints for the Multi-Agent Handoff Record Prompt Template.
Do not use this prompt for simple chat message forwarding, single-agent task decomposition, or scenarios where agents share a persistent memory store and don't need explicit handoff artifacts. It is also inappropriate for real-time streaming handoffs where latency constraints prevent structured record generation. The prompt assumes you have access to the sending agent's execution trace, tool call history, and current state representation. Required inputs include: the sending agent's role identifier, the receiving agent's role identifier, the original user request, completed steps with outcomes, pending actions with dependencies, unresolved questions or ambiguities, relevant context snippets, and any constraints or policies the receiving agent must respect. Without these inputs, the handoff record will be incomplete and the receiving agent will operate with degraded context.
Before deploying this prompt into production, implement schema validation on the generated handoff payload to catch missing required fields, malformed timestamps, or truncated context arrays. Silent data loss during handoff is the most common failure mode in multi-agent systems—a missing pending_actions field or an empty unresolved_ambiguities array can cause the receiving agent to skip critical work. Pair this prompt with a validation step that checks field presence, type correctness, and context completeness before the handoff is accepted. For high-risk workflows involving financial decisions, healthcare data, or compliance-sensitive operations, route handoff records through a human review queue before the receiving agent acts on them. The next step after reading this section is to review the prompt template, adapt the output schema to your agent communication protocol, and wire it into your orchestration layer with validation and logging.
Use Case Fit
Where the Multi-Agent Handoff Record Prompt Template delivers value and where it introduces risk. Use these cards to decide if this prompt fits your orchestration architecture.
Strong Fit: Structured Agent Graphs
Use when: you have a defined DAG or sequential pipeline where agents pass task state forward. The prompt excels at enforcing a consistent schema for context transfer. Avoid when: agents communicate through unstructured chat or ad-hoc messages without a clear handoff point.
Poor Fit: Single-Agent Systems
Avoid when: only one agent handles the entire request lifecycle. The handoff record adds serialization overhead without a receiving agent. Guardrail: use a lightweight internal state object instead; reserve this prompt for multi-agent boundaries.
Required Inputs
Must provide: the sending agent's task state, completed steps with outcomes, pending actions with owners, and any unresolved ambiguities. Risk: missing the 'unresolved ambiguities' field causes the receiving agent to silently assume resolution, a top production failure mode.
Operational Risk: Schema Drift
What to watch: the handoff schema evolves independently in sending and receiving agents, causing silent field dropping. Guardrail: version the handoff schema explicitly in a schema_version field and validate it at the receiving agent's boundary before processing.
Operational Risk: Silent Data Loss
What to watch: the sending agent omits critical context because it was not in the prompt's output instructions. Guardrail: implement a post-generation validator that checks for required fields and non-null values before the handoff payload is forwarded.
Not a Replacement for Shared Memory
Avoid when: agents need real-time access to a shared state store. The handoff record is a point-in-time snapshot, not a live context. Guardrail: pair this prompt with a blackboard or memory store for long-running, multi-turn agent interactions.
Copy-Ready Prompt Template
A reusable prompt template for generating standardized, traceable handoff records between agents in a multi-agent system.
This prompt template is the core of the handoff record playbook. It instructs a model to act as an orchestration logger, consuming the raw state of a completed agent task and producing a structured, machine-readable payload. The payload is designed to be the single source of truth for what the next agent receives, eliminating ambiguity and silent context loss. Every field is intentional: it captures not just what was done, but what was left undone, what is uncertain, and what constraints the receiving agent must respect. Use this template directly in your orchestration layer, passing the output to the next agent's context window or storing it in an audit log.
textYou are an Agent Handoff Recorder. Your only job is to produce a valid JSON object that captures the complete state of a task transfer from one agent to another. Do not perform the task. Do not continue the work. Only document the transfer. Generate a JSON object conforming to the schema below, using the provided inputs. [OUTPUT_SCHEMA] { "handoff_id": "string, unique identifier for this transfer event", "timestamp": "string, ISO 8601 UTC timestamp of the handoff", "from_agent": { "agent_id": "string", "agent_role": "string, e.g., 'ResearchAgent', 'CodeAnalysisAgent'" }, "to_agent": { "agent_id": "string", "agent_role": "string" }, "task_summary": { "original_objective": "string, the high-level goal from the user or upstream agent", "completed_steps": [ { "step_id": "string", "description": "string, what was done", "outcome": "string, the result or artifact produced", "evidence_refs": ["string, pointer to log entry, tool output, or file"] } ], "pending_actions": [ { "action_id": "string", "description": "string, what still needs to be done", "reason_incomplete": "string, e.g., 'blocked by missing data', 'delegated to next agent', 'out of scope'", "suggested_owner": "string, agent_id or 'human'" } ], "unresolved_ambiguities": [ { "ambiguity_id": "string", "question": "string, the open question or unclear requirement", "impact": "string, how this ambiguity affects downstream work", "possible_interpretations": ["string"] } ] }, "context_payload": { "key_findings": ["string, critical facts or conclusions for the next agent"], "relevant_data": ["string, data snippets, file paths, or variable values"], "constraints_for_next_agent": ["string, rules, budgets, or boundaries the next agent must follow"], "escalation_triggers": ["string, conditions under which the next agent should stop and escalate"] }, "confidence_assessment": { "overall_confidence": "string, 'high' | 'medium' | 'low'", "low_confidence_areas": ["string, specific parts of the work that are uncertain"] } } [INPUT] - from_agent_state: [RAW_AGENT_STATE] - task_definition: [TASK_DEFINITION] - handoff_policy: [HANDOFF_POLICY] [CONSTRAINTS] 1. Populate every field. Use empty arrays [] if there are no items, never omit a field. 2. Do not invent information. If a detail is not present in the [RAW_AGENT_STATE], mark it as "unknown" or add it to "unresolved_ambiguities". 3. The "context_payload" must be self-contained. The next agent should not need to read the full agent state to understand what to do. 4. If the handoff_policy specifies a required field that is missing, add a warning to "unresolved_ambiguities". 5. Output ONLY the JSON object. No markdown fences, no explanatory text.
To adapt this template, start by mapping your agent framework's internal state representation to the [RAW_AGENT_STATE] placeholder. This is often a large, semi-structured log. The prompt's primary value is in compressing that log into the context_payload without dropping critical constraints or pending actions. The [HANDOFF_POLICY] input is a critical control point: use it to inject domain-specific rules, such as 'never transfer PII in the context_payload' or 'always include the original user query verbatim.' Before deploying, run this prompt against a golden dataset of known agent states and validate the output JSON against the schema. Common failures include omitting empty arrays, hallucinating completed steps that weren't in the log, and leaking sensitive data from the raw state into the summary. If the workflow is high-risk, route the generated handoff record to a human review queue before the next agent consumes it.
Prompt Variables
Required inputs for the Multi-Agent Handoff Record Prompt Template. Each placeholder must be populated before the prompt is assembled. Missing or malformed inputs are the most common cause of silent data loss during agent context transfer.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[ORIGINATING_AGENT_ID] | Unique identifier of the agent initiating the handoff | research-agent-v2 | Must match a known agent ID in the orchestration registry. Reject if null or not found in active agent roster. |
[RECEIVING_AGENT_ID] | Unique identifier of the agent receiving the handoff | synthesis-agent-v1 | Must differ from ORIGINATING_AGENT_ID. Reject if null or if agent is marked as unavailable in the orchestration layer. |
[TASK_ID] | Correlation identifier linking this handoff to the parent workflow or user request | wf-2025-03-15-0042 | Must be a non-empty string. Validate format against the workflow engine's ID convention. Reject if missing or truncated. |
[TASK_STATE] | Serialized representation of the current task progress, including completed steps and remaining work | {"completed": ["extract", "classify"], "pending": ["summarize"], "current_step": "classify"} | Must be valid JSON. Schema check: requires completed (array), pending (array), and current_step (string) fields. Reject if unparseable or missing required fields. |
[COMPLETED_STEPS] | Ordered list of steps the originating agent finished, with outputs and confidence scores | [{"step": "extract_entities", "output_ref": "s3://bucket/entities.json", "confidence": 0.94}] | Must be a JSON array. Each element requires step (string), output_ref (string), and confidence (float 0.0-1.0). Reject if confidence is below the workflow's minimum threshold without an explicit override flag. |
[PENDING_ACTIONS] | List of actions the receiving agent is expected to perform, with priority and deadline | [{"action": "synthesize_report", "priority": "high", "deadline": "2025-03-15T18:00:00Z"}] | Must be a JSON array. Each element requires action (string) and priority (enum: low, medium, high, critical). Deadline is optional but recommended. Reject if priority is not in the allowed enum. |
[UNRESOLVED_AMBIGUITIES] | List of questions, conflicts, or low-confidence findings the receiving agent must resolve or escalate | [{"issue": "conflicting_source_claims", "detail": "Source A and Source B disagree on revenue figure", "recommended_action": "cross-reference_with_Source_C"}] | Must be a JSON array or explicit null if no ambiguities exist. Each element requires issue (string) and detail (string). Reject if the array contains elements missing the issue field. |
[CONTEXT_PAYLOAD] | Full context snapshot including user input, retrieved documents, tool outputs, and session history relevant to the handoff | {"user_query": "...", "retrieved_docs": [...], "tool_outputs": {...}, "session_summary": "..."} | Must be valid JSON. Schema check: requires user_query (string) and at least one of retrieved_docs, tool_outputs, or session_summary. Reject if payload exceeds the orchestration layer's maximum context size limit. |
Implementation Harness Notes
How to wire the handoff record prompt into an orchestration layer with validation, retries, and audit logging.
This prompt is not a standalone chat interaction; it is a structured function call inside an agent orchestration framework. The orchestrator invokes this prompt immediately before transferring control from one agent to another. The input is a machine-readable state object containing the current task, completed steps, pending actions, unresolved ambiguities, and the target agent's role contract. The output is a validated JSON payload that becomes the handoff context for the next agent. Treat this prompt as a deterministic serialization step: its job is to produce a lossless, schema-compliant record, not to summarize or interpret the state creatively.
Wire the prompt into your orchestration layer as a pre-handoff hook. Before calling the next agent, the orchestrator assembles the [CURRENT_TASK], [COMPLETED_STEPS], [PENDING_ACTIONS], [UNRESOLVED_AMBIGUITIES], and [TARGET_AGENT_ROLE] fields from the current agent's execution trace. These fields should be populated programmatically from the agent's tool call history, reasoning logs, and state store—not manually by a human. Pass the assembled object to the model with a strict JSON output schema and a low temperature setting (0.0–0.2). On response, validate the payload against the expected schema immediately. Check for missing required fields, truncated arrays, and type mismatches. If validation fails, retry once with the validation error message appended to the prompt as a correction hint. If the retry also fails, log the failure, attach the raw state object as a fallback handoff payload, and raise an alert for manual review. Never silently pass a malformed handoff record to the next agent.
For production deployments, implement three additional safeguards. First, log every handoff payload to an append-only audit store with a timestamp, workflow ID, and hash chain reference. This creates the traceability artifact that downstream audit prompts will consume. Second, implement a size budget check: if the serialized handoff payload exceeds your context window allocation for the next agent, truncate the [COMPLETED_STEPS] array by dropping the oldest entries and appending a truncated: true flag with the count of omitted steps. Third, add a human-in-the-loop circuit breaker for high-risk domains. If the [RISK_LEVEL] field is set to high or critical, route the handoff payload to a review queue before the next agent executes. The reviewer confirms that the context transfer is complete and that no safety-critical information was dropped. Model choice matters here: use a model with strong JSON mode and schema adherence (such as GPT-4o or Claude 3.5 Sonnet with structured outputs enabled) rather than a smaller, faster model that may silently drop fields or rephrase values.
Expected Output Contract
Field-level contract for the Multi-Agent Handoff Record. Use this table to validate the generated payload before passing it to the next agent or storing it in the audit log.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
handoff_id | string (UUID v4) | Must match UUID v4 regex. Reject if missing or malformed. | |
timestamp | string (ISO 8601 UTC) | Must parse as valid ISO 8601 datetime in UTC. Reject if timezone is missing or non-UTC. | |
source_agent | string | Must match a registered agent identifier from the [AGENT_REGISTRY]. Reject if unknown. | |
target_agent | string | Must match a registered agent identifier from the [AGENT_REGISTRY]. Reject if equal to source_agent. | |
task_state | object | Must contain 'status' (enum: in_progress, blocked, completed, failed) and 'completed_steps' (array of strings). Reject if status is missing or invalid. | |
pending_actions | array of objects | Each object must have 'action_id' (string), 'description' (string), and 'priority' (enum: low, medium, high, critical). Reject if array is empty when task_state.status is 'in_progress'. | |
unresolved_ambiguities | array of strings | Each string must be non-empty after trimming. Allow empty array only if task_state.status is 'completed'. Reject if null. | |
context_snapshot | object | Must contain 'session_id' (string) and 'user_intent_summary' (string, max 500 chars). Reject if user_intent_summary exceeds 500 characters. | |
confidence_score | number (0.0 to 1.0) | If present, must be a float between 0.0 and 1.0 inclusive. Reject if out of range. Allow null. | |
evidence_references | array of strings (URIs) | If present, each entry must be a valid URI referencing a source artifact. Reject if any entry fails URI parse. Allow empty array. |
Common Failure Modes
Handoff records fail silently when context is dropped, schemas drift, or agents misinterpret partial state. These are the most common failure modes and the concrete guardrails that catch them before they corrupt downstream agents.
Silent Context Truncation
What to watch: The handoff payload exceeds the target agent's context window, causing critical fields like pending actions or unresolved ambiguities to be silently dropped. The receiving agent proceeds with incomplete state and no error signal. Guardrail: Implement a pre-handoff token budget check that validates the serialized payload size against the target model's context limit. If the payload exceeds 80% of budget, trigger a summarization step or escalate to a human before handoff.
Schema Drift Between Agents
What to watch: The producing agent emits a handoff record with field names, types, or structures that differ from what the consuming agent expects. This causes parsing failures, null-filled fields, or misinterpreted values without explicit errors. Guardrail: Validate every handoff payload against a versioned JSON Schema before transmission. Reject non-conforming payloads and log the specific schema violations. Maintain a schema registry with migration paths for version changes.
Missing Task State Fields
What to watch: The handoff record omits required fields such as completed steps, pending actions, or unresolved ambiguities. The receiving agent either re-executes completed work or skips pending actions, producing duplicated effort or incomplete workflows. Guardrail: Enforce a required-field completeness check after handoff generation. Use a checklist validator that confirms presence of all mandatory fields before the payload is sent. If fields are missing, request regeneration with explicit missing-field feedback.
Ambiguity Propagation Across Agents
What to watch: The producing agent passes unresolved ambiguities as vague notes rather than structured uncertainty. The receiving agent treats ambiguous state as confirmed, makes irreversible decisions on weak signals, and amplifies errors downstream. Guardrail: Require the handoff schema to include a dedicated unresolved_ambiguities array with structured entries containing the ambiguous item, competing interpretations, and recommended clarification questions. Receiving agents must check this field before acting on related state.
Stale Context Poisoning
What to watch: The handoff record includes outdated user intent, session context, or intermediate results that have been superseded by newer information. The receiving agent acts on stale data because the handoff lacks a freshness timestamp or invalidation marker. Guardrail: Include a context_timestamp and superseded_by field in every handoff record. Receiving agents must compare timestamps against their own state and discard entries marked as superseded. Log staleness events for audit review.
Handoff Loop and Infinite Escalation
What to watch: Agents hand off to each other in a cycle without making progress, or escalate repeatedly without resolution. This burns compute, delays responses, and can exhaust retry budgets before a human is notified. Guardrail: Embed a handoff_depth counter and agent_chain history in each payload. Reject handoffs that exceed a maximum depth or contain duplicate agent entries in the chain. Force human escalation when the depth limit is reached.
Evaluation Rubric
Use this rubric to test the quality of generated handoff records before integrating them into a production orchestration pipeline. Each criterion targets a specific failure mode common in multi-agent context transfer.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Schema Compliance | Output strictly conforms to the [HANDOFF_SCHEMA] definition; all required fields are present and no extra root keys exist. | Missing required fields, unexpected null values where prohibited, or presence of undefined top-level keys. | Automated JSON Schema validation against the canonical [HANDOFF_SCHEMA] file. |
Task State Integrity | The [CURRENT_STATE] field accurately reflects the final status of the agent's work, matching the [COMPLETED_STEPS] and [PENDING_ACTIONS] lists without contradiction. | Status is marked 'completed' but [PENDING_ACTIONS] is non-empty, or status is 'in_progress' with an empty pending list. | LLM-as-Judge pairwise comparison of the state field against the provided [AGENT_EXECUTION_TRACE]. |
Contextual Grounding | All factual claims in [UNRESOLVED_AMBIGUITIES] and [CONTEXT_NOTES] are directly supported by the provided [SOURCE_MATERIAL] or [AGENT_REASONING_LOG]. | Introduction of external knowledge not present in the source logs, or hallucination of a user preference not stated in the session. | Sentence-level entailment check using a Natural Language Inference model against the [SOURCE_MATERIAL]. |
Silent Data Loss Prevention | All critical variables listed in [CRITICAL_CONTEXT_KEYS] are explicitly present in the [TRANSFERRED_CONTEXT] object, with values matching the source. | A key defined in [CRITICAL_CONTEXT_KEYS] is absent from the output payload or has been truncated to null without explicit justification. | Deterministic key-existence check and value-hash comparison against the pre-handoff state snapshot. |
Ambiguity Flagging | The [UNRESOLVED_AMBIGUITIES] list captures every instance where the agent had low confidence (< [CONFIDENCE_THRESHOLD]) or encountered conflicting instructions. | The agent encountered a tool error or low-confidence score but the [UNRESOLVED_AMBIGUITIES] array is empty. | Trace diff: compare the count of low-confidence markers in the [AGENT_REASONING_LOG] to the count of entries in the output array. |
Token Budget Adherence | The serialized handoff payload does not exceed the [MAX_HANDOFF_TOKENS] limit, and truncation is applied to verbose fields only if necessary. | Payload exceeds the token limit, causing a fatal error in the downstream agent's context window, or critical fields are truncated while verbose logs are kept. | Token counting script using the target model's tokenizer, run as a pre-flight check in the handoff harness. |
Escalation Justification | If [ESCALATION_TRIGGERED] is true, the [ESCALATION_REASON] field contains a specific, policy-aligned justification referencing a rule in [ESCALATION_POLICY]. | Escalation is triggered but the reason is generic ('error occurred'), or escalation is not triggered despite a clear policy violation in the trace. | Keyword and semantic similarity check between the [ESCALATION_REASON] and the specific clause in the [ESCALATION_POLICY] document. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with lighter validation. Focus on getting the handoff schema right before adding strict enforcement. Replace [AGENT_ID] and [TASK_ID] with hardcoded test values. Run 10-15 handoff scenarios and manually inspect the JSON output for missing fields.
Prompt modification
- Remove the
validation_rulesblock from the output schema - Replace [REQUIRED_FIELDS] with a simple comma-separated list
- Add:
If a field is unknown, use null. Do not guess.
Watch for
- Missing schema checks letting incomplete records through
- Overly broad instructions causing agents to fabricate task state
- Handoff payloads that look valid but contain placeholder values from the template

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us