Skip to content

tsmztech/sf_agents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Salesforce AI Agent System

An intelligent lightweight AI agent system that transforms high-level business requirements into detailed Salesforce implementation plans through natural language conversation. Built with a custom agent framework optimized for deployment and performance.

Deploy to Streamlit Cloud Python 3.11+ OpenAI Streamlit

πŸš€ Quick Start

πŸ“Ί Live Demo

Try the application online β†’ (Replace with your actual deployment URL)

πŸ’» Local Development

git clone https://github.com/yourusername/sf_agents.git
cd sf_agents
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
streamlit run app.py

🎯 Project Overview

This system uses a collaborative team of lightweight AI agents to automate the journey from business requirements to Salesforce configurations. The application provides an intelligent, conversational interface for planning Salesforce implementations with minimal dependencies and maximum performance.

Key Features

  • πŸ€– Lightweight Agent Framework: Custom agent system built directly on OpenAI API
  • 🎯 Specialized Agents: Schema Expert, Technical Architect, and Dependency Resolver
  • πŸ”— Real-time Salesforce Integration: Live connection to your Salesforce org
  • πŸ’‘ Smart Requirement Enhancement: Automatically identifies and fills gaps
  • πŸ’¬ Natural Language Interface: Streamlit-based GUI for seamless interaction
  • 🧠 Persistent Memory: Conversation history and context retention
  • πŸ“‹ Automated Planning: Structured Salesforce implementation plans
  • πŸ”§ User Choice Workflow: Accept, modify, or skip expert suggestions
  • πŸ“Š Session Management: Save, load, and export conversation sessions
  • πŸ”„ Enhanced Conversations: Clarification β†’ Expert Analysis β†’ Suggestions β†’ Planning
  • ⚑ Fast Deployment: Minimal dependencies for quick cloud deployment

πŸ—οΈ Architecture

The system uses a lightweight, custom agent framework designed for deployment efficiency:

sf_agents/
β”œβ”€β”€ agents/                       # AI Agent modules
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ simple_agent.py          # Lightweight OpenAI wrapper
β”‚   β”œβ”€β”€ memory_manager.py        # Conversation memory & persistence
β”‚   β”œβ”€β”€ master_agent.py          # Main orchestrator agent
β”‚   β”œβ”€β”€ salesforce_expert_agent.py # Schema and database expert
β”‚   β”œβ”€β”€ technical_architect_agent.py # Technical design specialist
β”‚   β”œβ”€β”€ dependency_resolver_agent.py # Task and dependency creator
β”‚   └── salesforce_connector.py  # Real-time Salesforce integration
β”œβ”€β”€ data/                        # Data storage
β”‚   β”œβ”€β”€ conversation_history/    # Session conversation logs
β”‚   └── implementation_plans/    # Generated implementation plans
β”œβ”€β”€ app.py                       # Main Streamlit application
β”œβ”€β”€ config.py                    # Configuration management
└── requirements.txt             # Minimal dependencies

πŸš€ Quick Start

Prerequisites

  • Python 3.8+
  • OpenAI API key
  • Virtual environment (recommended)

Installation

  1. Clone and navigate to the project:

    cd sf_agents
  2. Activate your virtual environment:

    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Configure environment variables:

    Create a .env file in the project root:

    OPENAI_API_KEY=your_openai_api_key_here
    DEBUG=True
    LOG_LEVEL=INFO
  5. Run the application:

    streamlit run app.py
  6. Open your browser: Navigate to http://localhost:8501

πŸ“– Usage Guide

Starting a Conversation

  1. Enter your business requirement in natural language

    • Example: "We need a customer support ticketing system"
    • Example: "Create a lead management process for our sales team"
  2. Engage with clarification questions

    • The agent will ask follow-up questions to understand your needs
    • Provide detailed responses about business goals, user roles, data requirements
  3. Confirm and generate plan

    • Once the agent has sufficient information, confirm to proceed
    • Receive a comprehensive Salesforce implementation plan

Enhanced Conversation Flow

πŸ‘€ User: "We need a customer support ticketing system"

πŸ€– Master Agent: "I'll help you design a customer support ticketing system! 
                 Let me understand your core business needs first..."

πŸ‘€ User: [Provides basic information about business goals]

πŸ€– Master Agent: "Great! I have the core requirements. Let me consult with 
                 our Salesforce Expert Agent to identify any gaps and 
                 suggest enhancements..."

πŸ” Expert Analysis: [Identifies missing security, integration, and UX considerations]

πŸ€– Master Agent: "Our expert identified several valuable enhancements:
                 - Security permissions and field-level access
                 - Integration with email systems  
                 - Mobile-friendly interface design
                 - Automated escalation workflows
                 
                 Would you like to include these suggestions?"

πŸ‘€ User: "Accept the security and integration suggestions"

πŸ€– Master Agent: [Generates comprehensive implementation plan with selected enhancements]

Key Enhancement: You no longer need to think of every detail upfront - the Expert Agent fills gaps with industry best practices!

Implementation Plan Components

The generated plans include:

  • πŸ“‹ Executive Summary: Business requirement overview
  • πŸ—οΈ Salesforce Components: Custom objects, fields, relationships
  • βš™οΈ Development Components: Apex classes, triggers, LWC components
  • πŸ€– Automation: Flows, process builders, validation rules
  • πŸ” Security: Permission sets, profiles, sharing rules
  • πŸ”— Integration: External systems, APIs, data migration
  • πŸ“… Implementation Phases: Timeline and dependencies
  • πŸ§ͺ Testing Strategy: Unit, integration, and UAT approaches

πŸ”§ Configuration

Environment Variables

Variable Description Required
OPENAI_API_KEY Your OpenAI API key βœ… Yes
DEBUG Enable debug mode No (default: True)
LOG_LEVEL Logging level No (default: INFO)

Advanced Configuration

Edit config.py to customize:

  • Data storage paths
  • Model parameters
  • Agent behavior settings

πŸ’Ύ Data Management

Session Persistence

  • Automatic saving: All conversations are automatically saved
  • Session IDs: Unique identifiers for each conversation
  • History loading: Resume previous conversations anytime

Export Options

  • Conversation Export: Download complete conversation history as JSON
  • Implementation Plans: Export generated plans for documentation
  • Session Management: Load, create, or switch between sessions

🧠 Agent Capabilities

Master Agent Features

  • Requirement Analysis: Understands complex business needs
  • Expert Collaboration: Works with specialized agents for enhanced solutions
  • Intelligent Clarification: Asks relevant follow-up questions
  • Salesforce Expertise: Deep knowledge of platform capabilities
  • Structured Planning: Creates actionable implementation roadmaps
  • Context Retention: Maintains conversation memory throughout sessions

Expert Agent Capabilities

  • Gap Analysis: Identifies missing requirements automatically
  • Best Practice Recommendations: Suggests industry-standard approaches
  • Architecture Validation: Reviews solutions for scalability and performance
  • Security Assessment: Ensures proper permission and security models
  • Integration Guidance: Recommends optimal integration patterns
  • Industry Expertise: Provides sector-specific recommendations
  • Risk Mitigation: Identifies and prevents common implementation issues

Conversation States

  1. Initial: First requirement submission
  2. Clarifying: Gathering core business information
  3. Expert Analysis: AI expert identifying gaps and enhancements
  4. Suggestions Review: User choosing which expert recommendations to include
  5. Planning: Ready to generate implementation plan
  6. Completed: Plan generated with expert enhancements, follow-up supported

πŸ› οΈ Development

Project Structure

  • agents/master_agent.py: Core AI agent logic
  • agents/memory_manager.py: Conversation persistence
  • app.py: Streamlit user interface
  • config.py: Configuration management

Extending the System

For future phases, the architecture supports:

  • Additional specialized agents
  • Salesforce API integration
  • Automated deployment capabilities
  • Multi-agent collaboration workflows

πŸ“ Example Requirements

Try these sample requirements to test the system:

Simple Requirements

  • "Create a basic contact management system"
  • "Set up opportunity tracking for sales"
  • "Build a simple case management solution"

Complex Requirements

  • "Design a multi-stage approval process for purchase orders with budget controls and automated notifications"
  • "Create an inventory management system with automated reordering, vendor integration, and cost tracking"
  • "Build a customer onboarding workflow with document collection, approval stages, and integration with external systems"

πŸ” Troubleshooting

Common Issues

  1. OpenAI API Key Error

    • Ensure your API key is correctly set in the .env file
    • Verify you have sufficient API credits
  2. Import Errors

    • Make sure all dependencies are installed: pip install -r requirements.txt
    • Verify you're using the correct virtual environment
  3. Streamlit Issues

    • Clear browser cache and refresh
    • Check the terminal for detailed error messages

Debug Mode

Enable debug mode in your .env file:

DEBUG=True

This provides detailed error traces and additional logging.

πŸš€ Next Phases

Phase 2 (Planned):

  • Specialized agent team (Security, Integration, UI/UX agents)
  • Salesforce API integration
  • Automated metadata generation

Phase 3 (Planned):

  • Automated deployment to Salesforce orgs
  • Real-time collaboration between agents
  • Advanced testing and validation

πŸ“„ License

This project is built for demonstration and educational purposes.

🀝 Contributing

This is a demonstration project. For questions or suggestions, please refer to the project documentation.


🌐 Deployment

Streamlit Community Cloud (Free)

  1. Fork this repository
  2. Visit share.streamlit.io
  3. Connect your GitHub account
  4. Select this repository
  5. Deploy automatically

Railway ($5/month)

  1. Visit railway.app
  2. Connect your GitHub account
  3. Deploy this repository
  4. Set environment variables in Railway dashboard

Heroku

  1. Create Heroku app
  2. Connect GitHub repository
  3. Set environment variables
  4. Deploy from Heroku dashboard

See deployment-guide.md for detailed instructions.

πŸ”§ Configuration

Production Mode (Default)

  • App shows configuration popup for API keys
  • No environment variables needed
  • Perfect for end users

Development Mode

  • Set USE_ENV_CONFIG=True in .env
  • Uses environment variables directly
  • Perfect for development/testing

πŸ” Security

  • βœ… No sensitive data in code
  • βœ… Environment variables properly ignored
  • βœ… In-app credential collection
  • βœ… Secure API key handling

πŸ“ Project Structure

sf_agents/
β”œβ”€β”€ app.py                          # Main Streamlit application
β”œβ”€β”€ config.py                       # Configuration management
β”œβ”€β”€ requirements.txt                # Python dependencies
β”œβ”€β”€ Procfile                        # Heroku deployment
β”œβ”€β”€ runtime.txt                     # Python version
β”œβ”€β”€ railway.json                    # Railway deployment
β”œβ”€β”€ .streamlit/config.toml          # Streamlit configuration
β”œβ”€β”€ agents/                         # AI agent modules
β”‚   β”œβ”€β”€ master_agent.py             # Main orchestration agent
β”‚   β”œβ”€β”€ salesforce_expert_agent.py  # Schema specialist agent
β”‚   β”œβ”€β”€ technical_architect_agent.py # Architecture design agent
β”‚   β”œβ”€β”€ dependency_resolver_agent.py # Task planning agent
β”‚   β”œβ”€β”€ memory_manager.py           # Conversation memory
β”‚   └── salesforce_connector.py     # Salesforce API integration
└── data/                           # Data storage
    β”œβ”€β”€ conversation_history/       # Chat sessions
    └── implementation_plans/       # Generated plans

πŸ‘¨β€πŸ’» Author

Tapas Mukherjee
AI Engineer & Salesforce Specialist


Built with ❀️ using a lightweight agent framework, Streamlit, and OpenAI

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages