Opencloudforce is a native Salesforce AI agent system — a flexible, open alternative to Agentforce. It connects your Salesforce org to any LLM available on OpenRouter (Claude, GPT-4, Mistral, Llama, and more), giving your users an intelligent chat interface that can read records, run Flows, and execute Apex — all from within Salesforce.
No external servers. No middleware. Just LWC + Apex + OpenRouter.
- Multi-model support — switch between Claude, GPT-4, Mistral, Llama, or any other OpenRouter model per agent, without changing code
- Real-time streaming responses — responses stream token-by-token for a fast, natural chat experience
- Tool/function calling — agents can invoke Salesforce Flows or Apex classes as tools, letting them query records, update data, or call external APIs
- Fully native Salesforce — built entirely with LWC and Apex; no external servers or middleware required
- No-code agent configuration — create and configure agents through custom objects; no deployment needed to add new agents or tools
- Conversation memory — configurable conversation history depth keeps context across multiple turns
- Cost-effective — pay only for what you use via OpenRouter, without Agentforce per-user licensing
Go to openrouter.ai, create an account, and generate an API key from your dashboard.
git clone https://github.com/your-org/Opencloudforce.git
cd Opencloudforce/packagesf org login web --alias my-orgsf project deploy start --manifest manifest/package.xml --target-org my-orgThis deploys all components defined in manifest/package.xml:
- LWC components:
agentHub,agentCard,aiAgentChat,aiChatMessage - Apex classes:
AgentController,AgentToolExecutor,AgentToolCallable,AIQueryRecords - Custom objects:
Agent__c,Agent_Tool__c - App, tabs, permission set, remote site settings, and CSP trusted sites
After deployment, update the Custom Label in Setup > Custom Labels:
| Label | Value |
|---|---|
OpenRouter_API_Key |
Your OpenRouter API key |
Assign the AI_Agent_User permission set to yourself and any user who needs access to the agent hub:
sf org assign permset --name AI_Agent_User --target-org my-orgOr assign it manually via Setup > Permission Sets > AI_Agent_User > Manage Assignments.
Run the provided anonymous Apex script to create a realistic demo agent and tool configuration:
sf apex run --file scripts/apex/create_demo_query_agent.apex --target-org my-orgThis creates a Sales Ops Assistant (Demo) agent configured to use the query_records tool backed by OCF_AIQueryRecords.
That's it. Open the OCF Agent Studio app from the App Launcher to get started.
Represents an AI agent with its model configuration and behavior settings. Each agent appears as a card in the Agent Hub.
| Field | Type | Description |
|---|---|---|
Name |
Text | Display name of the agent |
OCF_Description__c |
Text | Short description shown in the agent selection card |
OCF_OpenRouter_Model__c |
Text | OpenRouter model ID (e.g. anthropic/claude-3.5-sonnet, mistralai/ministral-8b) |
OCF_Temperature__c |
Number (0–2) | Controls response creativity. Lower = more deterministic |
OCF_Max_Tokens__c |
Number | Maximum tokens in each response |
OCF_Top_P__c |
Number | Nucleus sampling parameter |
OCF_Frequency_Penalty__c |
Number | Reduces repetition of recently used tokens |
OCF_Presence_Penalty__c |
Number | Encourages the model to introduce new topics |
OCF_Custom_Instructions__c |
Long Text | System prompt injected at the start of every conversation |
OCF_Enable_Tools__c |
Checkbox | When checked, the agent can call configured tools |
OCF_Max_Conversation_Turns__c |
Number | How many previous messages to include in each API request |
OCF_Is_Active__c |
Checkbox | Controls whether the agent appears in the hub |
OCF_External_ID__c |
Text | Optional external system identifier |
Represents a callable tool available to an agent. Tools let the LLM take actions in Salesforce — querying data, updating records, running automations, or calling external services. Each tool is linked to a parent Agent__c record.
| Field | Type | Description |
|---|---|---|
Name |
Text | Display name of the tool |
OCF_Tool_Name__c |
Text | Technical name the LLM uses when calling the tool (e.g. query_records) |
OCF_Description__c |
Long Text | Explains to the LLM what the tool does and when to use it |
OCF_Action_Type__c |
Picklist | Execution method: Flow or Apex |
OCF_Action_Name__c |
Text | Flow API name or Apex class name to invoke |
OCF_Parameters_Schema__c |
Long Text | JSON Schema describing the tool's input parameters (used by the LLM) |
OCF_Return_Schema__c |
Long Text | JSON Schema describing the tool's output (used by the LLM) |
OCF_Is_Active__c |
Checkbox | Controls whether the tool is available to the agent |
OCF_Requires_Confirmation__c |
Checkbox | If checked, user confirmation is required before the tool runs |
OCF_Timeout_Seconds__c |
Number | Maximum execution time for the tool |
OCF_External_ID__c |
Text | Optional external system identifier |
Opencloudforce ships with one ready-to-use Apex tool: AIQueryRecords. Set OCF_Action_Type__c = Apex and OCF_Action_Name__c = AIQueryRecords on any tool record to let agents dynamically query any Salesforce object by SOQL.
Accepted parameters:
| Parameter | Required | Description |
|---|---|---|
objectType |
Yes | Salesforce object API name (e.g. Account) |
fields |
Yes | List of field names to retrieve |
whereClause |
No | WHERE condition (without the WHERE keyword) |
orderBy |
No | ORDER BY clause |
limitCount |
No | Number of records to return (default 10, max 100) |