Loading

Prompt Fine-Tuning in Agentforce

Fecha de publicación: Mar 27, 2026
Descripción

Effective prompt engineering is crucial for guiding an agent's behavior and controlling its outcomes. It involves meticulously defining the topics, instructions, and actions that drive the Agentforce Atlas Reasoning Engine. The core of an agent's decision-making process lies within the Atlas Reasoning Engine, which uses a series of prompts, code, LLM calls, and the three key building blocks: topics, instructions, and actions. When you adjust these elements, you are effectively prompt engineering the inputs that the reasoning engine uses to understand, decide, and act.

Important:- Please make sure you have reviewed Atlas Reasoniong Engine Workflow

Solución

Topics

 
Defining the Agent's Capabilities Topics are the foundation of your agent’s capabilities, defining what it can do and the types of customer requests it can handle. Think of them as specialized departments with specific expertise, tools (actions), and guidelines (instructions). The agent first determines which "department" (Topic) should handle the request.

  • Components of a Topic: Each topic consists of a Topic Name, a Classification Description, a Scope, and and Instructions.
  • Best Practices for Topic Names
    • Categorize "Jobs to Be Done": Consider how you would categorize the agent's tasks.
    • Use Clear, Descriptive Names: Employ easily recognizable and short (2-3 words maximum) names, often starting with verbs like "Provide," "Change," or "Cancel".
    • Avoid Overlap: Ensure different topic names do not overlap in meaning.
    • Limit Number of Topics: To prevent inconsistency or inaccuracy, limit your agent to 10-15 topics.
    • E.g., Provide order status and details[avoid "Customer Info"], Answer technical questions[avoid "Help"], Help update payment details[avoid "Transactions"]
  • Best Practices for Topic Classification Descriptions:
    • Trigger Phrases: Describe what user messages should trigger this topic, which is critical for the classification step.
    • Comprehensive Coverage: Include the different ways users might ask for this type of help, listing specific keywords and phrases.
    • Natural Language: Write in natural language, avoiding technical terms, and make it distinct from other topics' descriptions.
    • E.g., Assist users with login issues, account creation, and password resets.[avoid "Help with accounts. "]
  • Best Practices for Topic Scope:
    • Define Boundaries: Explicitly state what your agent can and cannot do within this topic.
    • "Your Job Is To...": Frame the scope as if explaining a job to a new employee: "Your job is to... You cannot...".
    • Unambiguous Language: Use clear and unambiguous language to describe both permissions and limitations.
      E.g., "Your job is only to answer questions related to a customer’s order status, return status, or return and repair policy. Never initiate or generate an order or return." Avoid " Handle order questions and issues."

 

Instructions

 

 
Guiding the Agent's Decisions Instructions are the guidelines that direct how conversations are handled within a topic. They are crucial for guiding action selection, setting conversation patterns, and providing business context. Without clear instructions, your agent might select the wrong actions, misunderstand user requests, or provide inconsistent responses.

  • How Instructions Work with the Reasoning Engine: Instructions help the engine decide which actions to run, determine the sequence of steps, format the response, and handle exceptions.
  • Actions vs. Instructions:
    • Actions for Critical Logic: Use Actions for critical business logic that must be consistently enforced, such as complex calculations, sensitive information processing, or multi-step operations. This logic should be coded within the action itself.
    • Instructions for Flow & Context: Use Instructions for guiding conversation flow, helping the agent select appropriate actions based on context, defining response formatting and tone, and establishing clarification strategies. Remember, instructions are interpreted by the LLM and are non-deterministic, meaning their outcomes can vary.
  • Best Practices for Writing Effective Instructions:
    • Define Terms: Clearly define any industry terms/jargon or concepts the agent might encounter.
    • Specify Sequences: If steps should happen in a certain order, state it clearly, ideally in one instruction box.
    • Consistent Terminology: Use the same terms throughout all your instructions and refer to actions by their exact names.
    • Wary of Absolutes: Words like "always" and "never" are taken very literally; use them intentionally.
    • Pair Actions with Situations: Clearly specify which actions to use in which circumstances.
    • Provide Decision Criteria: Help your agent make choices between similar options.
    • Start Simple: Begin with just 1-3 key instructions and add more only as needed after testing.
      E.g.,
            1. For questions about product features, first identify which specific product the customer is asking about. Then use the Knowledge action with the exact product name to retrieve accurate information.[Provides a clear sequence of steps and specifies how to make the action more effective.] 
      - Avoid "Use knowledge for product questions."
            2. “First verify the customer’s identity using the Verify Customer action, then provide account information.”

  • Understanding Non-Deterministic Behavior and the Need for Iterative Prompt Tuning

    Agentforce is powered by Large Language Models (LLMs), which are inherently probabilistic (non-deterministic) rather than strictly rule-based. As a result, even well-defined instructions may not always produce identical outputs across interactions.

    This means the agent may occasionally:

    • Skip intermediate steps defined in instructions
    • Interpret conditions differently
    • Prioritize certain parts of the instruction over others

    This behavior is expected and does not necessarily indicate an issue with the platform.

    Implications for Instruction Design
    When instructions are overly complex, contain multiple conditional paths, or combine several responsibilities into a single block, the likelihood of inconsistent execution increases.

    Best Practices to Improve Consistency

    • Break down complex instructions into smaller, focused steps
    • Clearly separate conditional logic and decision branches
    • Reinforce expected sequences explicitly (e.g., “First…, Then…”)
    • Avoid overloading a single instruction with multiple objectives
    • Use Actions for deterministic or critical logic wherever possible

    Iterative Prompt Tuning is Essential
    Prompt engineering should be treated as an ongoing refinement process rather than a one-time setup. When expected behavior is not consistently observed:

    • Review and simplify instructions
    • Test with varied user inputs
    • Use tools like Plan Tracer to validate reasoning paths
    • Continuously refine based on observed agent behavior

    Consistent agent performance is achieved through incremental improvements and structured prompt optimization over time.

Actions

 
The Agent's Tools for Tasks Actions serve as the tools your agent uses to get information or perform tasks. The reasoning engine reviews available actions based on their names, descriptions, inputs, topic instructions, and conversation context.

  • Components of an Action: Each action has three important parts: Action Name (API Name), Action Instructions, and Action Input Instructions.
  • Best Practices for Action Names (Action API Name):
    • Plain Language: Use plain language that matches how customers would describe the action.
    • Clear Functionality: Ensure the API Name is clear and describes the functionality, as it's sent to the reasoning engine.
    • Varied Verbs: Instead of repeatedly starting similar actions with the same verb (e.g., "Get"), try a variety of related verbs (e.g., "Get," "Find," "Identify," "Retrieve").
  • Best Practices for Action Instructions:
    • Concise Description: Write 1-3 sentences explaining exactly what the action does and when to use it.
    • Comprehensive Details: Specify when the action should be used (types of customer requests), what information it needs, any special conditions or edge cases, and include example customer phrases that should trigger it.
    • Differentiation: The more relevant detail you include, the easier it is for the LLM to differentiate between actions. Remove or revise nonessential phrases repeated across multiple actions.
  • Best Practices for Action Input Instructions:
    • Input Definition: Clearly describe what the input is and its purpose.
    • Format & Validation: Specify the expected format (e.g., length, characters, structure) and include validation criteria. This helps the agent gather information in the right format.
  • Action Limits: To minimize latency and improve performance, do not assign more than 15 actions to a topic. Design actions with reusability in mind, as they can be used across multiple topics.

 

 

General Prompt Engineering Guidelines for Optimal Performance Beyond individual components, overall prompt design impacts agent performance (latency and accuracy).

  • Keep Instructions Concise: Use direct, simple language to make prompts easier for the LLM to interpret.
  • Provide Context: Supply background information to enable informed decisions from the LLM.
  • Avoid Long Few-Shot Examples: Overly long examples increase latency and reduce available context for the LLM.
  • Keep Action Outputs Concise: When actions return data, return only the smallest amount necessary (e.g., just the required fields from an sObject) to improve performance and avoid confusing the LLM.
  • Fewer Instructions the Better: Stick to one or two clear goals per prompt to prevent confusing the model.
  • Iterate and Refine: Prompt engineering is an ongoing process. Experiment and adjust based on observations and feedback to continuously improve reliability and output quality.

Iterative Refinement Process: A Troubleshooting Methodology Prompt fine-tuning is an iterative process. Recommend the following lifecycle for troubleshooting and improvement:

  1. Start Simple: Begin with 2-3 core topics covering high-volume needs, minimal instructions (1-3 key guidelines per topic), and only essential actions.
  2. Test Extensively: Use actual customer questions and varied phrasings. Test the entire conversation flow, not just initial responses.
  3. Utilize the Plan Tracer: This tool is invaluable for debugging. Use it to check topic classification, review action selection, and understand the LLM's reasoning process.
  4. Targeted Improvements: Identify the most critical issues first, fix one problem at a time, and test after each change to verify improvement.
  5. Gradual Expansion: Only add new topics, actions, or instructions incrementally after core functionalities are stable and performing as expected.

By adhering to these best practices, you can fine-tune your Agentforce prompts to create intelligent, accurate, and efficient AI agents that drive customer success.



For Signature and Premier customers, did you know you have access to our Success Guide team? If you'd like personalized guidance to help you further refine your prompt engineering, please go to Request an Expert Coaching Individual Session to get started! 

Número del artículo de conocimiento

005134944

 
Cargando
Salesforce Help | Article