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.Documentation Index
Fetch the complete documentation index at: https://docs.cogniagent.ai/llms.txt
Use this file to discover all available pages before exploring further.
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: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: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.
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.<documents> containing <document index="n">).
5. Give the actor a role
Setting a role focuses behavior and tone fast. Even one sentence helps.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:Tell the model what to do, not what not to do
This generalizes everywhere. Positive instructions are followed more reliably than negative ones.| Instead of | Try |
|---|---|
| ”Do not use markdown" | "Write in flowing prose paragraphs with no bullet points or headings" |
| "Don’t be overly formal" | "Use a warm, conversational tone, like a teammate explaining over coffee" |
| "Avoid hallucinating data" | "Cite the specific knowledge-base article or tool result you used. If you don’t have a source, say so” |
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:Avoid over-aggressive language
Older prompts often usedCRITICAL: 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:<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:| Old prefill use | Modern replacement |
|---|---|
| Force JSON / YAML output | Use Structured Outputs with a schema, or ask for the structure and validate with a downstream Resolve Value node |
Skip "Here is the requested summary:" preamble | Add: Respond directly without preamble. Do not start with phrases like 'Here is...', 'Based on...', etc. |
| Steer around unwanted refusals | Clear prompting in the user/system message — modern Claude refuses appropriately without prefill help |
| Continue a truncated response | Pass the previous response into a new user turn: Your previous response was cut off. Continue from where you stopped: [previous_text] |
| Inject mid-conversation reminders | Inject them as user-turn context or as tool results, not as fake assistant messages |
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:- 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.
- 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.
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)
| Pitfall | Symptom | Fix |
|---|---|---|
| Vague instructions | Inconsistent, drifty answers | Be specific. State the desired format, length, tone, and edge-case handling. |
| All negatives, no positives | Model finds creative ways to break the rule | Replace each “don’t X” with “do Y instead.” |
| Wall-of-text system prompt | Model ignores half of it; high latency | Split by purpose into XML-tagged sections. Cut anything not load-bearing. |
| Examples that all look the same | Model overfits and gives one-note answers | Diversify examples — different lengths, tones, edge cases. |
Over-aggressive CRITICAL: MUST | Tool overtriggering, anxious behavior | Use calm, normal language. The model already takes instructions seriously. |
| Asking for action with “could you maybe” | Model suggests instead of doing | Use imperatives: “Do X.” “Make these changes.” “Send the email.” |
| Telling the model how to think step by step | Reasoning becomes brittle and shallow | Ask for thoroughness in general terms; trust the model’s own planning. |
| Long documents at the end of the prompt | Model misses key details | Put long content first; queries last. |
| No channel hint | Output looks fine in widget, broken on phone | Tell the actor which channel it’s on so it can shape output accordingly. |
Iterating on a prompt
Treat prompts as software. The fastest improvement loop:Pick 5–10 real conversations
Include the awkward ones — ambiguity, edge cases, the customer who never finishes a sentence.
Run them in test mode
Use Test a flow with the current prompt. Capture outputs.
Change one thing
Add one example, tweak one instruction, clarify one ambiguity. Not five things at once.
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.
