Skip to content

Persona & Prompt Engineering

There are three different prompts to write, and each has its own rules:

  1. The persona of an agent with no workflow (personaPrompt).
  2. The conversational prompt of an llm node whose output the user reads or hears.
  3. The narrow-task prompt of an llm node that classifies a message or extracts one value.

Where each one is used is set out on Configuring an Agent: an agent with a workflow never reads personaPrompt, so its persona belongs in the llm node.

A persona answers four questions and nothing more:

  • Who is the agent? A role and a domain.
  • What tone does it use? Pick one and state it.
  • What is it not for? A scope boundary stops it answering questions it has no data for.
  • What does it do when it does not know? Without an explicit fallback, the model guesses.

Weak:

You are a helpful assistant. Answer questions about our library.

No tone, no boundary, no fallback: it will answer anything, in whatever tone the model drifts to.

Strong:

You are a friendly library assistant. You help people find books, check
room availability and use library services. Be concise. If you do not
know, say so.

Leave out sequencing (“after four questions, wrap up”), branching and tool calls. In a workflow agent that logic belongs to nodes: a condition on the built-in turnCount, a router, a tool. The screening agent recipe shows the split.

In a workflow agent, the persona above goes into the llm node that writes the reply. The node’s rendered promptTemplate, or its systemPrompt when set, is the system prompt; the model receives the conversation so far and the user’s latest message separately, so you do not paste {{conversationHistory}} or {{userMessage}} into the prompt to make them visible. Set one of the two fields, not both: systemPrompt drops promptTemplate.

Text that will be spoken needs short sentences, one question at a time and no lists or markdown. The platform adds these rules for you, so do not repeat them in the prompt:

  • Agent without a workflow: the rules are appended to personaPrompt on every voice, SDK and channel session. They are left out only for a draft test chat in the dashboard and for a session the dashboard starts as text only.
  • Workflow agent: set applyVoiceFormatting: true on the llm node whose output feeds a spoken response node. Never set it on a node that feeds a condition, router or switch.

A node that classifies a message or extracts one value is not a persona. Write it as a pipeline step: terse, mechanical, and explicit that it is not talking to anyone. A narrow node in a conversational context can drift into answering the conversation instead of doing its one job, and this gets more likely with small, fast models.

Tell the model plainly:

  • it is not talking to the end user;
  • it must not write a reply, a confirmation or any commentary, because another node does that;
  • it outputs only the requested value, in the exact format the next node needs.

The full pattern, with a worked prompt, is in LLM nodes: extraction vs. conversation.

Wording reduces drift but cannot rule it out. Where the next node needs a clean value, add a structural guard instead of a longer prompt:

NeedUse
One label from a fixed setmatchAnyOf
A number to pass to a toolextractFirstInteger
Several typed fieldsoutputSchema
No influence from earlier turnsexcludeHistory
You are writingSectionRule of thumb
personaPrompt of an agent without a workflow1Identity, tone, scope, fallback; nothing else
The prompt of an llm node feeding a response the user reads1 and 2The persona, in the node
The same, when the reply is spoken2Add applyVoiceFormatting, not wording
The prompt of an llm node feeding a condition, router or tool3“You are not the assistant”; add a guard field