---
schema_version: "1"
id: be4282d4da9efb1844ff08deac5fc59133c906c6c6d707e6d0c713a4eb441da5
title: Building Agents in Canvas View
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ai/264-0-0/agent_canvas.md
canonical_url: https://help.salesforce.com/s/articleView?id=ai.agent_canvas.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: bc6cd6fd64ef84fc6eb8f1d23a6b71596936e7fe9de85fd8217537e93eea87eb
description: Get to know the features of Agentforce Builder’s Canvas view that help you build powerful and reliable agents with Agent Script.
products:
  - Agentforce
  - Cross Cloud
release: "264"
---
# Building Agents in Canvas View

Get to know the features of Agentforce Builder’s Canvas view that help you build powerful and reliable agents with Agent Script.

### 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>

When you open an agent in Agentforce Builder, it opens in Canvas view. You see a visual summary that includes parts of the agent, including its details, router, and subagents. The agent summary is view-only. To edit a subagent or action, go to its page in Canvas or edit it in Script view.

![Agent summary showing the agent's details, route, and subagents](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/agent_summary.png)

Canvas view simplifies agent configuration by summarizing Agent Script into easily understandable blocks. It also provides shortcuts for common tasks.

Whether you use Canvas or Script view to build your agent, your agent’s configuration and any edits you make are consistent across both views.

The console includes a list of errors and warnings that could interfere with your agent’s performance, such as syntax errors or unexpected values. To quickly address a problem, click an error or warning in the console in Canvas or Script view. The builder opens the element or line with the issue in the view you’re currently in. You can commit an agent that has warnings, but not one with errors.

When you save your changes, Agentforce Builder completes validation checks in both views. Errors are underlined in Canvas view, but you can switch to Script view for more details. It’s possible to make changes in Script view that make Canvas view unavailable. To switch back to Canvas view, fix the errors in Script view first.

## Agent Optimizer

Agentforce can help with all aspects of agent building, from answering questions to creating subagents and actions. Just chat with Agent Optimizer in Agentforce Builder. Here are some ways that Optimizer can help.

- Generate Agent Script. Use natural language to explain what you want your agent to be able to do, and Optimizer can generate Agent Script for you based on your request. You can review and accept or decline its changes.
- Evaluate your instructions to improve and refine them. For example, you can ask Optimizer to make your instructions more deterministic or limit access to subagents and actions.
- Test your agent conversationally. Describe the scenarios that you want to validate, and Optimizer simulates representative test conversations. You can ask it to make fixes based on the results.

[Learn more about working with Agent Optimizer in Agentforce Builder.](https://help.salesforce.com/s/articleView?id=ai.agent_optimize_dev.htm&release=264.0.0&type=5 "Focus on what you want your agent to do, not how to configure or fix it. Agent Optimizer is a built-in coding agent that extends, refines, and troubleshoots your agents directly in Agentforce Builder, at no additional cost. Explore use cases and considerations for working with Optimizer.")

## Resources

Resources are explicit references to subagents, actions, and variables. Like resources in flows and prompt templates, resources in reasoning instructions resolve like merge fields. It’s almost always best to use resources to reference subagents, actions, and variables in reasoning instructions to more reliably guide agent behavior. [Learn more about variables.](https://help.salesforce.com/s/articleView?id=ai.agent_builder_variables.htm&release=264.0.0&type=5 "To improve security and ensure consistent agent behavior, use variables throughout your agent’s reasoning and interactions, such as in filters, instructions, and logical expressions.")

In Canvas view, access resources using the @ symbol. You can also create a custom variable that's set to an action output. Next to an action output, click **Select Variable** and then select **Create a variable**.

In this example, in reasoning instructions, explicit references to variables and actions are intermixed with natural language instructions. The `member_name` and `order_summary` variables are used in agent responses to personalize the response and control the format. The `lookup_order` and `create_return` agent actions are used to ensure that the agent runs the correct action based on different possible user requests.

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

## Inline Actions

Inline actions are shortcuts for adding deterministic logic to your agent. When you include an inline action in your instructions, they run before any reasoning takes place. [Learn more about how the agent uses inline actions in subagent instructions.](https://help.salesforce.com/s/articleView?id=ai.agent_topics_instructions_resolve.htm&release=264.0.0&type=5 "Learn about how an agent executes programmatic expressions in a subagent’s reasoning instructions to prepare for reasoning.")

In Canvas view, access inline actions using the / symbol.

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

Conditional Statement

Conditional statements control your agent’s behavior based on the values of one or more variables. You can think of a conditional statement as a fork in the road for your agent. Each branch leads down a different path, and the agent follows the first branch whose criteria are met. Conditional statements can be used in reasoning instructions. They contain at least one variable, one operator, and one value, but they can be more complex. Inside conditional statements, you can reference subagents and actions, run actions, set variables, and transition to other subagents.

To build a conditional statement, start with an If branch and define its criteria. To handle more cases, add one or more Else If branches. Add an optional Else branch to cover any case that the other branches don't. The agent evaluates the branches in the order they appear and follows the first one whose criteria are met.

![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 When you write a conditional statement, the data type of your variable determines the required format for the value.

- Boolean: True, False
- List: \[item 1, item 2, item 3\]
- Number: 60
- Object: {Contact}
- String: “example@salesforce.com”

Use conditional statements to define when an agent applies a particular instruction, runs an action, sets a variable, or transitions to another subagent.

In this example, in reasoning instructions, the agent evaluates the `days_since_order` variable and follows the first branch whose criteria are met. If the value is 30 or less, the resolved prompt instructs the agent to offer to process a return with the `create_return` action. If it's greater than 30 but 60 or less, the agent offers a return with a restocking fee. If it's greater than 60 but 90 or less, the agent offers store credit instead of a refund. Otherwise, the agent explains that the order isn't eligible for a return.

![An if/else condition in reasoning instructions](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/agent_canvas_conditional_instruction.png)

Transition

Transitions give you control over subagent routing by defining when an agent moves to another subagent. 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.

In actions available for reasoning, use utilities to transition or escalate instead of the inline action.

In this example, in the reasoning instructions, the agent evaluates the value of the `loyalty_tier` variable and transfers the conversation directly to a representative via the `Escalation` subagent if the customer is a Platinum VIP member. Otherwise, the agent continues the conversation with the customer.

![A conditional transition to the Escalation subagent](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/agent_canvas_transition.png)

Set a Variable

Set a variable to a value. Setting a variable is useful when you want to store values that you plan to reuse in some way, such as creating a conditional based on the variable, using the variable as an input to an action in a different subagent, or by using the variable in a response to a user. You can also set a variable to clear the value of a variable when you enter a new subagent.

![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 When you set a variable, the data type of your variable determines the required format for the value.

- Boolean: True, False
- List: \[item 1, item 2, item 3\]
- Number: 60
- Object: {Contact}
- String: “example@salesforce.com”

When you run an action in instructions, you must manually set variables for the inputs and outputs because the action is run before any reasoning takes place. The action uses the set variable’s value as input, or stores the output value in the set variable. When you run an action in actions available for reasoning, setting variables is optional, but can be useful when you want to require the agent to use one action’s output as input to another action. Often, your agent can determine the best input for an action. In actions available for reasoning, use the utility for setting a variable instead of the inline action.

In this example, in reasoning instructions, the agent runs the `lookup_current_order` action to fill the `order_summary` variable when the variable is empty. The `order_summary` variable is set to the `order_summary` output, so when the agent runs the action, the value of the `order_summary` output is stored in the `order_summary` variable. In the following instruction, the variable is referenced to include the customer’s order summary in the agent’s initial response.

![An action with outputs stored in variables and an instruction referencing one of the variables](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/agent_canvas_set_variable.png)

Run an Action

Running an action deterministically runs an agent action. In reasoning instructions, run an action to complete a prerequisite task or gather information to give your agent necessary context.

![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 When you run an action in instructions, you must manually set variables for the inputs and outputs because the action is run before any reasoning takes place.

In actions available for reasoning, use follow-up actions to run an action instead of the inline action.

In this example, in reasoning instructions, running an action is included in a conditional statement. If the `order_summary` variable doesn’t already contain a value from earlier in the conversation, the agent uses the `lookup_current_order` action to fill the variable. Including this conditional statement in the reasoning instructions ensures that the agent always has access to the order summary before reasoning.

![Run an action in a conditional instruction](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/agent_canvas_run_action.png)

Reasoning Instructions

Add a line to the subagent's reasoning instructions.

After Reasoning

Add instructions that run after the agent resolves the subagent's instructions.

Add Action for Reasoning

Add a line to the subagent's actions available for reasoning.

Model Override

Select which AI model the subagent uses. By default, every agent and its subagents use the model specified on the Einstein Audit, Analytics, and Monitoring Setup page. See [Choosing an AI Model for a Subagent](https://help.salesforce.com/s/articleView?id=ai.agent_subagents_model.htm&release=264.0.0&type=5 "Choose the right AI model for each part of your agent to balance response speed, accuracy, and reasoning depth.").

![Model override dropdown on subagent page](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/agent_canvas_model_override.png)

## Features in Actions Available for Reasoning

Utilities

Utility types include transitions to set subagents, escalations to a representative, or setting a variable. Create a utility and add it to your actions available for reasoning to make this functionality available for your agent to select during reasoning. After you add a utility to your actions available for reasoning, you can use a resource to reference it as an action and other inline actions in reasoning instructions to tell your agent how to use it.

This is what a transition utility looks like in Canvas view.

![The transition utility in reasoning actions](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/agent_canvas_utility.png)

The escalation utility is only available for agents that use the Messaging or Enhanced Chat v2 connection. Agent's can't escalate conversations in Agentforce Builder. To test escalation, deploy your agent and then chat with it on a connected channel.

Unlike traditional agent actions, any utilities you add in actions available for reasoning don’t show up in your subagent's actions section in the Explorer panel.

Filters (Make this action available when:)

Filters ensure that your agent can use a subagent or action only when one or more conditions are met.

In this example, in the actions available for reasoning, a filter has been applied to the `create_return` action. The action is only available when an order is within the return window (`return_eligibility` variable equals True).

![A filter applied to an action](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/agent_canvas_filter_actions.png)

To determine whether the customer’s order meets the filter conditions, in reasoning instructions, the agent evaluates the `days_since_order` variable to determine whether the customer placed the order within the last 60 days. If the value is 60 or less, the agent sets the value of the `return_eligibility` variable to True, which meets the filter conditions for access to the `create_return` action. Then the agent is able to offer to process a return.

![The return\_eligibility variable set to true in an instruction](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/agent_canvas_filter_instructions.png)

Follow-Up Actions (After this action is run:)

Follow-up actions define steps that your agent takes after it chooses and runs an action during its reasoning process. Follow-up actions can include saving outputs to variables, transitioning to a different subagent, or running another action.

In this example, in actions available for reasoning, when the agent runs the `validate_user_ready` action as part of agent reasoning, the agent always transitions from the current subagent to the `analyze_issue` subagent.

![An action with a follow-up transition to another subagent](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/generative_ai/images/agent_canvas_follow_up.png)

## Keyboard Shortcuts

Quickly navigate Agentforce Builder’s Canvas view with these keyboard shortcuts for macOS and Windows.

To use autocomplete in Script view, enter the @ symbol and then find the resource that you want to reference using the arrow keys. Use the Tab or Enter key to select the resource.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:33.33333333333333%">
          <col style="width:33.33333333333333%">
          <col style="width:33.33333333333333%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" id="d220344e573">Action</th>
            <th scope="col" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" id="d220344e576">MacOS</th>
            <th scope="col" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" id="d220344e579">Windows</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Action" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e573 ">Select a line</td>

            <td data-label="MacOS" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e576 ">Command+A</td>

            <td data-label="Windows" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e579 ">Ctrl+A</td>

          </tr>
          <tr class="">
            <td data-label="Action" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e573 ">Select a reasoning block</td>

            <td data-label="MacOS" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e576 ">Command+A+A</td>

            <td data-label="Windows" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e579 ">Ctrl+A+A</td>

          </tr>
          <tr class="">
            <td data-label="Action" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e573 ">Copy</td>

            <td data-label="MacOS" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e576 ">Command+C</td>

            <td data-label="Windows" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e579 ">Ctrl+C</td>

          </tr>
          <tr class="">
            <td data-label="Action" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e573 ">Cut</td>

            <td data-label="MacOS" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e576 ">Command+X</td>

            <td data-label="Windows" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e579 ">Ctrl+X</td>

          </tr>
          <tr class="">
            <td data-label="Action" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e573 ">Paste</td>

            <td data-label="MacOS" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e576 ">Command+V</td>

            <td data-label="Windows" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e579 ">Ctrl+V</td>

          </tr>
          <tr class="">
            <td data-label="Action" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e573 ">Insert a resource</td>

            <td data-label="MacOS" class="slds-cell-wrap" colspan="2" style="text-align:left;vertical-align:top;" headers="d220344e576 d220344e579 ">@</td>

          </tr>
          <tr class="">
            <td data-label="Action" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e573 ">Insert an inline action</td>

            <td data-label="MacOS" class="slds-cell-wrap" colspan="2" style="text-align:left;vertical-align:top;" headers="d220344e576 d220344e579 ">/</td>

          </tr>
          <tr class="">
            <td data-label="Action" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e573 ">Bold selected text</td>

            <td data-label="MacOS" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e576 ">Command+B</td>

            <td data-label="Windows" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e579 ">Ctrl+B</td>

          </tr>
          <tr class="">
            <td data-label="Action" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e573 ">Italicize selected text</td>

            <td data-label="MacOS" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e576 ">Command+I</td>

            <td data-label="Windows" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e579 ">Ctrl+I</td>

          </tr>
          <tr class="">
            <td data-label="Action" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e573 ">Save changes</td>

            <td data-label="MacOS" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e576 ">Command+S</td>

            <td data-label="Windows" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e579 ">Ctrl+S</td>

          </tr>
          <tr class="">
            <td data-label="Action" class="slds-cell-wrap" style="text-align:left;vertical-align:top;" headers="d220344e573 ">Switch between Canvas and Script view</td>

            <td data-label="MacOS" class="slds-cell-wrap" colspan="2" style="text-align:left;vertical-align:top;" headers="d220344e576 d220344e579 ">Option + M</td>

          </tr>
        </tbody>
      </table>

## Markdown Support

Format text in Canvas view with Markdown. You can also copy formatted content from another source and paste it into Canvas view or paste raw Markdown in Script view.

 
| Format | Syntax |
| --- | --- |
| Heading 1 | \# Heading 1 |
| Heading 2 | \## Heading 2 |
| Heading 3 | \### Heading 3 |
| Bold | \*\*bold text\*\* |
| Italic | \*italic text\* |
| Bulleted list | \- List item |
| Ordered list | 1\. List item |
| Divider | \--- |