Skip to content
Β 
Β 

Latest commit

Β 

History

84 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI Agent Studio Logo

Salesforce AI Agent Framework

Enterprise-Grade AI Platform for Salesforce

Build intelligent AI agents powered by Large Language Models that seamlessly integrate with your Salesforce environment. Designed for security, scalability, and ease of use.

License: MPL 2.0 Salesforce GitHub Pages GitHub stars GitHub forks GitHub last commit GitHub issues LinkedIn Sponsor


πŸŽ₯ Watch It In Action

Function Agents Demo β†’

See how Function Agents orchestrate Account-Based Marketing campaigns with intelligent filtering, human-in-the-loop approvals, and error recovery.


οΏ½ Documentation

View Full Documentation β†’


πŸ’– Support This Project

AI Agent Studio is free and open-source. If you find it useful, consider supporting ongoing development.

β˜• GitHub Sponsors | Buy Me a Coffee


⚠️ Repository Notice

This repository contains the core AI Agent Framework only. The aiAgentStudioAddons folder contains proprietary extensions not included in the open-source release.

The core framework in force-app provides all fundamental capabilities for building Conversational, Function, Workflow, and Email AI agents with OpenAI and other providers.


🎯 What is This?

Create AI-powered assistants that can:

  • πŸ’¬ Chat naturally with users and remember conversation context
  • πŸ” Search and retrieve Salesforce data intelligently
  • ✏️ Create and update records based on user requests
  • πŸ”„ Execute workflows with multiple steps automatically
  • πŸ”’ Respect permissions - agents only access what users can access
  • 🎯 Work with multiple AI providers - OpenAI included, extensible for others

πŸ’Ό Use Cases

Customer Support

Deploy AI copilots that help support agents resolve cases faster by automatically searching knowledge bases, pulling customer history, and suggesting solutions - all while respecting your existing security model.

Sales Enablement

Give sales reps an intelligent assistant that can find accounts, surface open opportunities, create follow-up tasks, and provide real-time insights during customer conversations.

Operations Automation

Build workflow agents that handle multi-step processes like lead qualification, case routing, or approval workflows - combining multiple AI-powered decisions into automated pipelines.

Self-Service Portals

Embed conversational agents in Experience Cloud to let customers check order status, create support cases, or find answers from your knowledge base without waiting for human agents.


πŸ”„ How It Works

flowchart LR
    subgraph Input
        A[πŸ‘€ User Message]
    end

    subgraph Framework
        B[🎭 Orchestrator]
        C[🧠 LLM]
        D[πŸ”§ Tools]
    end

    subgraph Salesforce
        E[πŸ“Š Data]
        F[πŸ“ Context]
        G[πŸ’Ύ Memory]
    end

    A --> B
    B --> C
    C --> D
    D --> E
    F --> B
    G --> C
    D --> H[βœ… Response]
Loading
  1. User sends a message through the chat component or API
  2. Context is gathered from the current record, user profile, and related data
  3. LLM analyzes the request with full conversation history
  4. Tools execute Salesforce operations (query, create, update, post)
  5. Response is delivered back to the user with full audit trail

All operations run asynchronously using Platform Events or Queueables, ensuring scalability for enterprise workloads.


✨ Key Features

Feature Description
Four Agent Types Conversational (chat), Function (single-task), Workflow (multi-agent orchestration), Email (thread processing)
Smart Memory Buffer window and summary-based conversation history
Built-in Security Automatic CRUD, FLS, and sharing rule enforcement
Standard Actions Create, update, query records, post to Chatter, execute Flows
Extensible Custom actions, context providers, LLM adapters, memory managers
Observability Full logging of LLM interactions, tool executions, and token usage
Async Processing Platform Events (high concurrency) or Queueables (debugging)

πŸ† Why This Framework?

Challenge How We Solve It
Security concerns with AI Runs in user context with automatic CRUD/FLS enforcement. No privilege escalation. Full audit trail.
Integration complexity Native Salesforce - no external servers, middleware, or data sync. Works with your existing org.
Vendor lock-in Bring your own LLM. OpenAI ships in core. Any OpenAI-compatible API works out of the box. Extend BaseProviderAdapter for other formats.
Scalability Async processing handles thousands of concurrent conversations. Choose Platform Events or Queueables.
Customization needs Extensible architecture with interfaces for custom actions, context providers, and memory strategies.
Governance & compliance Every interaction logged to AgentDecisionStep__c. See exactly what the AI decided and why.

πŸš€ Quick Start

Prerequisites

  • Salesforce org (Sandbox recommended)
  • System Administrator access
  • OpenAI API key

Installation

Option 1: Unlocked Package (Recommended for Quick Start)

Install directly via package URL:

After installation:

  • Assign permission sets: AIAgentStudioConfigurator (for admins), AIAgentStudioEndUser (for users)
  • Configure your LLM provider (OpenAI or any OpenAI-compatible API)
  • Create your first agent

Option 2: CumulusCI (Best for Development & Testing)

If you have CumulusCI set up:

cci flow run dev_org --org dev

This single command:

  • Creates a scratch org with the framework deployed
  • Deploys seed data and sample configurations
  • Assigns required permission sets (AIAgentStudioConfigurator, AIAgentStudioEndUser)
  • Enables Knowledge user and assigns KnowledgeDemo permission set
  • Creates comprehensive sample data (agents, capabilities, test records)
  • Sets up a Connected App for API access

Option 3: Salesforce CLI (Source-Based)

sf project deploy start -d force-app/main/default -o your-org-alias

Optional: Load Test Data

If you need sample data to explore the framework (especially with Option 1 or 3):

  1. Deploy the test data factory from the seed-data folder:

    sf project deploy start -d seed-data/main/default -o your-org-alias
  2. Execute in Developer Console (or via Anonymous Apex):

    AgentTestDataFactory.createComprehensiveShowcase();

This creates sample agents, capabilities, accounts, contacts, and test scenarios to help you get started quickly.

Configure OpenAI API Key

The framework includes pre-configured OpenAI named credentials. You just need to add your API key:

  1. Navigate to Setup β†’ Named Credentials β†’ External Credentials
  2. Find and open OpenAIEC
  3. Under Principals, click Edit on the principal
  4. In the Authentication Parameters section, add:
    • Parameter: OpenAIKey
    • Value: Your OpenAI API key (starts with sk-)
  5. Click Save

The OpenAILLM named credential is now ready to use with the framework.

Tip: OpenAIProviderAdapter works with any OpenAI-compatible API β€” Azure OpenAI, Groq, Together AI, Ollama, and more β€” just by pointing the Named Credential to a different URL. For non-OpenAI APIs (e.g. Google Vertex AI), check the Configuration Guide.

Setup

Once your API key is configured:

  1. Create or use existing LLM Configuration (references the OpenAILLM named credential)
  2. Create AI Agent Definition with identity/instruction prompts
  3. Add Capabilities (tools) the agent can use
  4. Add Chat Component to a Lightning page or use Quick Actions

πŸ‘‰ Full Getting Started Guide β†’


πŸ—οΈ Architecture

Core Components:

  • AgentExecutionService - Main entry point for starting agent executions
  • ConversationalOrchestrator - Manages multi-turn chat conversations
  • FunctionOrchestrator - Routes to sync/async function execution (addon)
  • WorkflowOrchestrator - Coordinates multi-agent workflows (addon)
  • EmailOrchestrator - Processes email threads with auto-reply (addon)
  • LLMInteractionService - Handles communication with AI providers
  • CapabilityExecutionService - Executes tools/actions securely
  • OpenAIProviderAdapter - OpenAI and any OpenAI-compatible API (core)
  • VertexAIProviderAdapter - Google Vertex AI / Gemini (addon)
  • ILLMProviderAdapter / BaseProviderAdapter - extend to add any other provider

Extension Points:

  • IAgentAction - Build custom actions for any business logic
  • IAgentContextProvider - Supply dynamic context to agents
  • ILLMProviderAdapter - Add support for additional AI providers
  • IMemoryManager - Implement custom conversation memory strategies
  • IAgentOrchestrator - Create new agent types

πŸ‘‰ Architecture Details β†’ | Developer Guide β†’


⚠️ Important Notes

  • Use at your own risk - Test thoroughly in sandbox before production
  • AI content verification - LLMs can hallucinate; review automated actions
  • Data privacy - User inputs are sent to external AI providers
  • Cost awareness - Monitor token consumption; set appropriate history limits

πŸ“„ License

Copyright Β© 2026 Sonal

Licensed under Mozilla Public License 2.0 (MPL-2.0)

βœ… Commercial use | βœ… Modification | βœ… Distribution | ⚠️ Disclose source for modifications


Made with πŸ€– and πŸ’‘ in 2026

Empowering Salesforce teams to build intelligent AI experiences

About

Open-source framework for building AI agents in Salesforce, with built-in memory, tools, and security

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages