Skip to content
Back to skills

Salesforce Agentforce

ASecurity

Build AI agents that connect to Salesforce CRM using Agentforce skills, the Einstein Trust Layer, Data Cloud grounding, and MuleSoft connectors.

  • 31 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 6, 2026
ai-agentspythonrustgoawsgitapidatabasebackend

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Scanned June 6, 2026

npx -y skills add frank-luongt/faos-skills-marketplace --skill salesforce-agentforce --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Salesforce Agentforce?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Salesforce Agentforce
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/frank-luongt-salesforce-agentforce/badge)](https://www.skillsdirectory.com/skills/frank-luongt-salesforce-agentforce)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
<!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT -->
---
name: salesforce-agentforce
description: Salesforce Agentforce and Einstein AI integration patterns. Use when building AI agents that interact with Salesforce CRM via Agentforce skills, MuleSoft connectors, Data Cloud, or the Einstein Trust Layer.
tags: [salesforce, crm, agentforce, einstein]
---

# Salesforce Agentforce Integration

Build AI agents that connect to Salesforce CRM using Agentforce skills, the Einstein Trust Layer, Data Cloud grounding, and MuleSoft connectors.

## When to Use

- Querying or updating Salesforce records (Accounts, Contacts, Opportunities, Cases) from AI agents
- Building autonomous sales/service agents powered by Claude, GPT-4, or Gemini via Salesforce's multi-model Trust Layer
- Grounding AI responses in Salesforce Data Cloud customer profiles
- Orchestrating cross-system workflows via MuleSoft (Salesforce + SAP, ServiceNow, Oracle)

## Agentforce Pre-Built Agent Types

| Agent | Capabilities |
|---|---|
| **Service Agent** | Autonomous customer service, case resolution, KB search, escalation |
| **SDR Agent** | Lead qualification, meeting scheduling, follow-up emails, prospect research |
| **Sales Coach** | Role-play practice, deal strategy, objection handling |
| **Marketing Agent** | Campaign creation, audience segmentation, content generation |
| **Commerce Agent** | Product recommendations, guided shopping, order management |
| **Analytics Agent** | Natural language data queries, dashboard generation |

## Patterns

### 1. Salesforce REST API (SOQL Queries)

```python
import requests

class SalesforceClient:
    def __init__(self, instance_url: str, access_token: str):
        self.base_url = f"{instance_url}/services/data/v60.0"
        self.headers = {
            "Authorization": f"Bearer {access_token}",
            "Content-Type": "application/json",
        }

    def query(self, soql: str) -> list[dict]:
        """Execute a SOQL query."""
        response = requests.get(
            f"{self.base_url}/query",
            params={"q": soql},
            headers=self.headers,
        )
        response.raise_for_status()
        return response.json()["records"]

    def create_record(self, sobject: str, data: dict) -> str:
        """Create a Salesforce record."""
        response = requests.post(
            f"{self.base_url}/sobjects/{sobject}",
            json=data,
            headers=self.headers,
        )
        response.raise_for_status()
        return response.json()["id"]

    def update_record(self, sobject: str, record_id: str, data: dict) -> None:
        """Update a Salesforce record."""
        response = requests.patch(
            f"{self.base_url}/sobjects/{sobject}/{record_id}",
            json=data,
            headers=self.headers,
        )
        response.raise_for_status()

# Agent tool functions
def search_accounts(name: str) -> list[dict]:
    sf = get_salesforce_client()
    return sf.query(f"SELECT Id, Name, Industry, AnnualRevenue FROM Account WHERE Name LIKE '%{name}%' LIMIT 10")

def get_open_opportunities(account_id: str) -> list[dict]:
    sf = get_salesforce_client()
    return sf.query(f"SELECT Id, Name, Amount, StageName, CloseDate FROM Opportunity WHERE AccountId = '{account_id}' AND IsClosed = false ORDER BY Amount DESC")

def create_case(account_id: str, subject: str, description: str, priority: str = "Medium") -> str:
    sf = get_salesforce_client()
    return sf.create_record("Case", {
        "AccountId": account_id,
        "Subject": subject,
        "Description": description,
        "Priority": priority,
        "Origin": "AI Agent",
    })
```

### 2. OAuth 2.0 Authentication (JWT Bearer Flow)

```python
import jwt
import time
import requests

def get_salesforce_token(
    client_id: str,
    private_key: str,
    username: str,
    login_url: str = "https://login.salesforce.com",
) -> dict:
    """Authenticate using JWT Bearer flow (server-to-server)."""
    claim = {
        "iss": client_id,
        "sub": username,
        "aud": login_url,
        "exp": int(time.time()) + 300,
    }
    assertion = jwt.encode(claim, private_key, algorithm="RS256")

    response = requests.post(
        f"{login_url}/services/oauth2/token",
        data={
            "grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer",
            "assertion": assertion,
        },
    )
    response.raise_for_status()
    return response.json()  # {"access_token": "...", "instance_url": "..."}
```

### 3. MuleSoft Connector Orchestration

```
AI Agent Request
  --> MuleSoft Anypoint Platform
    --> Pre-built Connector (SAP, Oracle, ServiceNow)
    --> Transform (DataWeave)
    --> Return structured result
  --> AI Agent synthesizes response
```

MuleSoft provides 1,000+ pre-built connectors. Key enterprise connectors:
- SAP (S/4HANA, ECC, Ariba, SuccessFactors)
- Oracle (ERP Cloud, HCM, Database)
- ServiceNow (ITSM, CSM, HR)
- Workday (HCM, Finance)

### 4. Einstein Trust Layer (Multi-Model)

Salesforce's Trust Layer supports multiple LLM backends:

| Provider | Models | Access Path |
|---|---|---|
| OpenAI | GPT-4, GPT-4o | Direct integration |
| Anthropic | Claude 3, Claude 3.5 | Via AWS Bedrock |
| Google | Gemini 1.5 | Via model gateway |
| Salesforce | xGen, CodeGen | Native |
| Custom | Any REST endpoint | BYOM (Bring Your Own Model) |

Trust Layer capabilities:
- PII masking before sending to LLMs
- Response grounding in Salesforce data
- Audit trail of all AI interactions
- Zero data retention by LLM providers
- Toxicity and bias detection

## Anti-Patterns

- Hardcoding Salesforce credentials -- use OAuth JWT flow or Named Credentials
- Querying all fields with `SELECT *` -- SOQL requires explicit field selection
- Bypassing the Trust Layer for direct LLM calls -- loses PII protection and audit trail
- Building custom integrations when MuleSoft connectors exist -- leverage existing connectors
- Ignoring governor limits -- Salesforce has API call limits per 24-hour period

## References

- [Salesforce Agentforce](https://www.salesforce.com/agentforce/)
- [Salesforce REST API](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/)
- [Einstein Trust Layer](https://www.salesforce.com/artificial-intelligence/trusted-ai/)
- [MuleSoft Connectors](https://www.mulesoft.com/exchange/)
- [Salesforce MCP Server](https://github.com/salesforce/mcp-server)

<!-- Source: .faos/custom/skills/integrations/salesforce-agentforce/SKILL.md -->

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…