Skip to content

Getting Started

Getting Started

Complete guide to deploying and configuring your first AI agent.

[!TIP] Fastest path: run cci flow run dev_org --org dev with CumulusCI.
Manual path: clone repo, deploy with SF CLI, create Named Credential, create LLM Config, create Agent, add capabilities, add chat component.

Setup Flow

  1. Deploy the framework.
  2. Configure Named Credentials.
  3. Create an LLM Configuration.
  4. Create your first agent.
  5. Add capabilities.
  6. Add the chat component and test.

Configuration Reference

Field-level settings for agents, safety controls, and runtime behavior.

Developer Guide

Build custom actions and context providers.

Troubleshooting

Diagnose setup and runtime issues quickly.

Prerequisites

[!TIP] Start with a Sandbox org for initial setup and testing.

Before you begin, ensure you have:


Step 1: Deploy the Framework

CumulusCI provides the fastest way to get started with a fully configured scratch org.

Terminal window
# Clone the repository
git clone https://github.com/iamsonal/aiAgentStudio.git
cd aiAgentStudio
# Run the dev_org flow
cci flow run dev_org --org dev

This single command performs all of the following:

StepWhat it does
Deploy FrameworkDeploys all Apex classes, LWCs, objects, and metadata from force-app
Deploy Seed DataDeploys utility classes from seed-data folder
Assign Permission SetsAssigns AIAgentStudioConfigurator and AIAgentStudioEndUser
Enable KnowledgeEnables Knowledge user and assigns KnowledgeDemo permission set
Create Sample DataRuns AgentTestDataFactory.createComprehensiveShowcase() to create sample agents and test data
Setup Connected AppConfigures a Connected App for API access

After the flow completes, open your scratch org:

Terminal window
cci org browser dev

You’ll have working sample agents ready to test. Explore the seed-data folder and AgentTestDataFactory class to see what gets created.

Option 2: Salesforce CLI (Manual Setup)

For existing orgs or when you need more control over the deployment:

Terminal window
# Clone the repository
git clone https://github.com/iamsonal/aiAgentStudio.git
cd aiAgentStudio
# Authenticate to your org
sf org login web -a your-org-alias
# Deploy the framework
sf project deploy start -d force-app/main/default -o your-org-alias

Step 2: Configure Named Credentials

[!CAUTION] Never commit API keys to source control. Named Credentials keep secrets out of metadata.

Named Credentials securely store your AI provider API keys.

For OpenAI

  1. Go to Setup → Named Credentials → New
  2. Configure:
    • Label: OpenAI API
    • Name: OpenAI_API
    • URL: https://api.openai.com
    • Identity Type: Named Principal
    • Authentication Protocol: Custom
  3. Add External Credential with your API key as a header:
    • Header Name: Authorization
    • Header Value: Bearer YOUR_API_KEY

For Claude (Anthropic)

  1. Go to Setup → Named Credentials → New
  2. Configure:
    • Label: Claude API
    • Name: Claude_API
    • URL: https://api.anthropic.com
  3. Add header:
    • Header Name: x-api-key
    • Header Value: YOUR_API_KEY

For Gemini (Google)

  1. Go to Setup → Named Credentials → New
  2. Configure:
    • Label: Gemini API
    • Name: Gemini_API
    • URL: https://generativelanguage.googleapis.com
  3. Add your API key as a query parameter or header per Google’s requirements

Step 3: Create LLM Configuration

LLM Configurations define how to connect to your AI provider.

  1. Open App Launcher → LLM Configurations
  2. Click New
  3. Fill in the fields:
FieldValueDescription
Developer NameOpenAI_GPT4oUnique identifier
Named CredentialOpenAI_APIYour named credential
Provider Adapter ClassOpenAIProviderAdapterProvider-specific adapter
Default Modelgpt-4o-miniModel to use
Temperature0.7Creativity (0-1)
Max Tokens4096Maximum response length
Is ActiveEnable this configuration

Available Provider Adapters

ProviderAdapter ClassModels
OpenAIOpenAIProviderAdaptergpt-4o, gpt-4o-mini

Additional provider adapters are available in the addon package. You can also create your own by extending BaseProviderAdapter.


Step 4: Create Your First Agent

  1. Open App Launcher → AI Agent Definitions
  2. Click New
  3. Configure basic settings:
FieldValue
NameSales Assistant
Developer NameSales_Assistant
Agent TypeConversational
LLM ConfigurationOpenAI_GPT4o
Is Active
  1. Configure memory settings:
FieldValueDescription
Memory StrategyBufferWindowHow to manage history
History Turn Limit10Conversations to remember
  1. Configure prompts:

Identity Prompt (Who the agent is):

You are a helpful Salesforce assistant for the sales team.
You help users find accounts, contacts, and opportunities.
You are professional, concise, and always confirm before making changes.

Instructions Prompt (How to behave):

- Always greet users warmly
- Ask clarifying questions when requests are ambiguous
- Confirm before creating or updating records
- Provide summaries of search results
- If you can't help, explain why and suggest alternatives

Step 5: Add Capabilities

[!NOTE] Capabilities are the tools your agent can use. Start with read-only capabilities, then add write capabilities.

Capabilities define what actions your agent can perform.

Example: Search Contacts

  1. Open App Launcher → Agent Capabilities
  2. Click New
  3. Configure:
FieldValue
Capability Namesearch_contacts
DescriptionSearch for contacts by name, email, or account. Use this when users ask to find contact information.
Implementation TypeStandard
Standard Action TypeGetRecordDetails
AI Agent DefinitionSales Assistant
  1. Add Backend Configuration:
{
"objectApiName": "Contact"
}
  1. Add Parameters (JSON Schema):
{
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "Contact's first name"
},
"lastName": {
"type": "string",
"description": "Contact's last name"
},
"email": {
"type": "string",
"description": "Contact's email address"
},
"accountName": {
"type": "string",
"description": "Name of the contact's account"
}
}
}

Example: Create Task

FieldValue
Capability Namecreate_task
DescriptionCreate a follow-up task. Use when users want to schedule reminders or to-dos.
Implementation TypeStandard
Standard Action TypeCreateRecord
Requires Approval

Backend Configuration:

{
"objectApiName": "Task"
}

Parameters:

{
"type": "object",
"required": ["Subject"],
"properties": {
"Subject": {
"type": "string",
"description": "Task subject/title"
},
"Description": {
"type": "string",
"description": "Task details"
},
"ActivityDate": {
"type": "string",
"description": "Due date in YYYY-MM-DD format"
},
"Priority": {
"type": "string",
"enum": ["High", "Normal", "Low"],
"description": "Task priority"
}
}
}

Step 6: Add Chat Component to a Page

  1. Go to Setup → Lightning App Builder
  2. Edit an existing page or create a new one
  3. Find aiAssistantChat in the components panel
  4. Drag it onto your page
  5. Configure the component:
    • Agent Developer Name: Sales_Assistant
  6. Save and Activate the page

Step 7: Test Your Agent

Open the page with your chat component and try these conversations:

You: Hi there!
Agent: Hello! I'm your Sales Assistant. How can I help you today?
You: Find contacts at Acme Corp
Agent: [Searches and returns contacts]
You: Create a task to follow up with John Smith next week
Agent: I'll create a follow-up task for John Smith. Here are the details:
- Subject: Follow up with John Smith
- Due Date: [next week]
Should I proceed?
You: Yes
Agent: ✓ Task created successfully!

Next Steps

Now that you have a working agent, explore: