Module 05 Activity
Scenario
Your graph is about to do something outside itself. Everything in this module exists because retries and outward actions do not mix by default.
What you build
A tool layer where every action is idempotent, validated, safe to fail, and logged with enough to reconstruct what happened.
Steps
- Take one action your workflow performs on an external system. Give it an idempotency key derived from the run id and step name, and prove a triple call acts once.
- Write a validator for its arguments with shape checks and at least one policy ceiling. Say where the ceiling came from.
- Convert every tool to the same result envelope - ok, error, value - and reduce your graph to one error branch.
- Log attempt number, outcome and the external system's id for each call, after it returns.
- Split one node into its pure and impure halves, guard the impure half with a state flag, and run it three times.
Evidence to hand in
- The idempotency key construction and evidence that three calls act once.
- The validator, with the policy ceiling and its justification.
- The result envelope and the single error branch.
- One complete tool-call log record.
- The pure/impure split with the three-cycle run.
Review checklist
- The key is derived from run and step, not generated per call.
- There is at least one policy check that is not a type check.
- Every tool returns the same envelope shape.
- The log is written after the call returns, and records the attempt number.
- The guard flag is written in the same update as the effect.
