kailash 0.1.5__py3-none-any.whl → 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. kailash/__init__.py +1 -1
  2. kailash/access_control.py +740 -0
  3. kailash/api/__main__.py +6 -0
  4. kailash/api/auth.py +668 -0
  5. kailash/api/custom_nodes.py +285 -0
  6. kailash/api/custom_nodes_secure.py +377 -0
  7. kailash/api/database.py +620 -0
  8. kailash/api/studio.py +915 -0
  9. kailash/api/studio_secure.py +893 -0
  10. kailash/mcp/__init__.py +53 -0
  11. kailash/mcp/__main__.py +13 -0
  12. kailash/mcp/ai_registry_server.py +712 -0
  13. kailash/mcp/client.py +447 -0
  14. kailash/mcp/client_new.py +334 -0
  15. kailash/mcp/server.py +293 -0
  16. kailash/mcp/server_new.py +336 -0
  17. kailash/mcp/servers/__init__.py +12 -0
  18. kailash/mcp/servers/ai_registry.py +289 -0
  19. kailash/nodes/__init__.py +4 -2
  20. kailash/nodes/ai/__init__.py +2 -0
  21. kailash/nodes/ai/a2a.py +714 -67
  22. kailash/nodes/ai/intelligent_agent_orchestrator.py +31 -37
  23. kailash/nodes/ai/iterative_llm_agent.py +1280 -0
  24. kailash/nodes/ai/llm_agent.py +324 -1
  25. kailash/nodes/ai/self_organizing.py +5 -6
  26. kailash/nodes/base.py +15 -2
  27. kailash/nodes/base_async.py +45 -0
  28. kailash/nodes/base_cycle_aware.py +374 -0
  29. kailash/nodes/base_with_acl.py +338 -0
  30. kailash/nodes/code/python.py +135 -27
  31. kailash/nodes/data/readers.py +16 -6
  32. kailash/nodes/data/writers.py +16 -6
  33. kailash/nodes/logic/__init__.py +8 -0
  34. kailash/nodes/logic/convergence.py +642 -0
  35. kailash/nodes/logic/loop.py +153 -0
  36. kailash/nodes/logic/operations.py +187 -27
  37. kailash/nodes/mixins/__init__.py +11 -0
  38. kailash/nodes/mixins/mcp.py +228 -0
  39. kailash/nodes/mixins.py +387 -0
  40. kailash/runtime/__init__.py +2 -1
  41. kailash/runtime/access_controlled.py +458 -0
  42. kailash/runtime/local.py +106 -33
  43. kailash/runtime/parallel_cyclic.py +529 -0
  44. kailash/sdk_exceptions.py +90 -5
  45. kailash/security.py +845 -0
  46. kailash/tracking/manager.py +38 -15
  47. kailash/tracking/models.py +1 -1
  48. kailash/tracking/storage/filesystem.py +30 -2
  49. kailash/utils/__init__.py +8 -0
  50. kailash/workflow/__init__.py +18 -0
  51. kailash/workflow/convergence.py +270 -0
  52. kailash/workflow/cycle_analyzer.py +768 -0
  53. kailash/workflow/cycle_builder.py +573 -0
  54. kailash/workflow/cycle_config.py +709 -0
  55. kailash/workflow/cycle_debugger.py +760 -0
  56. kailash/workflow/cycle_exceptions.py +601 -0
  57. kailash/workflow/cycle_profiler.py +671 -0
  58. kailash/workflow/cycle_state.py +338 -0
  59. kailash/workflow/cyclic_runner.py +985 -0
  60. kailash/workflow/graph.py +500 -39
  61. kailash/workflow/migration.py +768 -0
  62. kailash/workflow/safety.py +365 -0
  63. kailash/workflow/templates.py +744 -0
  64. kailash/workflow/validation.py +693 -0
  65. {kailash-0.1.5.dist-info → kailash-0.2.0.dist-info}/METADATA +256 -12
  66. kailash-0.2.0.dist-info/RECORD +125 -0
  67. kailash/nodes/mcp/__init__.py +0 -11
  68. kailash/nodes/mcp/client.py +0 -554
  69. kailash/nodes/mcp/resource.py +0 -682
  70. kailash/nodes/mcp/server.py +0 -577
  71. kailash-0.1.5.dist-info/RECORD +0 -88
  72. {kailash-0.1.5.dist-info → kailash-0.2.0.dist-info}/WHEEL +0 -0
  73. {kailash-0.1.5.dist-info → kailash-0.2.0.dist-info}/entry_points.txt +0 -0
  74. {kailash-0.1.5.dist-info → kailash-0.2.0.dist-info}/licenses/LICENSE +0 -0
  75. {kailash-0.1.5.dist-info → kailash-0.2.0.dist-info}/top_level.txt +0 -0
@@ -20,19 +20,19 @@ import json
20
20
  import time
21
21
  import uuid
22
22
  from collections import defaultdict, deque
23
- from datetime import datetime, timedelta
24
- from typing import Any, Dict, List, Optional, Set, Tuple
23
+ from datetime import datetime
24
+ from typing import Any, Dict, List, Optional
25
25
 
26
- from kailash.nodes.ai.a2a import A2AAgentNode, SharedMemoryPoolNode
26
+ from kailash.nodes.ai.a2a import SharedMemoryPoolNode
27
27
  from kailash.nodes.ai.self_organizing import (
28
28
  AgentPoolManagerNode,
29
- ProblemAnalyzerNode,
30
29
  SelfOrganizingAgentNode,
31
30
  SolutionEvaluatorNode,
32
31
  TeamFormationNode,
33
32
  )
34
33
  from kailash.nodes.base import Node, NodeParameter, register_node
35
- from kailash.nodes.mcp.client import MCPClient
34
+
35
+ # MCP functionality is now built into LLM agents as a capability
36
36
 
37
37
 
38
38
  @register_node()
@@ -557,39 +557,33 @@ class MCPAgentNode(SelfOrganizingAgentNode):
557
557
  return result
558
558
 
559
559
  def _setup_mcp_clients(self, servers: List[Dict]):
560
- """Set up MCP clients for configured servers."""
560
+ """Set up MCP clients for configured servers.
561
+
562
+ NOTE: MCP is now a built-in capability of LLM agents. This method
563
+ is deprecated and should be replaced with LLM agents that have
564
+ MCP servers configured directly.
565
+ """
566
+ # TODO: Update this orchestrator to use LLM agents with MCP capabilities
567
+ # For now, we'll just register the servers without creating clients
561
568
  for server_config in servers:
562
569
  server_name = server_config.get("name", "unknown")
563
570
  try:
564
- client = MCPClient()
565
-
566
- # Get available tools
567
- tools_result = client.run(
568
- server_config=server_config, operation="list_tools"
569
- )
571
+ # Instead of creating MCPClient nodes, we now configure LLM agents
572
+ # with MCP server information
573
+ self.mcp_clients[server_name] = {
574
+ "config": server_config,
575
+ "tools": [], # Tools will be discovered by LLM agents
576
+ }
570
577
 
571
- if tools_result.get("success"):
572
- self.mcp_clients[server_name] = {
573
- "client": client,
574
- "config": server_config,
575
- "tools": tools_result.get("tools", []),
576
- }
577
-
578
- # Register tools
579
- for tool in tools_result.get("tools", []):
580
- tool_name = tool["name"]
581
- self.tool_registry[tool_name] = {
582
- "server": server_name,
583
- "description": tool["description"],
584
- "schema": tool.get("inputSchema", {}),
585
- }
578
+ # Tool registry will be populated by LLM agents during execution
579
+ self.logger.info(f"Registered MCP server: {server_name}")
586
580
 
587
581
  except Exception as e:
588
- print(f"Failed to setup MCP client for {server_name}: {e}")
582
+ print(f"Failed to register MCP server {server_name}: {e}")
589
583
 
590
584
  def _enhance_task_with_tools(self, task: str, kwargs: Dict) -> str:
591
585
  """Enhance task description with available tools."""
592
- available_tools = list(self.tool_registry.keys())
586
+ list(self.tool_registry.keys())
593
587
 
594
588
  enhanced = f"{task}\n\nAvailable MCP Tools:\n"
595
589
  for tool_name, tool_info in self.tool_registry.items():
@@ -1241,23 +1235,23 @@ class OrchestrationManagerNode(Node):
1241
1235
  enable_caching = kwargs.get("enable_caching", True)
1242
1236
 
1243
1237
  # Phase 1: Query Analysis
1244
- print(f"🔍 Phase 1: Analyzing query...")
1238
+ print("🔍 Phase 1: Analyzing query...")
1245
1239
  query_analysis = self._analyze_query(query, context, mcp_servers)
1246
1240
 
1247
1241
  # Phase 2: Setup Infrastructure
1248
- print(f"🏗️ Phase 2: Setting up infrastructure...")
1242
+ print("🏗️ Phase 2: Setting up infrastructure...")
1249
1243
  infrastructure = self._setup_infrastructure(
1250
1244
  agent_pool_size, mcp_servers, enable_caching
1251
1245
  )
1252
1246
 
1253
1247
  # Phase 3: Agent Pool Creation
1254
- print(f"🤖 Phase 3: Creating specialized agent pool...")
1248
+ print("🤖 Phase 3: Creating specialized agent pool...")
1255
1249
  agent_pool = self._create_agent_pool(
1256
1250
  query_analysis, infrastructure, mcp_servers
1257
1251
  )
1258
1252
 
1259
1253
  # Phase 4: Iterative Solution Development
1260
- print(f"💡 Phase 4: Beginning solution development...")
1254
+ print("💡 Phase 4: Beginning solution development...")
1261
1255
  solution_history = []
1262
1256
  final_solution = None
1263
1257
 
@@ -1304,7 +1298,7 @@ class OrchestrationManagerNode(Node):
1304
1298
  final_solution = solution_result
1305
1299
  break
1306
1300
  elif not evaluation_result["needs_iteration"]:
1307
- print(f" 🛑 No improvement possible, stopping iteration")
1301
+ print(" 🛑 No improvement possible, stopping iteration")
1308
1302
  final_solution = solution_result
1309
1303
  break
1310
1304
  else:
@@ -1313,7 +1307,7 @@ class OrchestrationManagerNode(Node):
1313
1307
  )
1314
1308
 
1315
1309
  # Phase 5: Final Processing
1316
- print(f"📊 Phase 5: Finalizing results...")
1310
+ print("📊 Phase 5: Finalizing results...")
1317
1311
  final_result = self._finalize_results(
1318
1312
  query,
1319
1313
  final_solution or solution_history[-1]["solution"],
@@ -1372,7 +1366,7 @@ class OrchestrationManagerNode(Node):
1372
1366
  ) -> List[Dict]:
1373
1367
  """Create specialized agent pool based on query analysis."""
1374
1368
  analysis = query_analysis["analysis"]
1375
- required_capabilities = analysis["required_capabilities"]
1369
+ analysis["required_capabilities"]
1376
1370
  team_suggestion = analysis["team_suggestion"]
1377
1371
 
1378
1372
  pool_manager = infrastructure["pool_manager"]
@@ -1900,7 +1894,7 @@ class ConvergenceDetectorNode(Node):
1900
1894
  max_iterations = kwargs.get("max_iterations", 5)
1901
1895
  current_iteration = kwargs.get("current_iteration", 0)
1902
1896
  time_limit = kwargs.get("time_limit_seconds", 3600)
1903
- resource_budget = kwargs.get("resource_budget", 100.0)
1897
+ kwargs.get("resource_budget", 100.0)
1904
1898
 
1905
1899
  if not solution_history:
1906
1900
  return {