Troubleshooting
Common issues and how to resolve them.
Table of contents
- Agent Not Responding
- Permission Denied Errors
- High CPU Time / Timeouts
- Unexpected Tool Calls
- Context Lost Between Turns
- JSON Parse Errors
- Debug Tips
- Getting Help
Agent Not Responding
Symptoms
- Chat shows loading indefinitely
- No response after sending message
- Timeout errors
Solutions
Check Named Credential
- Go to Setup → Named Credentials
- Verify the credential is active
- Test the connection
Verify API Key
- Check API key is valid and not expired
- Verify account has available credits
- Test key directly with provider’s API
Check Agent Status
- Open the AI Agent Definition
- Ensure
IsActive__cis checked - Verify
LLMConfiguration__cis set
Review Debug Logs
- Enable debug logging for your user
- Reproduce the issue
- Check for errors in the log
Permission Denied Errors
Symptoms
- “Insufficient privileges” messages
- Agent can’t access certain records
- Fields missing from responses
Solutions
Check Object Permissions
-- Query to check user's object access
SELECT Id, Name, Profile.Name
FROM User
WHERE Id = :userId
Then verify the profile/permission set grants CRUD on target objects.
Check Field-Level Security
- Go to Setup → Object Manager → [Object] → Fields
- Click on the field
- Check “Field-Level Security”
- Ensure user’s profile has access
Check Sharing Rules
- Go to Setup → Sharing Settings
- Review OWD for the object
- Check sharing rules
- Verify user has access to specific records
High CPU Time / Timeouts
Symptoms
- “CPU time limit exceeded” errors
- Slow responses
- Incomplete executions
Solutions
Reduce History
- Lower
HistoryTurnLimit__c(try 5-7) - Switch to
SummaryBuffermemory strategy
Simplify Capabilities
- Reduce number of active capabilities
- Simplify parameter schemas
- Shorten descriptions
Use Async Processing
- Set
AsyncDispatchType__cto “High” - Enable
RunAsynchronously__con heavy capabilities
Optimize Queries
- Add indexes to frequently queried fields
- Limit fields in
BackendConfiguration__c - Use selective filters
Unexpected Tool Calls
Symptoms
- Agent uses wrong capability
- Agent calls tools unnecessarily
- Inconsistent behavior
Solutions
Improve Descriptions
Gets contacts
Too vague - the AI won’t know when to use this.
Search for contacts by name, email, or account.
Use when users ask to find contact information.
Do NOT use for creating contacts or searching accounts.
Add Examples
Examples of when to use:
- "Find John Smith's contact info"
- "Who is the contact at Acme Corp?"
- "Look up contacts with @gmail.com emails"
Lower Temperature
- Reduce
Temperature__cin LLM Configuration - Try 0.3-0.5 for more predictable behavior
Review Parameters
- Ensure JSON Schema is valid
- Add clear descriptions to each parameter
- Use enums where appropriate
Context Lost Between Turns
Symptoms
- Agent forgets previous messages
- Asks for information already provided
- Doesn’t maintain conversation flow
Solutions
Check Memory Strategy
- Open AI Agent Definition
- Verify
MemoryStrategy__cis set - Try
BufferWindowfor precise context
Increase History Limit
- Raise
HistoryTurnLimit__c(try 10-15) - Balance with token costs
Verify Execution Steps
SELECT Id, UserMessage__c, AssistantMessage__c
FROM ExecutionStep__c
WHERE AgentExecution__c = :executionId
ORDER BY CreatedDate ASC
Ensure steps are being created for each turn.
JSON Parse Errors
Symptoms
- “Invalid JSON” errors
- Capability configuration failures
- Parameter validation errors
Solutions
Validate JSON Use a JSON validator to check:
BackendConfiguration__cParameters__c
Common Issues
{
"field": "value",
}
Trailing commas are not allowed in JSON.
{
"field": "value"
}
{
'field': 'value'
}
JSON requires double quotes, not single quotes.
{
"field": "value"
}
Debug Tips
1. Check Decision Steps
Query AgentDecisionStep__c to see exactly what happened:
SELECT
UserInput__c,
LLMRequest__c,
LLMResponse__c,
ToolCalls__c,
ToolResults__c,
ErrorMessage__c
FROM AgentDecisionStep__c
WHERE AgentExecution__c = :executionId
ORDER BY CreatedDate ASC
2. Enable Debug Logging
- Setup → Debug Logs
- Add your user
- Set levels:
- Apex Code: DEBUG
- Callout: DEBUG
- System: DEBUG
3. Test Capabilities Individually
Use Developer Console or Workbench to test capabilities in isolation:
// Test a capability directly
AgentCapability__c cap = [SELECT Id FROM AgentCapability__c WHERE CapabilityName__c = 'search_contacts'];
Map<String, Object> params = new Map<String, Object>{
'lastName' => 'Smith'
};
// Execute and check results
4. Monitor Token Usage
SELECT
SUM(TokensUsed__c) totalTokens,
COUNT(Id) interactions,
AVG(TokensUsed__c) avgTokens
FROM AgentDecisionStep__c
WHERE CreatedDate = TODAY
GROUP BY AgentExecution__r.AIAgentDefinition__c
5. Check Platform Events
If using High Concurrency mode:
- Setup → Platform Events
- Check event delivery status
- Review any failed deliveries
Getting Help
Before Asking for Help
Gather this information:
- Agent configuration (type, memory, history limit)
- Capability configuration (description, parameters)
- Error messages (exact text)
- Decision step data (if available)
- Debug log excerpts (relevant sections)
Resources
- GitHub Issues - Report bugs
- GitHub Discussions - Ask questions
- Salesforce Developer Forums - General Salesforce help