Multi-agent system for EPLAN scripting automation using natural language. Built with Google's Agent Development Kit and powered by an advanced RAG system.
β οΈ Status: stand-by
- Natural Language Interface - Describe what you want, get working code
- Intelligent Orchestration - Coordinator routes tasks to specialized agents
- Code Generation - Transform requirements into EPLAN C# scripts
- Validation & Security - Automatic syntax and security checks
- Direct Execution - Run scripts via EPLAN Remoting
- Plug & Play - Works immediately without setup
- Hybrid Search - BM25 keyword + optional vector search + Cross-Encoder re-ranking
- Smart Chunking - Handles long documents with overlap
- Offline-First - No internet required after initial clone
- Corporate-Friendly - Works behind firewalls and VPNs
- 606 API Docs + 70 Script Examples indexed and searchable
- Python 3.10+
- EPLAN 2023+ Electric P8 (for execution)
# Clone repository
git clone <repo>
cd LazyScriptingEplan
# Install dependencies
pip install -r requirements.txt
# Run the system
adk webAccess at http://localhost:8000
Create eplan_coordinator/.env:
# Add your API keys here
GOOGLE_API_KEY=your_key_here"Generate a script to export project data to PDF"
"Find documentation for ProjectManager class"
"Create a script to backup all project settings"
"Validate this script for security issues"
"How do I access device properties in EPLAN API?"
from src.ai.optimized_rag import OptimizedScriptRAG
from src.ai.documentation_rag import OptimizedDocumentationRAG
# Search script examples
script_rag = OptimizedScriptRAG()
results = script_rag.search_scripts("how to open a project", top_k=3)
# Search API documentation
doc_rag = OptimizedDocumentationRAG()
results = doc_rag.search_documentation("Action.Execute method", top_k=5)βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User Natural Language Query β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
β
ββββββββββΌβββββββββ
β Coordinator β (Main orchestrator)
β Agent β
ββββββββββ¬βββββββββ
β
ββββββββββββββββΌβββββββββββββββ
β β β
βββββββββΌββββββββ βββββΌβββββ ββββββββΌβββββββ
β Knowledge β βExamplesβ β CodeCraft β
β Agent β βAgent β β Agent β
β (API Docs) β β(Scripts)β β (Generator) β
βββββββββ¬ββββββββ βββββ¬βββββ ββββββββ¬βββββββ
β β β
βββββββββββββββΌβββββββββββββββ
β
βββββββββββββββΌβββββββββββββββ
β Validation Agent β
β (Syntax + Security) β
βββββββββββββββ¬βββββββββββββββ
β
βββββββββββββββΌβββββββββββββββ
β Execution Agent β
β (EPLAN Remoting) β
ββββββββββββββββββββββββββββββ
| Agent | Purpose | Technology |
|---|---|---|
| Coordinator | Task routing and orchestration | Google ADK |
| Knowledge Agent | API documentation search | RAG (606 docs) |
| Examples Agent | Script pattern matching | RAG (70 examples) |
| CodeCraft Agent | C# code generation | LLM + Templates |
| Validation Agent | Security & syntax checks | AST parsing |
| Execution Agent | EPLAN integration | .NET Remoting |
- Works immediately, zero setup
- Keyword-based search
- 100% offline
- Fast: 5ms per query
- BM25 + Vector embeddings (FAISS)
- Semantic understanding
- 10-15% better results
- Requires one-time model download
- Hybrid search + Cross-Encoder re-ranking
- Maximum precision for complex queries
- 15-25% better results than hybrid alone
- Two-stage: 20 candidates β top 5 results
# Optional: Download embedding model for hybrid mode
python setup_embedding_model.pySee RAG_SETUP_GUIDE.md for detailed setup and PHASE4_RERANKING.md for re-ranking implementation details.
LazyScriptingEplan/
βββ eplan_coordinator/ # Main orchestrator agent
β βββ __init__.py
β βββ .env # Configuration (create this)
β
βββ src/
β βββ ai/ # RAG System
β β βββ optimized_rag.py # Core RAG with re-ranking
β β βββ documentation_rag.py # Documentation search
β β βββ Knowledge/
β β β βββ eplan_docs/ # 606 API markdown files
β β β βββ Scripts/ # 70 script examples
β β βββ cache/ # Auto-generated indexes
β β βββ models/ # Optional: embedding models
β β
β βββ sub_agents/ # Specialized agents
β βββ knowledge_agent/ # API documentation
β βββ examples_agent/ # Script examples
β βββ codecraft_agent/ # Code generation
β βββ validation_agent/ # Security checks
β βββ execution_agent/ # EPLAN integration
β
βββ requirements.txt # Python dependencies
βββ setup_embedding_model.py # Optional: Model download
βββ test_rag.py # RAG testing
β
βββ Documentation/
βββ README.md # This file
βββ RAG_SETUP_GUIDE.md # RAG setup details
βββ PHASE4_RERANKING.md # Re-ranking implementation
- Smart Chunking: Long documents β 400-word chunks with 50-word overlap
- Tokenization: Regex-based with stopword removal
- RRF Fusion: Combines vector and keyword search results
- Cross-Encoder Re-ranking: Two-stage retrieval for maximum precision
- Automatic Fallback: Gracefully degrades if models unavailable
- Dynamic Tool Selection: Agents choose appropriate tools automatically
- Error Recovery: Validates and retries failed operations
- Context Preservation: Maintains conversation history
- Security: Sandboxed execution and code validation
| Metric | Value |
|---|---|
| Documents Indexed | 676 (606 docs + 70 examples) |
| Chunks Created | ~800-1000 |
| Search Speed | 5-250ms (mode dependent) |
| Index Build | 30-60s (first run only) |
| Memory Usage | 50-280MB (mode dependent) |
| Mode | Improvement | Speed |
|---|---|---|
| BM25-only | Baseline | 5ms |
| Hybrid | +10-15% | 5-50ms |
| Hybrid + Re-ranking | +25-40% | 55-250ms |
# Test RAG system (BM25, Hybrid, Re-ranking)
python test_rag.py
# Test specific agents (coming soon)
pytest tests/The system is designed to be extensible:
# Create new agent in src/sub_agents/your_agent/
from google import genai
your_agent = genai.Agent(
model="gemini-2.0-flash-exp",
tools=[your_tools],
system_instruction="Your agent's role"
)# Add new document sources
class CustomRAG(OptimizedRAG):
def _build_from_files(self):
# Your indexing logic
pass# Add tools to agents
@tool
def your_custom_tool(param: str) -> str:
"""Tool description"""
return result- EPLAN Examples: Suplanus
- Framework: Google Agent Development Kit (ADK)
- RAG Components:
- FAISS - Facebook AI Similarity Search
- BM25 - Best Match 25 algorithm
- sentence-transformers - Embedding models
- Cross-Encoder - ms-marco-MiniLM-L-6-v2
- RAG Setup Guide - Detailed RAG configuration
- Phase 4 Re-ranking - Technical implementation details