Skip to main content
A great flow lives or dies by the prompts you give its actors. The model is capable; the prompt is what tells it how to be capable at your problem. This page distils Anthropic’s official Prompting best practices for Claude Opus 4.7, Sonnet 4.6, and Haiku 4.5, and translates each technique into how you’d apply it inside CogniAgent — actor system prompts, the Ask AI node, Call AI Agent, and step-builder configurations.
Most of these techniques are additive — you can mix and match. Start with Be clear and direct, Use examples, and Add context, and reach for the more specialized ones (XML structure, role, prefill replacements, thinking guidance) when the basics don’t fully solve your problem.

The golden rule

Show your prompt to a colleague with minimal context on the task and ask them to follow it. If they’d be confused, the model will be too.
Think of the model as a brilliant new hire who has no idea about your norms, customer base, edge cases, or internal jargon. The more precisely you explain what you want, the better the result.

Foundations

1. Be clear and direct

State exactly what you want. If you want “above and beyond” behavior, ask for it. If the order of steps matters, number them. Less effective:
More effective:
This applies to actor system prompts, Ask AI node prompts, and the Task field in step-builder definitions.

2. Add context to improve performance

Telling the model why a rule matters lets it generalize sensibly to edge cases you didn’t anticipate. Less effective:
More effective:
The second version also covers em-dashes, ASCII art, and other written-only quirks the model will infer are problematic for the same reason.
When you write an actor system prompt, briefly tell the model what channel it lives on (widget, email, Telegram, phone), who the user is (paying customer, internal employee, lead), and what success looks like (booked meeting, ticket created, question answered). Three sentences of context outperform three pages of rules.

3. Use examples (few-shot prompting)

Examples are the most reliable way to steer output format, tone, and structure. A few well-chosen examples often beat a paragraph of instructions. When adding examples to an actor or Ask AI prompt, make them:
  • Relevant — Mirror your real cases, including the awkward ones.
  • Diverse — Cover edge cases. Vary enough that the model doesn’t pick up unintended patterns.
  • Structured — Wrap them in <example> tags so the model can tell them apart from instructions.
Three to five examples is the sweet spot. You can also ask the model itself (“evaluate these examples for diversity”) or have it generate new variants from your initial set.

4. Structure prompts with XML tags

When a prompt mixes instructions, context, examples, and variable inputs, wrap each block in its own XML tag. The model parses these reliably and won’t confuse the example tone for an instruction.
Use consistent tag names across the flow’s actors so the model can pick up patterns. Nest tags when there’s a natural hierarchy (e.g. <documents> containing <document index="n">).

5. Give the actor a role

Setting a role focuses behavior and tone fast. Even one sentence helps.
In CogniAgent, the actor’s Name and Description fields combine with the system prompt to set role. Spend a minute on them — they show up in the conversation UI and in handoff messages between actors, so they’re not just metadata.

6. Long-context prompting

For Ask AI, Call AI Agent, or actors that read long documents (20k+ tokens), structure matters:
  • Put the long content at the top, queries at the bottom. Queries placed after the documents can improve quality by up to 30% in Anthropic’s tests.
  • Wrap each document in <document> tags with <source> and <document_content> subtags.
  • Ask the model to quote first. For long-doc tasks, prompt it to extract relevant quotes into <quotes> tags before reasoning. This cuts through noise.

Output and formatting

Control verbosity

Claude Opus 4.7 calibrates response length to perceived task complexity. If your channel needs a specific shape, tell it. To make outputs shorter:
To make outputs longer / more thorough:

Tell the model what to do, not what not to do

This generalizes everywhere. Positive instructions are followed more reliably than negative ones.

Channel-shaped output

CogniAgent already injects channel-aware steering for some surfaces — phone actors get TTS-friendly guidance; Telegram actors get a MarkdownV2 nudge (Telegram channel). For other channels, lean on the same pattern:

Match the prompt style to the desired output style

If you write the prompt in dense markdown with deeply nested bullets, the output drifts that way. If you want flowing prose out, write the prompt in flowing prose.

Tool use, capabilities, and proactive behavior

CogniAgent actors get capabilities (workflow apps, knowledge bases, hand-off, etc.). The model’s decision to call a capability vs. just talk about it is steerable.

Be explicit when you want action

“Can you suggest some changes?” → the actor suggests. “Make these changes.” → the actor acts. For an actor whose job is to do things on the user’s behalf, set the bar in the system prompt:
For an actor whose job is to advise (compliance, security, financial planning), bias the other way:

Avoid over-aggressive language

Older prompts often used CRITICAL: You MUST always.... With current models, that can cause overtriggering — calling tools or running checks when a simpler answer would do. Normal prompting language (“Use this capability when…”) works better.

Encourage parallel tool calls when independent

For research-style actors that may need to consult multiple sources:

Thinking and reasoning

Claude’s latest models use adaptive thinking — they decide when and how much to deliberate. You don’t typically configure thinking from a flow prompt, but you can nudge it.

Ask for self-verification

For accuracy-critical actors (medical triage, legal research, code review):

Manual chain-of-thought when thinking is off

For lightweight actors running on Haiku 4.5 with no extended thinking:
The flow’s renderer can strip the <reasoning> block, leaving only the answer.

Don’t over-prompt reasoning

A short, general nudge (“think this through carefully”) often beats a prescriptive step-by-step plan. The model’s natural reasoning frequently exceeds what a human would script. Avoid filling the system prompt with a 12-step decision tree unless you genuinely need that exact tree.
When extended thinking is disabled, Claude Opus 4.5 is sensitive to the literal word “think.” If you see weird behavior, swap “think” for “consider,” “evaluate,” or “reason through.”

Agentic patterns

These apply most when you’re using Call AI Agent inside a workflow, or when an actor runs many turns autonomously.

State tracking and incremental progress

For long-running agentic tasks, ask the actor to keep structured state and emphasize incremental progress over heroic one-shot attempts:

Balance autonomy and safety

By default, capable agentic models may take irreversible actions (delete, force-push, send, charge) without confirmation. For agents that touch shared systems:

Reduce overengineering

When a coding-style actor over-elaborates (adds files, abstractions, validators no one asked for):

Minimize hallucinations

For knowledge-base-backed actors that occasionally invent details:

Replacements for response prefilling

Older Claude models supported prefill — putting words into the assistant’s mouth to force a particular start. Claude 4.6+ no longer supports prefill on the last assistant turn. Use these alternatives instead:

Chaining prompts

For complex tasks that span multiple decisions, splitting one big prompt into a chain of smaller prompts is often more reliable than asking one actor to do everything. In CogniAgent, you have two natural chaining patterns:
  1. Multi-actor flows. Hand off between actors at well-defined boundaries. One actor triages, another resolves, a third confirms. Each actor gets a tightly scoped prompt instead of a megasystem-prompt that does it all.
  2. Multi-node workflows. Use Ask AI / Call AI Agent / Resolve Value nodes in sequence: generate a draft → critique it → refine. Each node’s output is structured input to the next.
The most common chain is self-correction: draft → review against criteria → refine. Worth the latency cost for high-stakes outputs (customer-facing emails, generated SQL, anything legally consequential).

A re-usable actor prompt template

Use this as a starting skeleton when you’re configuring a new actor. Fill in the bracketed pieces.

Common pitfalls (and what to do instead)

Iterating on a prompt

Treat prompts as software. The fastest improvement loop:
1

Pick 5–10 real conversations

Include the awkward ones — ambiguity, edge cases, the customer who never finishes a sentence.
2

Run them in test mode

Use Test a flow with the current prompt. Capture outputs.
3

Score each output

Tone, accuracy, format, action taken. Note the worst failure.
4

Change one thing

Add one example, tweak one instruction, clarify one ambiguity. Not five things at once.
5

Re-run and compare

If the worst failure improved without regressing the others, keep the change. If something else got worse, revert and try a different lever.
Save the test conversations in a file (or as a Conversation Flow snapshot) so you can re-run them after any prompt change. Prompts that look better often regress on cases you forgot about.

See also

Configure an actor

Where the system prompt lives in the actor configuration UI.

Capabilities

Give actors workflow apps, KB search, and hand-off tools.

Ask AI node

One-shot prompting inside a workflow.

Anthropic's full guide

The source material this guide is condensed from.