Join our Newsletter — 33% off our NHI Course
Home FAQ AI Security How should security teams structure prompts for long-running…
AI Security

How should security teams structure prompts for long-running AI tasks?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated September 14, 2026 Domain: AI Security

Use role, phase, and done criteria in every prompt so the model knows what is in scope and when to stop. That reduces drift, makes results easier to review, and prevents the system from improvising across too many steps when the work should stay bounded.

Design prompts so the work stays bounded across time

Long-running AI tasks are less about writing a clever prompt and more about defining a controllable operating envelope. Security teams should treat the prompt as a task contract, with explicit role, phase, and done criteria so the model knows what authority it has, what stage it is in, and when to stop. That improves reviewability, limits accidental scope creep, and reduces the chance that the system starts inventing intermediate steps just because the task is still open.

Bounded prompts matter most when the task spans multiple iterations, tool calls, or handoffs. A prompt that says who the model is acting as, what phase it is currently in, and what completion looks like gives reviewers something concrete to verify. It also makes it easier to separate planning from execution, which is critical when the output can influence operational or security decisions. For long-running workflows, the prompt should read like a lifecycle control, not a one-shot request.

Teams often discover prompt drift only after the model has already accumulated enough context to wander beyond the original job, which is why the initial structure has to do more than state the objective.

How it works in practice

A useful long-running prompt usually has three stable components: a role statement, a phase marker, and explicit completion criteria. The role statement tells the model what perspective to maintain, such as analyst, reviewer, or summariser. The phase marker tells it whether it is planning, executing, validating, or closing. The completion criteria define the exact state that ends the task, so the model does not keep generating output just because more context exists.

Security teams get better results when they make these elements operational rather than descriptive. For example, the prompt should specify what sources can be used, whether the model may propose actions or only draft them, and what evidence is required before moving to the next phase. That keeps the model inside a known decision boundary and reduces the risk of a long task quietly morphing into an unsupervised workflow.

  • Use a fixed role so the model does not renegotiate its purpose mid-task.
  • Declare the current phase explicitly, especially when the task has planning and execution steps.
  • Define done criteria in observable terms, such as a completed checklist, validated draft, or specific output format.
  • Constrain allowed tools, inputs, and escalation points so the model cannot broaden scope on its own.

The strongest prompts also include reset points. If the task needs multiple turns, each turn should restate the phase and completion condition rather than assuming continuity will remain safe. This becomes especially important when the model is asked to synthesize across many documents or operate over extended sessions, because accumulated context can hide earlier assumptions. For teams working on security reviews, incident support, or policy drafting, that structure makes it easier to audit what the model was supposed to do versus what it actually produced. These controls tend to break down when the prompt leaves completion ambiguous, because the model keeps optimising for continuation instead of closure.

Common variations and edge cases

Tighter prompt structure often increases setup overhead, so teams have to balance control against speed. That tradeoff becomes visible when the task is simple enough that a rigid phase model adds friction, but still long enough that unbounded generation would create review risk. Current guidance suggests using the full role-phase-done pattern for anything that can span multiple steps, while keeping shorter prompts for narrowly scoped one-off requests.

Edge cases usually appear when the task has uncertain finish lines or mixed objectives. In those situations, one prompt may need separate done criteria for draft quality, evidence quality, and approval state, because a single completion signal can be misleading. Teams should also be careful not to overload the role statement with too many responsibilities, since that often causes the model to blend analysis, summarisation, and recommendation into one undifferentiated output.

Another common issue is prompt inheritance across sessions. If a long task is resumed later, the safest approach is to restate the phase and completion rules rather than relying on memory of the earlier exchange. That is especially important when the model is being used for security-sensitive work, where drift in one step can affect every later step. A prompt that is too open-ended will usually look productive right up until review time, which is when the lack of boundaries becomes obvious.

Risk and Threat Considerations

Unbounded prompts create operational risk because long-running tasks can drift, accumulate assumptions, and produce outputs that exceed the intended scope. In security contexts, that can lead to inconsistent review quality, accidental overreach, or decisions being made on text that was never meant to be final.

Failure mechanism: When the prompt does not define role, phase, and done criteria, the model may continue generating, reinterpret its objective, or blend planning with execution. That makes it harder for reviewers to know whether the output is a draft, a recommendation, or an action-ready result, and it increases the chance that tool-using workflows take unauthorised or unnecessary steps.

Impact: The result is higher review burden, weaker auditability, and a greater chance of operational mistakes propagating across a long task. In the worst case, a prompt that never closes cleanly can widen the model’s effective authority beyond what the team intended.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Agentic AI Top 10 address the attack surface, NIST AI RMF set the technical controls, and ISO/IEC 42001:2023 define the regulatory obligations.

FrameworkControl / ReferenceRelevance
OWASP Agentic AI Top 10A2 — Task Boundaries and Goal SpecificationDefines bounded task scope for agentic or long-running model work.
A4 — Tool Use and Action AuthorizationConstrains what the model may do during extended execution.
Recommendation — Specify task boundaries, phases, and stop conditions for every long-running prompt. Restrict tool access and action authority to the minimum needed for the task.
NIST AI RMFGOV-1 — Govern, Map, and Measure AI RisksSupports governance of AI task design and operational control boundaries.
MAP-2 — Context and Intended Use MappingRequires defining intended use and operational context before deployment.
Recommendation — Document prompt boundaries and review criteria as part of AI risk governance. Map each long-running prompt to its intended use, context, and limits before use.
ISO/IEC 42001:2023A.6.2 — AI system requirements and designCovers designing AI system behaviour with controlled requirements.
Recommendation — Define structured prompt requirements and acceptance criteria in the AI design process.

Practitioner Guidance

What to prioritise: Define the stop condition first. If a prompt cannot say exactly when the task is complete, it is usually too loose for long-running security work.

What to verify: Check that the prompt separates planning from execution and that the output format makes it obvious whether the model is still in progress or has finished. If reviewers cannot tell that from the text alone, the prompt is understructured.

Decision rule: If the task may span multiple turns or tool actions, require role, phase, and done criteria in every iteration. If it is a one-pass request with no downstream action, a lighter prompt is acceptable.

Practitioner takeaway: The goal is not to make the model “think harder”, it is to make its work easier to bound, easier to audit, and easier to stop before it wanders into unsupported steps.

Deepen Your Knowledge

Sign up to our weekly newsletter — get 33% off our NHI Foundation Level Course

    NHIMG Editorial Note
    Reviewed and updated by the NHIMG editorial team on September 14, 2026.
    NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org