Validate agent handoff packets and resume readiness using schema, freshness, and replay checks. Use when tasks pause/resume across sessions, agents, or humans — including when a user wants to continue where they left off, hand off to another agent, resume a previous task, or pick up an interrupted workflow. Includes explicit untrusted-content/prompt-injection guardrails for third-party inputs.
96
Quality
100%
Does it follow best practices?
Impact
96%
1.50xAverage score across 9 eval scenarios
A platform engineering team has multiple agent pipelines that need to validate handoff packets before resuming tasks. Currently each pipeline does its own ad-hoc checks, leading to inconsistent behavior — one pipeline accepts stale handoffs that another rejects, and token validation is missing entirely in some flows.
The team wants a reusable Python module that any pipeline can import to perform standardized handoff validation. It needs to be self-contained (no external dependencies beyond the standard library), well-structured, and cover all the checks that the team has agreed on for their handoff protocol.
Produce a Python file named handoff_validator.py that implements the validation logic. The module should be importable and expose a validation function. Also provide a brief README.md documenting how to use the module.
To demonstrate it works, write a short script demo.py that imports and calls your validator against the sample packets below, and prints the results to stdout. Running python demo.py should produce output without errors.
The following files are provided as inputs. Extract them before beginning.
=============== FILE: sample_valid.json =============== { "objective": "Deploy new recommendation engine to EU region", "completed": ["Trained model on EU dataset", "Deployed to staging", "Load tested at 10k req/s"], "unresolved": ["EU data residency sign-off pending from legal"], "assumptions": ["Legal review turnaround is 3 business days"], "next_action": "Await legal sign-off then trigger production deployment pipeline", "risks": ["Model performance degrades beyond 15k req/s — needs autoscaling config"], "updated_at": "2025-12-01T10:00:00Z", "resume_token": "rec-engine-eu-deploy-8xYz3kP1" }
=============== FILE: sample_invalid.json =============== { "objective": "Migrate legacy billing system to new payment processor", "completed": [], "unresolved": [], "assumptions": [], "next_action": "", "risks": [], "updated_at": "2023-06-15T00:00:00Z", "resume_token": "" }