Inferensys

Prompt

Session Handoff State Summary Prompt Template

A practical prompt playbook for generating a complete handoff package when one agent transfers its session understanding to another agent or a human operator.
Engineer reviewing agent handoff workflow on laptop, task routing diagrams visible, technical office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, reader, and constraints for the Session Handoff State Summary prompt.

This prompt is designed for a single, critical job: transferring a complete and accurate mental model of an agent's session from one agent to another, or from an agent to a human operator. The ideal user is an AI application developer or platform engineer building a multi-agent system, a human-in-the-loop workflow, or any long-running process where an agent's context cannot be directly shared. The required context is the full, raw execution trace of the handing-off agent, including its original goal, completed actions, tool call results, current state variables, and any unresolved items. Without this raw trace, the prompt will produce a hollow summary that omits critical failure modes and assumptions.

You should use this prompt when an agent is being decommissioned, a task is being escalated, or a specialized agent is handing work back to an orchestrator. It is not a general-purpose conversation summarizer. Do not use it for simple chat history compression or for generating user-facing progress updates. The prompt's value is in its structured, machine-readable output and its explicit completeness checks for the receiving agent. It forces the handing-off agent to declare what it doesn't know, what it assumes, and what it has not yet verified, which prevents the receiving agent from confidently repeating work or ignoring a silent failure.

Before implementing this prompt, ensure your system can capture the raw agent trace in a structured format. The prompt's effectiveness is directly tied to the quality of its input. A handoff summary built from incomplete logs will produce a false sense of security. After generating the handoff package, the receiving agent should run a validation step to confirm it can parse all fields, understands the open items, and can identify any missing information before taking action. The next step is to pair this prompt with a 'State Integrity Validation' check on the receiving side to catch corruption during the transfer.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Session Handoff State Summary prompt works and where it introduces risk. Use these cards to decide whether this prompt fits your workflow before wiring it into a multi-agent or human-handoff system.

01

Good Fit: Multi-Agent Handoffs

Use when: one agent completes a subtask and another agent must continue without replaying the full execution trace. The handoff summary provides a dense, structured state transfer. Guardrail: validate that the receiving agent can parse the summary schema and detect missing required fields before acting.

02

Good Fit: Human Escalation with Full Context

Use when: an agent hits a blocker and must hand off to a human operator who needs the current goal, completed work, open items, and risk flags in one structured package. Guardrail: include a confidence score per field so the human knows what is verified versus inferred.

03

Bad Fit: Real-Time Streaming Workflows

Avoid when: the system requires sub-second handoffs or the state changes faster than a summary can be generated. The prompt adds latency that breaks real-time contracts. Guardrail: use a lightweight state diff or event log instead; reserve full summaries for discrete handoff points.

04

Required Inputs

Must provide: the current goal, a list of completed subtasks with outcomes, open items with status, explicit assumptions made during execution, and any risk flags or unresolved blockers. Guardrail: if any required input is missing, the prompt should refuse to generate a summary rather than fabricate placeholder values.

05

Operational Risk: Stale or Incomplete State

What to watch: the generating agent may have an outdated or partial view of the world, producing a confident but wrong handoff summary. Guardrail: require the generating agent to timestamp each state element and mark fields that were not recently verified. The receiving agent should cross-check critical claims against fresh observations.

06

Operational Risk: Schema Drift Between Agents

What to watch: the generating agent uses a different state schema version than the receiving agent expects, causing silent field loss or misinterpretation. Guardrail: include a schema version marker in every handoff summary. The receiving agent must validate the version and reject or adapt mismatched summaries before processing.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt for generating a structured handoff package when transferring an agent session to another agent or human operator.

This prompt template produces a dense, machine-readable handoff summary designed for multi-agent systems, shift changes, and human escalation workflows. The output captures the current goal, completed work, open items, assumptions, risk flags, and a completeness declaration so the receiving agent can resume without replaying the full session history. Use this when one agent must transfer context to another and the receiving agent needs enough structured state to begin work immediately, not just a prose summary.

text
You are generating a session handoff state summary for transfer to another agent or human operator. The receiving agent will use this summary as its sole context to resume work. Produce a structured handoff package that is complete, honest about uncertainty, and immediately actionable.

## INPUTS
- Current Goal: [CURRENT_GOAL]
- Completed Subtasks: [COMPLETED_SUBTASKS]
- In-Progress Subtasks: [IN_PROGRESS_SUBTASKS]
- Pending Subtasks: [PENDING_SUBTASKS]
- Recent Actions and Observations: [RECENT_ACTIONS_AND_OBSERVATIONS]
- Active Assumptions: [ACTIVE_ASSUMPTIONS]
- Known Blockers or Risks: [KNOWN_BLOCKERS_OR_RISKS]
- Tool Availability: [TOOL_AVAILABILITY]
- Session Metadata: [SESSION_METADATA]

## OUTPUT SCHEMA
Return a JSON object with these fields:
{
  "handoff_version": "1.0",
  "session_id": "string",
  "timestamp": "ISO 8601",
  "current_goal": {
    "description": "string",
    "success_criteria": ["string"],
    "priority": "critical | high | medium | low"
  },
  "completed_work": [
    {
      "subtask_id": "string",
      "description": "string",
      "outcome": "success | partial | failed",
      "evidence": "string or null",
      "completed_at": "ISO 8601 or null"
    }
  ],
  "in_progress_work": [
    {
      "subtask_id": "string",
      "description": "string",
      "current_state": "string",
      "next_action": "string",
      "blocker": "string or null"
    }
  ],
  "pending_work": [
    {
      "subtask_id": "string",
      "description": "string",
      "prerequisites": ["string"],
      "estimated_effort": "string or null"
    }
  ],
  "active_assumptions": [
    {
      "assumption": "string",
      "confidence": "high | medium | low",
      "validation_needed": true | false,
      "impact_if_wrong": "string"
    }
  ],
  "risk_flags": [
    {
      "risk": "string",
      "severity": "critical | high | medium | low",
      "affected_subtasks": ["string"],
      "mitigation_suggestion": "string or null"
    }
  ],
  "tool_state": {
    "available_tools": ["string"],
    "unavailable_tools": ["string"],
    "tool_failures": ["string or null"]
  },
  "completeness_declaration": {
    "missing_information": ["string"],
    "stale_state_fields": ["string"],
    "receiving_agent_should_verify": ["string"],
    "ready_for_handoff": true | false
  },
  "handoff_notes": "string"
}

## CONSTRAINTS
- Do not omit fields. Use null or empty arrays when no data exists.
- For every assumption, state your confidence level honestly. Do not mark low-confidence assumptions as high.
- Flag any state that may be stale due to time elapsed since last observation.
- If ready_for_handoff is false, explain why in handoff_notes and list what must happen before handoff.
- Do not invent completed work. Only report what the evidence supports.
- If tool failures occurred, document them in tool_state.tool_failures.
- Prioritize risks that could cause the receiving agent to take incorrect actions.

Adapt this template by replacing each square-bracket placeholder with data from your agent runtime. The [COMPLETED_SUBTASKS], [IN_PROGRESS_SUBTASKS], and [PENDING_SUBTASKS] fields should be populated from your task tracker or execution log. The [ACTIVE_ASSUMPTIONS] field is critical for handoff quality: if your agent runtime does not track assumptions explicitly, extract them from recent reasoning traces or require the agent to declare them before handoff. For high-risk domains, add a human review step before the receiving agent acts on the handoff summary. Validate the output against the JSON schema before passing it to the next agent, and log the handoff payload for auditability.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Session Handoff State Summary prompt. Each placeholder must be populated before the prompt is assembled. Missing or invalid inputs cause incomplete handoffs that force the receiving agent to re-discover state through expensive re-execution.

PlaceholderPurposeExampleValidation Notes

[CURRENT_GOAL]

The primary objective the agent was pursuing when the handoff was triggered

Resolve customer onboarding ticket #4521 by verifying account provisioning status and confirming welcome email delivery

Must be a single declarative sentence. Reject if empty, multi-goal, or contains unresolved pronouns without antecedent

[COMPLETED_WORK]

Structured list of finished subtasks with outcomes and evidence links

  1. Verified account created (status: active, ref: acct-8892)
  2. Confirmed provisioning job succeeded (ref: job-441, timestamp: 2025-01-15T14:22Z)

Each entry must include outcome and at least one evidence reference. Reject if entries lack outcome status or contain vague language like 'handled' or 'done'

[OPEN_ITEMS]

Subtasks that are in-progress, blocked, or not yet started with current status and blockers

  1. Welcome email delivery check (status: in-progress, last action: queried SendGrid API, awaiting response)
  2. User confirmation of receipt (status: not-started, blocked by: welcome email check)

Each item must have a status enum value: in-progress, blocked, not-started, or awaiting-input. Reject if status is missing or uses non-standard labels

[ASSUMPTIONS]

Explicit assumptions the agent made during execution that the receiving agent must validate or accept

  1. Assumed SendGrid API key is still valid (last verified: 2025-01-14)
  2. Assumed account provisioning is synchronous (observed latency <2s in prior runs)

Each assumption must be stated as a falsifiable claim. Reject if assumptions are implicit, unstated, or use hedging language without a clear proposition

[RISK_FLAGS]

Known risks, edge cases, or failure modes the receiving agent should monitor

  1. SendGrid rate limit may trigger if >100 checks in 5min window
  2. Provisioning job has failed silently twice this week (see incident #INC-334)

Each risk must include a specific condition or trigger. Reject if risks are generic ('might fail') without observable conditions or if severity is unstated

[STATE_SNAPSHOT]

Serialized agent state at handoff time including active tool calls, pending responses, and context pointers

{"active_tool_calls": ["sendgrid_check_delivery: call-889"], "pending_responses": 1, "last_checkpoint": "ckpt-2025-01-15T14:30Z", "session_id": "sess-7721"}

Must be valid JSON with required fields: active_tool_calls, pending_responses, last_checkpoint, session_id. Reject if not parseable or missing required fields

[CONFIDENCE_SCORES]

Per-field confidence annotations for state elements that are inferred rather than confirmed

{"account_created": 0.99, "provisioning_complete": 0.95, "welcome_email_delivered": 0.30, "user_satisfied": null}

Must be valid JSON mapping state fields to 0.0-1.0 or null. Reject if scores exceed 1.0, are negative, or use non-numeric values. Fields with null confidence must be explicitly marked as unassessed

[HANDOFF_REASON]

Why the handoff is occurring now, including trigger condition and urgency

Context window at 85% capacity with 3 pending tool calls. Handoff triggered by context-budget policy before next reasoning step.

Must specify trigger condition and urgency level: routine, elevated, or critical. Reject if reason is missing, ambiguous, or doesn't explain why now versus earlier or later

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the session handoff prompt into a multi-agent runtime or human escalation workflow with validation, retries, and audit logging.

The session handoff prompt is not a standalone utility; it is a critical state-transfer mechanism in multi-agent systems and human-in-the-loop workflows. When one agent exhausts its scope, hits a tool boundary, or escalates to a human operator, the handoff summary becomes the receiving party's sole context. A missing or corrupted handoff forces the receiver to re-derive state from raw logs, wasting tokens and time. The implementation harness must therefore treat this prompt as a transactional boundary: the sending agent must not terminate or release resources until the handoff payload is validated and acknowledged.

Wire this prompt into your agent runtime as a pre-handoff hook. Before transferring control, the sending agent invokes the prompt with its current state object, action log, and unresolved items. The output must be validated against a strict schema—reject any handoff that omits required fields such as current_goal, completed_items, open_items, assumptions, or risk_flags. Implement a retry loop with a maximum of three attempts, using a repair prompt that feeds validation errors back to the model. If validation continues to fail, escalate the raw state to a human operator rather than forwarding a partial handoff. Log every handoff attempt, including the raw prompt, the validated output, and any repair iterations, to an append-only audit store. This log is essential for debugging agent loops, stale-state propagation, and handoff-induced failures.

Model choice matters here. Use a model with strong instruction-following and structured output support—GPT-4o, Claude 3.5 Sonnet, or Gemini 1.5 Pro are appropriate. Avoid smaller or older models that may drop fields or hallucinate completion status. Set temperature to 0 or near-zero to maximize determinism. If your system uses tool-augmented agents, ensure the handoff prompt has access to the full tool-call history and any tool outputs, not just the agent's internal summary. For human handoffs, render the structured output into a readable format but preserve the machine-readable version as the authoritative record. Never allow a receiving agent to act on a handoff that failed schema validation or completeness checks—this is the most common failure mode in production handoff pipelines.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, types, and validation rules for the session handoff state summary. Use this contract to parse, validate, and route the handoff package before the receiving agent acts on it.

Field or ElementType or FormatRequiredValidation Rule

session_id

string (UUID v4)

Must match regex ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$. Reject on mismatch.

handoff_timestamp

string (ISO 8601 UTC)

Must parse as valid datetime. Must be within ±5 minutes of server receipt time. Stale timestamps trigger re-request.

current_goal

string (1-500 chars)

Must be non-empty after trimming. Length check: 1-500 chars. If truncated, append '[TRUNCATED]' marker.

completed_items

array of objects

Each object must contain 'task_id' (string), 'description' (string), 'completed_at' (ISO 8601). Array length 0-n. Null not allowed; use empty array.

in_progress_items

array of objects

Each object must contain 'task_id' (string), 'description' (string), 'started_at' (ISO 8601), 'percent_complete' (integer 0-100). Array length 0-n. Null not allowed.

open_items

array of objects

Each object must contain 'task_id' (string), 'description' (string), 'priority' (enum: 'high','medium','low'), 'blocker_flag' (boolean). Array length 0-n. Null not allowed.

assumptions

array of strings

Each string 1-300 chars. If empty, receiving agent must request clarification before acting on unstated assumptions. Null not allowed.

risk_flags

array of objects

Each object must contain 'risk_type' (enum: 'data_loss','state_corruption','security','compliance','operational'), 'severity' (enum: 'low','medium','high','critical'), 'description' (string 1-500 chars). Null not allowed.

PRACTICAL GUARDRAILS

Common Failure Modes

Session handoff summaries fail in predictable ways. These are the most common failure modes observed in production agent systems, along with practical mitigations to prevent context loss, dropped tasks, and misaligned handoffs.

01

Silent Omission of Open Items

What to watch: The handoff summary lists completed work but drops one or more unresolved subtasks, open questions, or pending approvals. The receiving agent assumes nothing is outstanding and proceeds without addressing the gap. Guardrail: Require the prompt to explicitly enumerate both completed and pending items in separate sections. Validate handoff completeness by diffing against the task plan's expected subtask list before transfer.

02

Overconfident Assumption Encoding

What to watch: The summary states inferred conclusions as established facts without marking uncertainty. The receiving agent treats low-confidence assumptions as ground truth and makes irreversible decisions on weak evidence. Guardrail: Require an explicit assumptions field with per-item confidence scores and evidence provenance. Add a validation step that flags any unannotated declarative statements for review before handoff.

03

Context Window Truncation Corruption

What to watch: When the originating agent is near its context limit, the handoff summary is generated from a truncated view of the session. Critical early context—goal refinements, constraint changes, user corrections—is missing from the summary. Guardrail: Generate handoff summaries at deliberate checkpoints before the context window is full. Store intermediate state snapshots externally and include a context_completeness flag indicating whether the full session was available during generation.

04

Risk Flag Dilution

What to watch: The summary mentions risks in passing or buries them in prose without severity classification. The receiving agent skims the summary and misses a high-severity blocker that requires human escalation. Guardrail: Require a structured risk_flags array with severity, affected subtask, and recommended action for each entry. Validate that every risk in the originating agent's internal state appears in the handoff with a non-null severity rating.

05

Stale State Propagation

What to watch: The handoff summary reflects the agent's state at the start of its final turn, but external state changed during that turn. The receiving agent operates on outdated information about tool outputs, resource status, or user inputs. Guardrail: Include a state_freshness_timestamp and require the originating agent to re-verify mutable external state immediately before generating the handoff. Add a staleness check on the receiving side that compares the timestamp against known update intervals.

06

Handoff Schema Drift Between Agents

What to watch: The originating agent produces a handoff in a schema that the receiving agent cannot parse correctly—field renames, missing required keys, or nested structure changes. The receiving agent silently drops unrecognized fields or misinterprets the payload. Guardrail: Define a versioned handoff schema contract shared across agents. Validate the handoff payload against the expected schema version on receipt and reject or flag schema mismatches before the receiving agent acts on the data.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the quality of a generated session handoff state summary before shipping it to a receiving agent or human. Each criterion targets a known failure mode in handoff prompts.

CriterionPass StandardFailure SignalTest Method

Goal Fidelity

The [CURRENT_GOAL] in the output matches the original objective and any subsequent goal refinements from the session.

The goal is rephrased in a way that changes scope, drops a constraint, or adds an unauthorized sub-goal.

Diff the output goal against the source goal and any mid-session [GOAL_REFINEMENTS]. Flag semantic drift.

Completed Work Completeness

Every task marked as complete in the [ACTION_LOG] appears in the output's completed list with its outcome.

A completed task is missing from the summary, or its outcome is misrepresented as in-progress or failed.

Parse the [ACTION_LOG] for tasks with a terminal status. Assert set equality with the output's completed list.

Open Item Accuracy

All tasks with a non-terminal status in the [ACTION_LOG] appear in the output's open items with the correct blocker or pending reason.

An open item is omitted, or its blocker is hallucinated rather than sourced from the log.

Cross-reference open items against the [ACTION_LOG]. For each, verify the blocker field matches the last recorded error or wait condition.

Assumption Grounding

Every assumption in the output's assumption list is traceable to an explicit inference step or an uncertain observation in the [ACTION_LOG].

An assumption is stated as fact, or a new assumption appears that has no basis in the session evidence.

For each assumption, require a source pointer to a log entry. Flag any assumption without a valid source as a hallucination.

Risk Flag Completeness

All risk flags from the [ACTION_LOG] and any new risks inferred from incomplete or failed steps are present in the output.

A known risk from a failed tool call is missing, or a low-severity risk is escalated without evidence.

Union the explicit risk flags from the log with risks derived from non-terminal tasks. Assert the output covers the union.

State Integrity

The output contains no internal contradictions (e.g., a task listed as both complete and open).

The same task ID appears in two conflicting sections, or a summary claim contradicts a specific field value.

Parse the output into structured fields. Run a consistency check: no duplicate task IDs, no contradictory status assignments.

Handoff Readiness

The output includes all required sections: goal, completed, open, assumptions, risks, and a completeness score above the [CONFIDENCE_THRESHOLD].

A required section is empty or missing, or the completeness score is below the threshold without an escalation flag.

Validate the output against the [OUTPUT_SCHEMA]. Assert all required sections are non-empty and the completeness score meets the threshold.

Conciseness vs. Completeness

The summary is dense and actionable, with no conversational filler, repeated information, or irrelevant log details.

The summary copies raw log entries verbatim, includes debugging noise, or exceeds the [MAX_SUMMARY_LENGTH] token budget.

Token-count the output. Assert it is under [MAX_SUMMARY_LENGTH]. Run a heuristic for repeated n-grams or conversational phrases.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base template and a single handoff scenario. Use a lightweight JSON schema without strict enum validation. Run the prompt against 5-10 recorded agent sessions and manually inspect whether the receiving agent can resume work without re-asking questions the first agent already resolved.

code
[SYSTEM]
You are an agent preparing a handoff summary.

[CONTEXT]
Current goal: [GOAL]
Completed steps: [COMPLETED_LIST]
Open items: [OPEN_LIST]
Assumptions: [ASSUMPTIONS]
Risk flags: [RISK_FLAGS]

[OUTPUT_SCHEMA]
{
  "goal": "string",
  "completed": [{"step": "string", "evidence": "string"}],
  "open": [{"item": "string", "blocker": "string | null"}],
  "assumptions": ["string"],
  "risks": [{"flag": "string", "severity": "low|medium|high"}]
}

Watch for

  • Missing evidence links on completed items causing the receiving agent to re-verify work
  • Open items listed without blocker context, making prioritization impossible
  • Assumptions stated as facts without uncertainty markers
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.