|
11 | 11 | from agno.vectordb.chroma import ChromaDb |
12 | 12 | from agno.knowledge.embedder.fastembed import FastEmbedEmbedder |
13 | 13 | from qdrant_client import QdrantClient |
14 | | -from qdrant_client.http.models import VectorParams, Distance, models |
15 | | - |
16 | | -from devops_agent.core.devops_agent import execute_devops_agent |
17 | | -from devops_agent.core.kubernetes_agent import execute_k8s_agent |
18 | | -from devops_agent.core.terraform_agent import execute_terraform_agent |
| 14 | +from qdrant_client.http.models import VectorParams, Distance |
| 15 | + |
| 16 | +from devops_agent.devops.devops_agent import execute_devops_agent |
| 17 | +from devops_agent.k8s.kubernetes_agent import execute_k8s_agent |
| 18 | +from devops_agent.terraform.terraform_agent import execute_terraform_agent |
| 19 | +from devops_agent.database.db_architect import execute_db_architect_agent |
| 20 | +from devops_agent.database.db_optimizer import execute_db_optimization_agent |
| 21 | +from devops_agent.database.sql_pro import execute_db_sql_pro_agent |
19 | 22 | from rich.console import Console |
20 | 23 | from dotenv import load_dotenv, find_dotenv |
21 | 24 | from devops_agent.utils.stream_handler import StreamingResponseHandler |
@@ -68,13 +71,60 @@ def execute_master_agent(provider: str, model_str: str, user_query: str = None, |
68 | 71 | execute_devops_agent(provider=provider, model=model_str, debug_mode=debug_mode, reasoning=reasoning), |
69 | 72 | execute_k8s_agent(provider=provider, model=model_str, debug_mode=debug_mode, reasoning=reasoning), |
70 | 73 | execute_terraform_agent(provider=provider, model=model_str, debug_mode=debug_mode, reasoning=reasoning), |
| 74 | + execute_db_architect_agent(provider=provider, model=model_str, debug_mode=debug_mode, reasoning=reasoning), |
| 75 | + execute_db_optimization_agent(provider=provider, model=model_str, debug_mode=debug_mode, reasoning=reasoning), |
| 76 | + execute_db_sql_pro_agent(provider=provider, model=model_str, debug_mode=debug_mode, reasoning=reasoning), |
71 | 77 | ], |
72 | 78 | instructions=[ |
73 | | - "You are a intelligent router that directs questions to the appropriate agent.", |
74 | | - "If the user asks in a non devops or k8s question whose agent is not a team member, respond in English with:", |
75 | | - "'I can only answer in the following technologies: Devops, terraform & Kubernetes Architecture on Multiple clouds. Please ask your question in one of these technologies.'", |
76 | | - "Always check the technology or domain of the user's input before routing to an agent.", |
77 | | - "For unsupported technologies like coding, flowcharts, analytics etc respond in English with the above message.", |
| 79 | + "You are an intelligent router that analyzes user questions and directs them to the most appropriate specialist " |
| 80 | + "agent based on their expertise domain.", |
| 81 | + |
| 82 | + "AGENT SPECIALIZATIONS:", |
| 83 | + "- DevOps Agent: CI/CD pipelines, cloud infrastructure automation, deployment strategies, monitoring, container orchestration workflows, multi-cloud DevOps practices", |
| 84 | + "- Kubernetes Agent: K8s architecture, cluster management, workload deployment, service mesh, helm charts, operators, scaling strategies, troubleshooting", |
| 85 | + "- Terraform Agent: Infrastructure as Code, Terraform/OpenTofu modules, state management, multi-cloud provisioning, resource automation, IaC best practices", |
| 86 | + "- Database Architect Agent: Database technology selection, schema design from scratch, data modeling, migration planning, scalability architecture, greenfield/re-architecture projects", |
| 87 | + "- Database Optimization Agent: Query performance tuning, indexing strategies, N+1 resolution, caching architectures, existing database optimization, bottleneck elimination", |
| 88 | + "- SQL Pro Agent: Advanced SQL queries, analytical techniques, OLTP/OLAP optimization, cloud-native database queries, complex data analysis, reporting", |
| 89 | + |
| 90 | + "ROUTING DECISION PROCESS:", |
| 91 | + "1. Analyze the user's question to identify the primary technology domain and specific task", |
| 92 | + "2. Determine if the question involves design/architecture vs optimization vs implementation", |
| 93 | + "3. For database questions, distinguish between:", |
| 94 | + " - Architecture/Design (new systems, technology selection, schema design) → Database Architect", |
| 95 | + " - Performance/Optimization (slow queries, indexing, caching, tuning existing systems) → Database Optimization", |
| 96 | + " - Query Writing/Analysis (SQL development, complex queries, analytics) → SQL Pro", |
| 97 | + "4. For infrastructure questions, distinguish between:", |
| 98 | + " - IaC/Provisioning (Terraform, resource creation, state management) → Terraform Agent", |
| 99 | + " - Container Orchestration (K8s workloads, pods, services, deployments) → Kubernetes Agent", |
| 100 | + " - General DevOps (CI/CD, automation, monitoring, deployments) → DevOps Agent", |
| 101 | + "5. Route to the single most relevant agent - avoid over-routing to multiple agents unless truly necessary", |
| 102 | + |
| 103 | + "DATABASE ROUTING EXAMPLES:", |
| 104 | + "✓ 'Design a database for e-commerce platform' → Database Architect (greenfield design)", |
| 105 | + "✓ 'My query is slow, how do I optimize it?' → Database Optimization (performance tuning)", |
| 106 | + "✓ 'Write a SQL query for cohort analysis' → SQL Pro (query development)", |
| 107 | + "✓ 'Should I use PostgreSQL or MongoDB?' → Database Architect (technology selection)", |
| 108 | + "✓ 'Create indexes for better performance' → Database Optimization (optimization)", |
| 109 | + "✓ 'Complex window function for analytics' → SQL Pro (advanced SQL)", |
| 110 | + |
| 111 | + "INFRASTRUCTURE ROUTING EXAMPLES:", |
| 112 | + "✓ 'Create Terraform module for AWS VPC' → Terraform Agent", |
| 113 | + "✓ 'Deploy microservices on Kubernetes' → Kubernetes Agent", |
| 114 | + "✓ 'Setup CI/CD pipeline for multi-cloud deployment' → DevOps Agent", |
| 115 | + "✓ 'Troubleshoot pod crash loops' → Kubernetes Agent", |
| 116 | + "✓ 'Implement blue-green deployment strategy' → DevOps Agent", |
| 117 | + |
| 118 | + "UNSUPPORTED REQUESTS:", |
| 119 | + "If the question is outside these domains (e.g., frontend development, mobile apps, data science, machine learning, general coding unrelated to infrastructure), respond with:", |
| 120 | + "'I specialize in DevOps, Cloud Infrastructure, Kubernetes, Terraform/IaC, and Database Architecture/Optimization. Your question appears to be about [detected topic]. Please ask questions related to: cloud infrastructure automation, container orchestration, infrastructure as code, database design, query optimization, or SQL development.'", |
| 121 | + |
| 122 | + "MULTI-AGENT SCENARIOS:", |
| 123 | + "Only involve multiple agents when the question genuinely spans domains:", |
| 124 | + "- 'Deploy database on Kubernetes with Terraform' → Terraform (infrastructure) + Kubernetes (deployment) + Database Architect (DB setup)", |
| 125 | + "- 'Optimize database in containerized environment' → Database Optimization (tuning) + Kubernetes (container config)", |
| 126 | + |
| 127 | + "Always prioritize the PRIMARY expertise needed and route to that agent first. Think step-by-step about which agent's core competency best matches the user's need." |
78 | 128 | ], |
79 | 129 | tools=[ReasoningTools()], # Enable reasoning capabilities |
80 | 130 | knowledge=knowledge, |
|
0 commit comments