Skip to content

KirtiJha/langgraph-salesforce-code-agent

Repository files navigation

ISC-CodeConnect: Multi-Agent RAG Salesforce Code Assistant

Overview

ISC-CodeConnect is a sophisticated multi-agent Retrieval-Augmented Generation (RAG) system specifically designed for Salesforce development. Built with LangGraph and powered by IBM WatsonX.ai Granite models, it orchestrates a network of specialized AI agents to provide intelligent code analysis, generation, and testing support for Apex classes, triggers, and Lightning Web Components (LWC).

�️ System Architecture

ISC-CodeConnect employs a Langgraph Agent Orchestration System with persistent memory and advanced routing capabilities:

Core Agent Workflow

  1. Supervisor Agent - Breaks down complex queries into executable stages
  2. Router Agent - Analyzes and routes queries to specialized agents based on operation and code type
  3. Context Analyzer Agent - Prepares optimal retrieval contexts for vector search
  4. Retriever Agent - Performs parallel context-aware retrieval from vector collections
  5. Research Agent - Conducts detailed analysis and creates execution roadmaps
  6. Specialized Code Agents - Handle specific operations (create, modify, explain)

Knowledge Base

  • Vector Database: IBM CIO hosted Milvus with 5 specialized collections
    • apex_code - Apex classes and triggers
    • apex_test_code - Apex test classes
    • lwc_html_code - LWC HTML templates
    • lwc_js_code - LWC JavaScript controllers
    • lwc_test_code - LWC Jest test files
  • Connection Management: Singleton connection pooling with round-robin distribution
  • Source Repositories: PRM, Global-Schema, Global-Core, Sales, Sirion-Schema

🤖 Specialized Agent Capabilities

Apex Test Generation Pipeline

Multi-step test generation with dedicated agents:

  • Test Planner Agent - Plans comprehensive test strategies
  • Setup Generator Agent - Creates test data setup code
  • Stub Generator Agent - Handles mocking and stubbing
  • Test Method Generator Agent - Generates test methods in batches
  • Apex Test Generator Agent - Combines and finalizes test code

LWC Generation Pipeline

Complete component generation workflow:

  • LWC HTML Generator Agent - Creates component templates
  • LWC JS Generator Agent - Develops JavaScript controllers
  • LWC Apex Controller Agent - Builds backend Apex controllers
  • LWC Generator Agent - Summarizes and integrates components

Additional Specialized Agents

  • Follow-up Handler Agent - Enhances multi-turn conversations
  • General Query Processor Agent - Fallback for complex queries
  • Chat Handler Agent - Manages greetings and confirmations
  • Error Handler Agent - Provides user-friendly error messages
  • Chat Title Agent - Generates contextual chat titles

🌟 Advanced Features

Memory & Persistence

  • Session Memory - LangGraph Checkpointer with MemorySaver
  • Persistent Memory - MongoDB on IBM Cloud for chat history
  • Multi-turn Conversations - Context-aware follow-up handling

Intelligent Processing

  • Parallel Retrieval - Simultaneous context queries across collections using batch processing
  • Connection Pooling - IBM CIO Milvus connection management with health monitoring
  • Hallucination Reduction - Fact grounding through research agents
  • Context-Aware Generation - Leverages existing codebase patterns
  • Error Recovery - Graceful fallback mechanisms with intelligent routing

🛠 Tech Stack

Backend

  • Python 3.12+ - Core runtime
  • LangGraph - Multi-agent orchestration
  • LangChain - LLM framework
  • IBM WatsonX.ai - Granite model inference
  • Milvus - IBM CIO hosted vector database with connection pooling
  • MongoDB - Persistent memory storage

Frontend

  • Next.js 14 - React framework
  • IBM Carbon Design System - UI components
  • TypeScript - Type safety

Infrastructure

  • IBM Cloud - Hosting and services
  • RESTful APIs - Service communication

📋 Prerequisites

System Requirements

  • Python 3.12+ with pip
  • Node.js 18+ with npm/yarn
  • 4GB RAM minimum (8GB recommended)
  • 2GB disk space for dependencies

Required Credentials

  • IBM WatsonX.ai API credentials
  • IBM CIO Milvus Service connection details
  • MongoDB connection string

🚀 Quick Start

Backend Setup

  1. Clone and Environment Setup:
git clone https://github.ibm.com/BPManagementTools/isc-code-connect-agent.git
cd isc-code-connect-agent
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
  1. Environment Configuration:
cp .env.example .env

Edit .env with your credentials: Environment details are shared in 1Password vault.

  1. Start Backend Services:
chmod +x dev.sh
./dev.sh

📁 Project Structure

isc-code-connect-agent/
├── src/                           # Core application code
│   ├── agents/                    # Specialized agent implementations
│   │   ├── supervisor_agent.py    # Main orchestration agent
│   │   ├── enhanced_route_query.py # Query routing logic
│   │   ├── unified_query_analysis.py # Query analysis
│   │   ├── research_agent.py      # Research and planning
│   │   ├── test_agents.py         # Test generation pipeline
│   │   └── generator_agents.py    # LWC generation agents
│   ├── retrievers/                # Vector database components
│   │   ├── factory.py             # Retriever factory pattern
│   │   ├── milvus_manager.py      # Connection management
│   │   └── base.py                # Base retriever classes
│   ├── core/                      # Core system components
│   │   ├── memory/                # Memory management
│   │   ├── llm.py                 # LLM integration
│   │   └── types.py               # Type definitions
│   ├── config/                    # Configuration management
│   ├── prompts/                   # Agent prompt templates
│   └── utils/                     # Utility functions
├── api/                           # REST API endpoints
├── frontend/                      # Next.js frontend application
├── tests/                         # Test suites
├── deploy/                        # Deployment configurations
└── docs/                          # Comprehensive documentation
    ├── agents/                    # Agent-specific documentation
    ├── architecture/              # System architecture
    ├── api/                       # API reference
    ├── vector-db/                 # Vector database setup
    ├── development/               # Development guides
    └── user-guide/                # User documentation

🔧 Development Guide

Vector Database Collections

Each collection stores chunked and embedded code:

Collection Content Usage
apex_code Apex classes, triggers Code analysis, generation
apex_test_code Test classes Test generation patterns
lwc_html_code LWC templates UI component generation
lwc_js_code JavaScript controllers Logic implementation
lwc_test_code Jest test files Frontend test generation

Memory Management

  • Session Memory: Temporary conversation state using LangGraph Checkpointer and MemorySaver
  • Persistent Memory: Long-term chat history in MongoDB
  • Context Memory: Retrieved code snippets and analysis

📊 Monitoring & Observability

  • Agent Performance: Response times and success rates
  • Memory Usage: Session and persistent memory metrics
  • Vector Search: Retrieval accuracy and relevance scores
  • Error Tracking: Comprehensive error logging and analysis

🔒 Security & Best Practices

Security Measures

  • API Key Management: Secure credential storage
  • Input Validation: Query sanitization and validation
  • Access Control: Role-based permissions
  • Code Review: Generated code security scanning

Best Practices

  • Prompt Engineering: Optimized prompts for each agent
  • Context Management: Efficient memory usage
  • Error Handling: Graceful degradation
  • Performance: Parallel processing where possible

🤝 Contributing

We welcome contributions to ISC-CodeConnect! Please follow these guidelines:

Getting Started

  1. Fork the repository
  2. Clone your fork locally
  3. Create a feature branch: git checkout -b feature/amazing-feature
  4. Set up development environment (see Quick Start)

Development Workflow

  1. Make Changes: Implement your feature or fix
  2. Test Thoroughly: Run all test
  3. Follow Standards: Use consistent coding style
  4. Document: Update relevant documentation
  5. Commit: Use conventional commit messages
  6. Push: Push to your feature branch
  7. Pull Request: Create a detailed PR

Code Standards

  • Python: Follow PEP 8 guidelines
  • TypeScript: Use ESLint and Prettier
  • Documentation: Include docstrings and comments
  • Testing: Maintain >80% test coverage

Agent Development Guidelines

  • Single Responsibility: Each agent should have a clear purpose
  • Error Handling: Implement robust error handling
  • Memory Efficiency: Optimize context usage
  • Prompt Engineering: Use clear, specific prompts

Pull Request Process

  1. Ensure all tests pass
  2. Update documentation
  3. Add relevant labels
  4. Request review from maintainers
  5. Address feedback promptly

📚 Documentation

Comprehensive Documentation Available

  • Complete Agent System: All agents documented with workflows and pipelines
  • Vector Database Integration: IBM CIO Milvus setup and connection management
  • API Reference: Session-based FastAPI endpoints
  • Architecture Guide: System overview and component interactions

Key Documentation

Agent-Specific Documentation

Performance Optimization

  • Parallel Processing: Enable parallel retrieval
  • Cache Management: Configure response caching
  • Memory Cleanup: Regular session cleanup
  • Vector Search: Optimize search parameters

� Versioning & Releases

Current Version

  • v1.2.0 - July 2025
  • Latest Stable: v1.1.5
  • LTS Version: v1.0.8

Release Process

  1. Feature Freeze: Two weeks before release
  2. Testing Phase: Comprehensive testing
  3. Documentation: Update all documentation
  4. Release Notes: Detailed changelog
  5. Deployment: Staged rollout

Changelog Highlights

  • v1.2.0: Enhanced multi-turn conversations, improved error handling
  • v1.1.0: LWC generation pipeline, performance optimizations
  • v1.0.0: Initial multi-agent system, core RAG functionality

📞 Support & Community

Getting Help

Contributing to Documentation

  • Found an Error?: Submit a documentation issue
  • Want to Help?: Contribute to /docs/
  • Translation?: Contact maintainers

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

Third-Party Licenses

  • LangGraph: MIT License
  • IBM WatsonX.ai: Commercial License
  • Milvus: Apache 2.0 License
  • MongoDB: SSPL License

🙏 Acknowledgments

  • IBM Research for WatsonX.ai integration
  • IBM CIO Team for Milvus hosting and support
  • LangChain Community for the foundation framework
  • Milvus Team for vector database capabilities
  • Salesforce Developers for use case validation
  • Contributors who make this project possible

Built with ❤️ by the ISC-CodeConnect Team

For enterprise support and custom implementations, contact: isc-codeconnect@ibm.com

About

ISC-CodeConnect is a sophisticated multi-agent Retrieval-Augmented Generation (RAG) system specifically designed for Salesforce development. Built with LangGraph and powered by IBM WatsonX.ai Granite models, it orchestrates a network of specialized AI agents .

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors