Build, Extend, and Troubleshoot with Agent Optimizer in Agentforce Builder (Beta)

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.

Required Editions

Available in: Lightning Experience
Available in: Enterprise, Performance, Unlimited, and Developer Editions. Required add-on licenses vary by agent type.
Note
Note

Agent Optimizer in Agentforce Builder (formerly known as Agentforce Development Agent) is a beta service that is subject to the Beta Services Terms at Agreements - Salesforce.com or a written Unified Pilot Agreement if executed by Customer. Use of this beta service is at the Customer's sole discretion.

If you prefer the previous assistant experience, you can opt out of the beta. In Setup, from the Einstein Setup page, turn on Disable Agentforce Development Agent (Beta).

Use Cases How Agentforce Can Help
Add new capabilities to your agent

You don't have to be an Agent Script developer to build out an agent. Describe what you want in plain language. For example, ask Optimizer to add a subagent that looks up order details and requires user verification. Agentforce handles the rest.

Optimizer searches for relevant actions in your org and asset library, creates any subagents, and updates the Agent Router. If it can't find an existing action that fits your use case, it creates a placeholder with the metadata your agent needs and flags it for you to finish. When it's done, it explains what it plans to change and why, and it simulates the change to confirm that it works as expected. You can accept or decline before anything is applied.

Refine or restrict your agent's behavior

Whether you're fine-tuning after an initial rollout or enforcing compliance guardrails, ask Optimizer to update routing conditions and access rules without rebuilding Agent Script from scratch. For example, restrict a refund subagent to customers with a "delivered" order status, or limit escalation to customers above a certain entitlement tier.

Optimizer proposes targeted adjustments and validates them in preview to identify and fix any downstream issues before you apply them.

Troubleshoot unexpected agent behavior

When your agent behaves unexpectedly in testing or production, describe what it's doing instead of what you want, or ask Optimizer to explain a specific error. You can also use it to fix Agent Script validation issues flagged on save or in the console. If you’re testing your agent’s behavior in a preview conversation, click Ask Optimizer in the Interaction Summary panel to add the conversation to Optimizer's context, and then send a message.

Optimizer surfaces likely root causes, such as missing instructions, ambiguous subagent routing, or empty variables. It proposes and validates targeted fixes for you to review, so you don’t have to manually review your agent’s full script.

Test your agent conversationally, and fix what you find

Ask Optimizer to run a quick health check on a specific subagent or conversation path. You can ask it to test against different personas (for example, "test this as a frustrated customer"), variations in user inputs, or edge cases. Describe the scenarios that you want to validate, such as whether a returns subagent handles requests correctly or an order lookup routes as expected.

Optimizer generates representative test conversations, simulates them concurrently in preview, and summarizes what it finds, including any latency, routing issues, or gaps. Then you can then ask it to fix what it found. Instead of a generic rewrite, it proposes targeted fixes and then re-runs the tests to confirm that the fixes worked.

Validate and optimize your agent after upgrading from the legacy builder

When you migrate or upgrade an existing agent, you can use Agentforce or third-party AI coding tools to do most of the work. But metadata and syntax differences between the legacy and new builder can still cause initial validation errors. Use Optimizer to resolve those errors without memorizing Agent Script syntax.

You can also ask Optimizer to optimize your agent's script to improve quality and follow Agent Script best practices, so you get the most from your new agent. It reviews your natural language instructions, suggests improvements, and adds deterministic controls to improve reliability and performance.

Considerations for Using Agent Optimizer in Agentforce Builder

  • Agent Optimizer is included in all SKUs, licenses, and editions that grant access to Agentforce Builder at no additional cost. It doesn’t incur billing or consume credits.
  • Agent Optimizer reasons in increments of five minutes. If your task is more complex, Optimizer pauses and gives a summary of what it’s completed so far and the remaining steps. It retains the context of what it was working on, so you can ask it to resume and it picks up where it left off.
  • When you refresh Agentforce Builder during a conversation with Agent Optimizer, a new session starts and context resets. Minimizing Optimizer doesn’t affect an ongoing conversation.
  • Agent Optimizer uses the same APIs used in Agentforce Builder Preview to run tests behind the scenes. When it tests your agent, it runs concurrent preview conversations in simulate mode. It repeats this test-and-fix process as needed to validate your agent's behavior.
  • Agent Optimizer uses the same reasoning model that you’ve specified for Agentforce agents overall. See Select Agentforce Model Option to learn more about available models for Agentforce agents and how to change your model selection.
  • The Agent Optimizer in Agentforce Builder beta experience is available in the assistant panel automatically. But if you prefer the previous assistant experience, you can opt out of the beta. In Setup, from the Einstein Setup page, turn on Disable Agentforce Optimizer (Beta) in Agentforce Builder. This setting controls the chat experience and agent capabilities only.