---
schema_version: "1"
id: b93d378da9fc5c80a508e280f410189aacad88a2341a0aa880ec4ef700fbba64
title: How Subagent Instructions are Resolved to Build a Prompt
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ai/264-0-0/agent_topics_instructions_resolve.md
canonical_url: https://help.salesforce.com/s/articleView?id=ai.agent_topics_instructions_resolve.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: c44ac2b01ff6ea8f9697befc233c9edefe2d71c8401474938de253db27b135cc
description: Learn about how an agent executes programmatic expressions in a subagent’s reasoning instructions to prepare for reasoning.
products:
  - Agentforce
  - Cross Cloud
release: "264"
---
# How Subagent Instructions are Resolved to Build a Prompt

Learn about how an agent executes programmatic expressions in a subagent’s reasoning instructions to prepare for reasoning.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions. <a href="https://help.salesforce.com/s/articleView?id=ai.agent_setup_explore_types.htm&amp;release=264.0.0&amp;type=5" title="Learn about agent types and default templates for specific clouds and common use cases.">Required add-on licenses vary by agent type.</a></td></tr></tbody></table>

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/images/icon_note.png)

Note Beginning in April 2026, agent topics are now called subagents. There are no changes to functionality. During this transition, you may see a mix of the new and previous terms in our documentation.

Reasoning instructions are the guidelines that tell your agent how to handle conversations in the context of the subagent, your business case, and the conversation in general. They contain a combination of programmatic logic and natural language prompts, where logic reliably handles your agent’s general workflow and business rules and prompts more flexibly guide your agent’s conversational skills. You can think of logic in reasoning instructions as anything the agent must do before reasoning, and natural language prompts as anything the agent should take into account during reasoning.

When an agent moves to a subagent, it begins resolving the subagent’s reasoning instructions from top to bottom, in the order that they’re written. This process can include:

- Replacing references to resources (like variables or actions) with actual values, including manually setting values
- Running any inline actions and inserting the results into the instructions
- Evaluating and applying any conditional statements

At this stage in the subagent’s execution, no reasoning takes place, so the agent doesn’t rely on an LLM yet. Every logical expression in reasoning instructions is run, run exactly as written, and run in the order that it’s written.

If at any point in the reasoning instructions the agent executes a transition to another subagent, the agent redirects the conversation before the instructions are resolved and any reasoning occurs. Otherwise, when the agent reaches the end of the reasoning instructions, it injects the resolved reasoning instructions into a prompt to send to the LLM and kick off the reasoning process. The prompt includes:

- Agent-level instructions, which apply to every agent interaction
- The recent conversation history, including the user’s most recent message
- The resolved subagent reasoning instructions
- [Reasoning actions](https://help.salesforce.com/s/articleView?id=ai.agent_topics.htm&release=264.0.0&type=5 "A subagent is a job an agent can do. Learn about the parts of a subagent and how to use them to define an agent’s logic, reasoning, and conversational capabilities.") associated with the subagent, which are the actions (including agent actions) an agent is allowed to take during its reasoning process

The agent uses the LLM to analyze the available information in the prompt and determine its next steps.

## Example

An agent is chatting with a customer who is expecting a delivery. The customer’s order ID is 1234 and the estimated delivery date is February 10, 2026, which is outside of the expected delivery window.

Based on the customer’s message, the agent selects a subagent that contains the following reasoning instructions.

```
reasoning:
  instructions:->
    If @variables.updated_delivery_date == None
      run @actions.get_delivery_date 
        with order_ID=@variables.order_ID
        set @variables.updated_delivery_date=@outputs.delivery_date

      | Tell the user that the expected delivery date for order number {!@variables.order_ID} is {!@variables.updated_delivery_date}. 

    If @variables.is_late == None
      run @actions.check_if_late
        with order_ID=@variables.order_ID
        with delivery_date=@variables.updated_delivery_date
        set @variables.is_late = @outputs.is_late

    if @variables.is_late == "true":
      | Apologize to the customer for the delay in receiving their order.
```

To construct a prompt, Agentforce resolves the reasoning instructions line by line, following these steps.

1. Run the action `get_delivery_date` to get an expected delivery date.
2. Set the variable `updated_delivery_date` to the value of `outputs.delivery_date`, which was returned by the action. In this case, the value is set to `February 10, 2026`.
3. Add this instruction to the prompt: `Tell the user that the expected delivery date for order number 1234 is February 10, 2026.`
4. Run the `action check_if_late`.
5. Set the `variable is_late` to the value of `outputs.is_late`, which was returned by the action. In this case, the variable is set to `"True"`.
6. Check whether the value of if `@variables.is_late == "True"` to determine whether the order is late.
7. Because the order is late, add this instruction to the prompt: `Apologize to the customer for the delay in receiving their order.`

These are the resolved reasoning instructions that are added to the prompt.

```
Tell the user that the expected delivery date for the order number 1234 is February 10, 2026. 
Apologize to the customer for the delay in receiving their order.
```

The prompt is sent to the LLM to determine the agent’s next steps and generate a response.