PM-301e · Module 3

Handoff Specification

5 min read

In a multi-step agentic workflow, each step produces output that the next step consumes. The handoff — the interface between steps — must be specified with the same rigor as any other API contract. What context must be passed, in what format, with what completeness guarantees. An unspecified handoff is a silent failure waiting to happen.

# Handoff specification between subtasks

SUBTASK S2: Contract Analysis
Receives from S1 (Document Retrieval):
  - contract_text: string — full text of the contract, UTF-8, no truncation
  - document_id: string — unique identifier for this contract
  - retrieval_timestamp: ISO 8601 timestamp
  - page_count: integer — for validation

Produces for S3 (Risk Scoring):
  - clauses: array of { clause_id, text, section, risk_flag: boolean }
  - high_risk_clause_ids: array of clause_id strings
  - analysis_summary: string — max 500 characters
  - confidence: number 0-1

Completeness guarantee:
  - clauses array must include every clause in the document
  - high_risk_clause_ids must be a subset of clause IDs in clauses array
  - If any required output field cannot be produced, return { error: [description],
    completed_fields: [list of fields that were produced] }

Validation before handoff:
  □ clause count matches document structure
  □ no clause_id is duplicated
  □ all high_risk_clause_ids exist in the clauses array
  □ confidence value is between 0 and 1

Do This

  • Specify the exact format of the handoff output, including field names and types
  • Define completeness guarantees: what must be in the output for the next step to proceed
  • Define partial output format for cases where the step cannot complete fully
  • Include validation checks the producing step must run before passing output

Avoid This

  • "Pass the results to the next step" without specifying what results look like
  • Allow steps to pass context in whatever format they find convenient
  • Leave the partial output case undefined — what happens when step N partially fails
  • Specify the input format for each step without specifying the corresponding output format