Agent Instruction Patterns and Antipatterns: How to Build Smarter Agents

7 min read

27th June 2025


Home » Blog » Agent Instruction Patterns and Antipatterns: How to Build Smarter Agents
Home » Blog » Agent Instruction Patterns and Antipatterns: How to Build Smarter Agents

You might design a great agentic conversation, a killer automation, or a clever prompt, but if your instructions are ambiguous, inconsistent, or incomplete, your AI Agent will not be reliable, will hallucinate, or worse, do something wrong confidently. 

Trying to get it to be reliable is time-consuming, frustrating, and painful. And it could even delay your AI Agent’s deployment. So all that effort is wasted.

That’s why at Elements.cloud, we introduced Agent Instruction Diagrams: a structured way to design AI behavior for Salesforce and other platforms. And now, we’re going one step further with built-in Logic Checks that automatically validate your AI Agent instruction design.

Let’s break down what good instructions look like, what to avoid, and how to build AI Agents you can trust.

The 10 Agent Instruction Design Patterns (And Their Antipatterns)

1. Unique, Verifiable Conditions

Pattern: When you instruct an AI Agent to do something, you have to ensure the conditions are unique within the scope of the entire instruction set. In the context of Agent Designer, that means that every flowline into an activity box should represent a distinct, verifiable condition.

Antipattern: Repeating semantically similar lines many times, like “If data is missing, then…” and “If data is incomplete, then….” will confuse your AI Agent. Because the conditions are semantically the same, the AI Agent is told it should perform either of the specified instructions under the same circumstances, meaning it will sometimes choose wrongly.

Example: AI has a tendency to try to complete a task at any cost. If it does not have all the required inputs, it will hallucinate (i.e., make things up). Notice how in the example below, we have two conditions that sound almost exactly the same. AI Agents may get confused from time to time about when to do which action.

Unique and specific.

2. Use Business Meaning, Not Code References

Pattern: Describe what you want done, not how it’s technically implemented. If your AI Agents should use an action to create a case, just tell it to create a case.

Antipattern: Instructing your AI Agent to use and invoke specific Flow, Apex, or Action using its API name or ID. Agents don’t reason by metadata, they reason by meaning. If you want to ensure that your AI Agent chooses the right action at the right time, you need to explain what needs to be done and ensure the instructions semantically match the scope and description of the action available for the topic.

Think like an intern, not a developer.

3. Use The Right Tool For The Job

Pattern: AI Agents use a combination of tools. They can reason on their own, based on Instructions, can invoke deterministic Actions, and apply generative / probabilistic Prompt Templates. Each one of those tools serves a specific purpose, and they are not interchangeable. Therefore, your Agent Instruction Diagrams have a resource on the activity box: “AI Agent” for reasoning, “Action” for system logic, “Prompt Template” for interpretation.

Antipattern: Assigning deterministic tasks (like sending an email or calculating discounts) to the AI Agent instead of a system Action. Or requesting complex interpretation and content generation without using a prompt template. 

Be specific about what to use.

4. Phrase Instructions Affirmatively

Pattern: Tell the Agent what to do, not what not to do. While the guardrails are important to specify what an Agent must never do, you want to have only a few of those. You need to guide an AI Agent to understand what you need done. For instance, instead of saying “Do not send email if…”,  rephrase it into actionable guidance, e.g. “Send email only if…”

Antipattern: A lot of instructions phrased as negative statements will ultimately confuse your AI Agent. 

Say yes, not no.

5. Avoid Contradictory Instructions in One Step

Pattern: Each instruction should be logically consistent. For instance, “If a user submits a support ticket marked “Urgent” and includes the keyword “outage,” then immediately escalate the ticket to Tier 2 support and notify the incident response team via Slack.

Antipattern: Embedding both “if yes, do this” and “if no, do that” inside the same instruction. For instance, “If an invoice is marked as “paid in full”, then send a confirmation email to the user, but also flag the invoice for overdue follow-up.

Split the logic. One thought, one step.

6. Add Examples to Complex Instructions

Pattern: To help guide your AI Agent, and to provide it with semantic understanding of your business and use-cases, enrich your instructions with examples. That way, the AI Agent will be able to more accurately match user interactions to expected behaviours. This is also important if your AI Agent needs to provide or capture unstructured data and then pass it in a structured format to the deterministic action for further processing.

Antipattern: Leaving it up to the AI Agent to interpret and reason every interaction with the user or business language.

This helps humans and the Agent understand intent better.

 7.  Language Consistency

Pattern: Use consistent terminology across your diagram. If your Agent deals with cases, always refer to them as cases, and not ‘issue’, ‘user problem’, ‘ticket’ etc. Semantic consistency makes it easier for an AI Agent to reason properly.

Antipattern: Calling the same object a “case,” “ticket,” and “issue” may be confusing to an AI Agent. The longer the instructions, the longer the conversation, the more the AI Agent will struggle with maintaining logical consistency. 

Pick a term. Stick with it.

8. Separate Business Rules into Actions

Pattern: AI Agents do not replace your Flows or Apex, they use them. LLMs that underpin AI Agents, are usually not great at calculations and maths (or at least, they cannot produce perfect results consistently). Any deterministic rules, calculations, and database operations should be handled by a deterministic action.

Antipattern: Loading Instructions with pseudo-code or deterministic actions. AI Agents are not the most reliable when counting. Logical checks must be done accurately, and should be implemented as designed actions invoked by an AI Agent.

Rules belong in the system, not in the Agent’s decision-making.

9. Split Complex Tasks Into Smaller Steps

Pattern: Keep each instruction focused and simple.

Antipattern: “Look up users, verify subscriptions, apply discounts, send email.” Even if that invokes the same, single action, the way instructions are phrased as multi-step may confuse the AI Agent.

Break it down. Quicker to design, build, test, debug, and deploy.

 10. Include Confidence Thresholds for Probabilistic Logic

Pattern: This is one of the most important rules to solve hallucinations and improve the quality of output. Define how confident an AI Agent should be, given all the instructions, knowledge, and data input, to act or provide a response. And build in handling steps for what the AI Agent should do or what to ask for if the level of confidence is below that threshold. For instance, ‘“…only proceed if at least 90% confident, otherwise ask for clarification”.

Antipattern: Leaving it to the Agent to guess when it’s “sure enough.”

  • Use: “Only proceed if 90%+ confident in intent.”

It’s not micromanagement, it’s clarity.

Introducing Agent Instruction Checks

To help you build better AI Agents faster, Elements.cloud now includes Agent Instruction Checks built into every Agent Instruction Diagram.

These automatic reviews flag common errors, inconsistencies, and structural issues, and give you clear, actionable recommendations.

How It Works

  1. Open your Agent Instruction diagram in draft mode.
  2. Go to the Insights tab, then Agent Check sub-tab.
  3. Click “Review diagram.”
  4. Review real-time suggestions with explanations and one-click fixes.

You can accept, reject, or undo changes as needed. 

Start Designing Smarter Agents for Free

Agent Instructions are the new prompt engineering.

You’re not just writing text, you’re architecting AI behavior. Elements.cloud’s free tier includes the Agent Designer capability that enables you to:

  • Design modular instruction logic
  • Model and validate agent reasoning
  • Catch errors before they become issues
  • Generate best practice AI Agent Instructions and test cases

Agent Designer is free to use. No credit card. No guesswork. Just smarter AI instructions, built right.