Use a single model call when it can handle the task well. Splitting a task into more steps adds coordination and more places for errors to enter.

When several steps are useful, make the handoff explicit. A later model call may continue from incomplete or malformed information unless the application checks it first.

  • Check what the next step needs. Validate required fields and constraints before passing a result onward.
  • Choose the failure path. Decide whether to retry, ask for clarification, or stop. Keep retries bounded.
  • Make failures traceable. Record enough information to understand where the process failed, while avoiding unnecessary sensitive data.

A short workflow may only need ordinary functions and clear checks. Named states become useful when there are branches, retries, or work that must resume later. Use that structure when it makes the process easier to understand.