Salesforce Agent
The Salesforce Agent provides an intelligent interface for querying and analyzing Salesforce data. It translates natural language questions into SOQL queries, handles authentication, and processes CRM data while maintaining Salesforce-specific security and optimization.

Salesforce Agent workflow and architecture
Configuration Parameters
Required Input Parameters
- user_question: Natural language query
- salesforce_username: Salesforce login email
- salesforce_password: Salesforce password
- salesforce_security_token: Security token
Optional Configuration
- llm: Language model configuration
- model_name: Model identifier
- temperature: Response creativity
- max_tokens: Response length limit
- query_params: Query configuration
- batch_size: Records per batch
- timeout: Query timeout
- include_deleted: Include deleted records
Output Format
{ "query_results": { "status": "success" | "error", "data": { "records": [ { "Id": string, "attributes": { "type": string, "url": string }, ...fields } ], "totalSize": number, "done": boolean, "nextRecordsUrl": string | null }, "metadata": { "object_type": string, "fields_queried": array, "filters_applied": array, "batch_info": { "current_batch": number, "total_batches": number, "records_processed": number } } }, "query_message": { "natural_query": string, "generated_soql": string, "execution_time": number, "analysis": { "summary": string, "key_insights": array, "suggested_actions": array }, "performance_metrics": { "api_calls": number, "data_volume": string, "query_optimization": { "indexes_used": array, "suggestions": array } } } }
Features
- Natural language to SOQL translation
- Secure authentication handling
- Batch processing
- Query optimization
- Field-level security
- Relationship queries
- Performance monitoring
- Data analysis
Note: Be mindful of API limits and batch sizes. Use selective queries to optimize performance and reduce API consumption.
Tip: Specify required fields explicitly in queries. Use relationship queries judiciously to minimize API calls.
Example Usage
const salesforceAgent = new SalesforceAgent({ salesforce_username: "user@example.com", salesforce_password: "****", salesforce_security_token: "YOUR_SECURITY_TOKEN", llm: { model_name: "gpt-4", temperature: 0.3 }, query_params: { batch_size: 2000, timeout: 30000, include_deleted: false } }); const response = await salesforceAgent.query({ user_question: "Show me all opportunities closed last quarter with value over $100k" });