Relay / fictional worked example
Sample bounded agent work order: intake replay behaviour
On this page
An example task that can be handed to an agent. It is intentionally narrower than “implement request management”.
Objective
Implement the RequestStore.create_if_absent contract and its tests so re-delivery of a previously seen external event cannot create a second request or silently overwrite conflicting data.
Authoritative context (read first)
../design/02-contracts.md, especiallycreate_if_absent.../design/03-decision-record.md: separation of mechanics and workflows.../../04-executable-example/contracts/request.schema.json: canonical request shape.
In scope
04-executable-example/relay/models.py04-executable-example/relay/store.py04-executable-example/tests/test_intake.py(store-related tests)
Out of scope
- Product/UI policy, assignment workflow, notifications.
- Changing the contract or schema without an explicit decision.
- Adding a database, new framework, external packages or generic service infrastructure.
- Introducing fuzzy or semantic duplicate detection.
Expected outcomes
- New key creates a request with a stable ID and
version=1. - Exact replay returns the existing request unchanged,
created=False. - Same key with different canonical payload raises
DuplicatePayloadConflictwith no mutation. - Invalid required fields raise
ValidationErrorwithout side effects. - Tests exercise both positive and negative cases.
Stop conditions
Stop and report, rather than work around, if:
- The contract and schema cannot both be met.
- A required library capability appears absent or contradictory to supplied documentation.
- The implementation requires edits outside permitted scope.
- Two substantial repair attempts produce no new diagnostic evidence.
- The local execution budget agreed for this task is reached.
Completion evidence
Return:
- list of modified files;
- concise explanation of key contract behaviour;
- exact test command and output;
- any deviations or open questions;
- explicit declaration if the requested contract could not be implemented.
Do not state “tests passed” unless tests were actually run. Do not convert a stop condition into implicit permission to change architecture.