Stop letting the prompt be your state machine
Stop letting the prompt be your state machine You shipped an LLM feature six months ago. Now the same user input produces wildly different outputs depending on... nothing you can point to. Something in the sampling? The time the context filled up and a chunk got dropped? Nobody knows. This is what happens when the prompt becomes your runtime. The trap: the prompt as an accidental runtime Here is what the trap looks like in TypeScript: async function handleUserRequest ( input : string ): Promise < string > { const prompt = ` You are a helpful assistant. The user said: ${ input } Previous context: ${ someGlobalContext } Decide what to do, gather any information you need, format the response, and return it. ` ; return llm . complete ( prompt ); } The model is doing everything here: deciding the intent, gathering data, formatting output, choosing what to persist. That is a footgun. You handed the runtime to a stochastic function. Gartner attributes many failed agentic AI projects to unclear value and inadequate risk controls. Deterministic, testable workflows address both. The fix is not a better prompt. The fix is to stop using the prompt as an architecture. What "deterministic" can and cannot mean here Be honest about what you can and cannot control. You cannot control: the model's exact output. It is probabilistic by design. You can control: The shape of the output (structured output plus schema validation) The steps that run before and after the model call What data enters the model What happens when the output fails validation Whether a human reviews the result before it commits to anything irreversible Determinism here means: the same inputs, the same workflow steps, the same guardrails every time. Not the same tokens every time. That is a realistic and achievable target. It is also the thing teams skip when they are moving fast. Typed workflow steps around the model call Break the work into discrete typed steps. Each step has a clear input type and a clear output