chart-diagramPrompt Composition in Complex Workflows

The previous chapters focused primarily on single-turn prompts. Many of the most valuable applications of language models in enterprise environments involve multi-turn interactions, chains of prompts, or fully agentic workflows where the model takes a sequence of actions based on intermediate results. This chapter addresses the additional considerations that arise in these more complex contexts.

Multi-Turn Conversation Design

In a multi-turn conversation, each exchange builds on the previous ones. The model's context window accumulates the full conversation history, and the effective system prompt at any given turn includes not just the configured instructions but the entire prior exchange.

This has several implications for prompt design. First, instructions given early in a conversation can be reinforced or overridden by instructions given later. If you establish a format or constraint in the first turn and then implicitly abandon it in a later turn by asking a question in a different register, the model may take that as a signal to relax the original constraint.

Second, long conversation histories can dilute the influence of the system prompt. As the history grows, the ratio of system prompt tokens to total context tokens shrinks, reducing the system prompt's effective weight. Periodically re-anchoring the model to its configured role and constraints, either explicitly ("Continue in the same format as before") or through system-level techniques like repeating key instructions, counteracts this dilution.

Third, multi-turn conversations create opportunities for incremental task construction. Complex outputs can be built across multiple turns by producing and reviewing each component separately before combining them. This is particularly effective for long documents, structured analyses, and outputs that benefit from an intermediate review step.

Prompt Chaining

Prompt chaining is the practice of connecting a sequence of prompts where the output of each step becomes the input to the next. It is the structured implementation of instruction decomposition extended across multiple model calls.

Effective prompt chains share several characteristics. Each step produces a well-defined, inspectable output. The interface between steps is clean: the output format of step N is explicitly designed to serve as the input format of step N+1. Error propagation is managed: failures or low-quality outputs at early steps are caught before they contaminate later ones.

In GLBNXT Workspace and Platform environments, prompt chains can be implemented through n8n workflows, allowing each step to be automated, logged, and conditionally branched based on intermediate outputs. This transforms prompt chaining from a manual practice into a durable, repeatable process.

Agentic Prompting

Agentic prompting refers to the design of prompts that instruct a model to operate autonomously across a sequence of actions, using tools and external resources to accomplish a goal rather than generating a single response. The agent receives a high-level objective and is responsible for decomposing it, selecting appropriate tools, executing actions, interpreting results, and iterating toward the goal.

The system prompt for an agent requires particular care. In addition to the standard layers of role, behaviour, context, format, and constraints, an effective agent system prompt must specify:

  • The tools available to the agent and the conditions under which each should be used

  • The decision criteria for when to proceed autonomously versus when to pause and request human input

  • How to handle ambiguous or incomplete tool results

  • How to recognise when a goal is complete versus when further action is needed

  • Explicit failure modes the agent should recognise and escalate rather than attempt to resolve autonomously

Agentic prompting is the most demanding application of prompt engineering because errors compound across steps and the consequences of a misspecified prompt can cascade through an entire workflow before being detected.

Last updated

Was this helpful?