> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openlayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Salesforce Agentforce

> Connect your Salesforce Agentforce agents to Openlayer for automated monitoring and evaluation

![Salesforce Agentforce hero](https://mintcdn.com/openlayer-44/23RRs4L-T2iJzmpl/images/integrations/salesforce_agentforce_hero.png?fit=max\&auto=format\&n=23RRs4L-T2iJzmpl\&q=85\&s=9c8f827834713678ed2305f0eadd9f37)

Openlayer integrates with [Salesforce Agentforce](https://www.salesforce.com/agentforce/) to help you
monitor, evaluate, and improve your Agentforce agents. The integration connects to Salesforce via OAuth,
automatically discovers your agents, and periodically syncs conversation data from the
[Data 360](https://www.salesforce.com/data/) so you can trace every session in Openlayer.

## How it works

Once connected, Openlayer:

1. **Discovers your agents** — automatically fetches all active Agentforce agents from your Salesforce org
2. **Creates projects and data sources** — each enabled agent gets its own Openlayer project and data source, with no manual setup required
3. **Syncs conversations** — periodically pulls agent interactions from Data 360 (via the Data 360 API), converting them into structured traces with sessions, requests, and individual steps
4. **Enriches traces** — extracts LLM model names, providers, token counts, and user IDs from GenAI Gateway data

> [!NOTE]
>
> All access is **read-only** — Openlayer never writes data to your Salesforce
> org.

***

## Prerequisites

Before connecting, ensure the following are configured in your Salesforce org:

### 1. Agentforce enabled

You must have at least one active Agentforce agent.

* In Salesforce Setup, go to **Agentforce Agents**
* Turn on Agentforce and create or enable an agent

### 2. Data 360 provisioned with Agent Analytics

Openlayer reads conversation data from Data 360, which requires Agent Analytics to be enabled.

* In Salesforce Setup, go to the **Einstein Feedback and Monitoring** page
* Turn on **Agent Analytics**

> [!WARNING]
>
> Agent Analytics requires Data 360 to already be provisioned in your org. If
> Data 360 is not enabled, contact your Salesforce administrator.

### 3. Create a Salesforce Connected App

Openlayer authenticates via OAuth using a Connected App you create in your Salesforce org. This gives you
full control over the scopes and access granted.

> [accordion] Step-by-step: Create a Connected App
>
> 1. In Salesforce Setup, search for **App Manager** and click **New Connected App**
>
> 2. Fill in the basic information:
>    * **Connected App Name**: `Openlayer`
>    * **API Name**: `Openlayer`
>    * **Contact Email**: your admin email
>
> 3. Under **API (Enable OAuth Settings)**, check **Enable OAuth Settings**
>
> 4. Set the **Callback URL** to:
>    ```
>    https://app.openlayer.com/integrations/agentforce/callback
>    ```
>    > [!NOTE]
>    >
>    > **On-premise deployments**: replace `app.openlayer.com` with your
>    > deployment's base URL.
>
> 5. Add the following **OAuth Scopes**:
>
>    | Scope | Purpose |
>    | - | - |
>    | `api` | Read the list of Agentforce agents |
>    | `cdp_api` | Read agent conversation transcripts from Data 360 |
>    | `refresh_token` | Keep the connection active for background syncs |
>
> 6. Click **Save**, then **Continue**
>
> 7. After creation, go to **Manage Consumer Details** to retrieve the **Consumer Key** (Client ID) and **Consumer Secret** (Client Secret)
>
> > [!WARNING]
> >
> > Store the Consumer Secret securely — you'll need it when connecting in
> > Openlayer. Salesforce only shows the secret once unless you regenerate it.

### 4. User permissions

System Administrators have all required permissions by default. Non-admin users connecting the integration need:

* **API Enabled** permission
* **Data 360 User** permission set
* Read access to **BotDefinition**
* **Approve Uninstalled Connected Apps** or **Use Any API Client** permission

***

## Setup guide

### Step 1: Navigate to the integration

In your Openlayer workspace, go to **Settings** → **Integrations** and find the **Salesforce Agentforce** card. Click **Enable**.

![The Openlayer Integrations page, searched for Agentforce, with the Salesforce Agentforce card and its Enable button](https://mintcdn.com/openlayer-44/i_IVq7qGt9U6VbHF/images/integrations/salesforce_agentforce_integrations_page.png?fit=max\&auto=format\&n=i_IVq7qGt9U6VbHF\&q=85\&s=deb30e5e0f3c75b4c0286c21727ca4d4)

### Step 2: Provide your Connected App credentials

Enter the credentials from the Connected App you created in the [prerequisites](#3-create-a-salesforce-connected-app), pick the environment your org logs in through, then click **Connect**.

* **Client ID**: the Consumer Key from your Connected App
* **Client Secret**: the Consumer Secret from your Connected App
* **Salesforce environment**: the Salesforce login domain Openlayer sends you to when you authorize

The **Salesforce environment** combobox offers three options:

| Option | When to use it |
| - | - |
| `Production (login.salesforce.com)` | The default. Your users sign in at `login.salesforce.com`. |
| `Sandbox (test.salesforce.com)` | Your Connected App lives in a sandbox org. |
| `Custom My Domain` | Your org uses a My Domain login URL. Selecting this reveals a required **Custom My Domain** field. |

For **Custom My Domain**, enter the domain on its own, in the form `mycompany.my.salesforce.com`. Openlayer cannot connect until you fill it in.

> [!WARNING]
>
> Pick the environment that matches the org where you created the Connected App.
> Production is the default, so a sandbox or My Domain org that leaves it
> unchanged is sent to `login.salesforce.com` and cannot complete the
> authorization.

![The Salesforce Agentforce connect form in Openlayer, with the Client ID, Client secret, and Salesforce environment fields](https://mintcdn.com/openlayer-44/i_IVq7qGt9U6VbHF/images/integrations/salesforce_agentforce_credentials.png?fit=max\&auto=format\&n=i_IVq7qGt9U6VbHF\&q=85\&s=dfb812b10486c573c5b3153afd82ebd4)

### Step 3: Authorize with Salesforce

After clicking **Connect**, you will be redirected to Salesforce to log in and authorize Openlayer. Once authorized, you'll be redirected back to Openlayer and the connection status will show as **Connected**.

The **Overview** section then reports the **Environment** you connected through — `Sandbox`, your custom My Domain, or `Production`. Check it if you are unsure which org Openlayer is reading from.

> [!TIP]
>
> Make sure you log in with a Salesforce user that has the [required
> permissions](#4-user-permissions).

### Step 4: Configure sync settings

Once connected, configure automatic syncing in the **Settings** section of the **General** tab:

* **Periodic sync** — toggle on to enable automatic syncing (every 15 minutes)
* **Initial sync range** — set the start date for the first sync to control how far back Openlayer fetches historical data
* **Auto-register new agents** — toggle on to automatically create a project and start monitoring when a discovered agent has recent activity

You can also click **Sync now** to trigger an immediate sync at any time.

**Auto-register new agents** is off until you turn it on. While it is off, newly discovered agents need to be enabled manually, as described in [Step 5](#step-5-enable-agents).

> [!NOTE]
>
> When the activity check cannot run during a refresh, Openlayer skips
> auto-registration for that round, tells you so, and retries on the next sync.

![The General tab of a connected Salesforce Agentforce integration in Openlayer, with the overview and the Periodic sync, Initial sync range, and Auto-register new agents settings](https://mintcdn.com/openlayer-44/i_IVq7qGt9U6VbHF/images/integrations/salesforce_agentforce_connected.png?fit=max\&auto=format\&n=i_IVq7qGt9U6VbHF\&q=85\&s=265a74904e224315b8db161e1edc735f)

> [!NOTE]
>
> Initial conversations may take up to one sync cycle to appear, as they must
> first be written to Data 360 by Salesforce before Openlayer can retrieve them.

### Step 5: Enable agents

On the **Agents** tab, Openlayer lists all discovered Agentforce agents. Discovery alone does not start monitoring: for each agent you want to monitor, toggle it on. You can also click the refresh button next to the status filter to re-discover agents from your Salesforce org.

When an agent is enabled — by you here, or by [auto-registration](#step-4-configure-sync-settings) — Openlayer creates a project and data source for it, with no additional configuration needed. The agents table shows:

* **Agent** — agent name and Salesforce ID
* **Status** — whether the agent is idle, syncing, in error, or disabled
* **Last sync** — when the agent was last synced
* **Imported sessions** — number of synced sessions

The menu (the three dots) on an enabled agent has **View project**, which opens the auto-created Openlayer project, **Backfill**, and **Disable**.

![The Agents tab of the Salesforce Agentforce integration in Openlayer, listing three agents with their status, last sync, imported sessions, and enable switch](https://mintcdn.com/openlayer-44/i_IVq7qGt9U6VbHF/images/integrations/salesforce_agentforce_agents.png?fit=max\&auto=format\&n=i_IVq7qGt9U6VbHF\&q=85\&s=7934b4ddf8e62e24c7e4d23dd842cc60)

***

## Monitoring in Openlayer

Once agents are enabled and the first sync completes, conversations automatically appear in their respective Openlayer projects.

### Conversation traces

Each Agentforce session is converted into a trace that captures user queries, agent responses, LLM model names, latency, and more.

![Example conversation trace from an Agentforce agent in Openlayer](https://mintcdn.com/openlayer-44/23RRs4L-T2iJzmpl/images/integrations/salesforce_trace.png?fit=max\&auto=format\&n=23RRs4L-T2iJzmpl\&q=85\&s=d8a2f6c0f1ca8860e83d28a54f4d1359)

### Backfill historical data

To import conversations that occurred before the integration was connected, open the menu (the three dots) next to an enabled agent and click **Backfill**. In the backfill dialog, choose the date range:

* **All available history** — re-fetch all past sessions
* **Custom start date** — fetch sessions from a specific date forward

![The Backfill dialog for an Agentforce agent, with All available history and Custom start date](https://mintcdn.com/openlayer-44/i_IVq7qGt9U6VbHF/images/integrations/salesforce_agentforce_backfill.png?fit=max\&auto=format\&n=i_IVq7qGt9U6VbHF\&q=85\&s=d4e9bd33852fad9de51684735cc04e63)

Duplicate sessions are automatically skipped, so it's safe to run a backfill at any time.

### Run evaluations

With conversations flowing into Openlayer, you can:

* [Create tests](https://docs.openlayer.com/tests/overview.md) to score response quality
* Detect hallucinations and measure faithfulness
* Track safety and compliance metrics
* Monitor latency and cost trends
* Compare agent performance across versions

***

## Disconnecting

To disconnect the Salesforce Agentforce integration:

1. Go to **Settings** → **Integrations** → **Salesforce Agentforce**
2. Click **Disconnect**

This stops all syncs. Existing data already imported into Openlayer is preserved.

## Troubleshooting

* **OAuth fails** → verify the Callback URL in your Connected App matches `https://app.openlayer.com/integrations/agentforce/callback` exactly, and that the **Salesforce environment** you selected matches the org holding the Connected App.
* **No agents discovered** → confirm you have at least one active Agentforce agent and that Data 360 with Agent Analytics is enabled.
* **Conversations not appearing** → Salesforce writes session data to Data 360 with a delay. Wait for the next sync cycle and ensure Agent Analytics is turned on.
* **Permission errors** → verify the connecting user has the [required permissions](#4-user-permissions), including `API Enabled` and `Data 360 User`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.