Skip to content
AI Engineer Guide.
midReportedcurated

Take-home: implement a minimal workflow engine with graph nodes, state, branching, looping and a 50-step cap. What does a strong submission contain?

30-second answer

Likely follow-ups

Open a question to rehearse the answer.

How do you stop an infinite cycle deterministically?
  • Track a repeat keyed by edge identity and the normalised state or state version, and refuse it only when the state is unchanged, so a loop that legitimately changes state still runs.
  • Keep the step cap as the outer bound and return a distinct budget-exhausted error, so a cycle produces a diagnosable failure instead of a silent stop.
  • Test it with a graph that revisits the same edge and assert both the guard and the cap fire at the right point.
What would you need to add to make a run resumable after a crash?
  • Checkpoint at consistent boundaries with a schema version, a run id and a step index, written atomically with the record of committed side effects.
  • Make side effects idempotent or keyed, because a resume after a partial step must not repeat a charge or an email.
  • Validate external preconditions and the schema on resume, and keep a migration test that loads a fixture from the previous version, since a checkpoint outlives the code that wrote it.

Red flags

  • Relies on a recursion limit as the only loop guard
  • No tests, or tests that only cover the happy path

Concepts this tests

Tags

Source: github.com

More in Take-homes & career