agentops-cockpit 0.3.0__py3-none-any.whl → 0.4.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.
@@ -1,35 +1,80 @@
1
- from typing import List, Dict, Any
1
+ from typing import List, Dict, Any, Optional
2
2
  import asyncio
3
+ import json
4
+ import os
5
+ from mcp import ClientSession, StdioServerParameters
6
+ from mcp.client.stdio import stdio_client
3
7
 
4
8
  class MCPHub:
5
9
  """
6
10
  Model Context Protocol (MCP) Hub.
7
- Optimizes tool discovery, execution, and cost across multiple providers.
11
+ Provides a unified interface for tool discovery and execution across
12
+ multiple MCP servers (Google Search, SQL, internal tools).
8
13
  """
9
14
 
10
15
  def __init__(self):
16
+ self.servers: Dict[str, StdioServerParameters] = {}
11
17
  self.registry = {
12
- "search": {"type": "mcp", "provider": "google-search", "status": "optimized"},
13
- "db": {"type": "mcp", "provider": "alloydb-vector", "status": "optimized"},
14
- "legacy_crm": {"type": "rest_api", "provider": "internal", "status": "deprecated"}
18
+ "search": {"type": "mcp", "provider": "google-search", "server": "google-search-mcp"},
19
+ "db": {"type": "mcp", "provider": "alloydb", "server": "postgres-mcp"},
20
+ "legacy_crm": {"type": "rest", "provider": "internal", "status": "deprecated"}
15
21
  }
16
22
 
17
- async def execute_tool(self, tool_name: str, args: Dict[str, Any]):
23
+ def register_server(self, name: str, command: str, args: List[str] = None):
24
+ """Registers a local MCP server."""
25
+ self.servers[name] = StdioServerParameters(
26
+ command=command,
27
+ args=args or [],
28
+ env=os.environ.copy()
29
+ )
30
+
31
+ async def execute_tool(self, tool_name: str, arguments: Dict[str, Any]):
18
32
  """
19
- Executes a tool via MCP if available, else falls back to legacy.
20
- Logs metrics for the Flight Recorder.
33
+ Executes a tool call using the Model Context Protocol.
21
34
  """
22
35
  if tool_name not in self.registry:
23
- raise ValueError(f"Tool {tool_name} not found in MCP Registry.")
24
-
36
+ raise ValueError(f"Tool {tool_name} not found in MCP registry.")
37
+
25
38
  config = self.registry[tool_name]
26
39
 
27
- if config["status"] == "deprecated":
28
- print(f"⚠️ WARNING: Using legacy Tool API for '{tool_name}'. Migrate to MCP for 30% lower latency.")
29
-
30
- print(f"🛠️ Executing tool '{tool_name}' via {config['type']} protocol...")
31
- await asyncio.sleep(0.1) # Simulating execution
32
-
33
- return {"result": f"Data from {tool_name}", "protocol": config["type"]}
40
+ # If it's a legacy tool, handle it separately
41
+ if config["type"] == "rest":
42
+ print(f"⚠️ Executing legacy REST tool: {tool_name}")
43
+ return await self._mock_legacy_exec(tool_name, arguments)
44
+
45
+ server_name = config.get("server")
46
+ if not server_name or server_name not in self.servers:
47
+ # Fallback to mock for demo/unconfigured environments
48
+ print(f"ℹ️ MCP Server '{server_name}' not configured. Running in simulated mode.")
49
+ return await self._mock_mcp_exec(tool_name, arguments)
50
+
51
+ # Real MCP Protocol Execution
52
+ async with stdio_client(self.servers[server_name]) as (read, write):
53
+ async with ClientSession(read, write) as session:
54
+ await session.initialize()
55
+ result = await session.call_tool(tool_name, arguments)
56
+ return {
57
+ "result": result.content,
58
+ "protocol": "mcp-v1",
59
+ "server": server_name
60
+ }
61
+
62
+ async def _mock_mcp_exec(self, tool_name: str, args: Dict[str, Any]):
63
+ await asyncio.sleep(0.2)
64
+ return {
65
+ "result": f"Simulated MCP response for {tool_name}",
66
+ "protocol": "mcp-virtual",
67
+ "assurance": 0.95
68
+ }
69
+
70
+ async def _mock_legacy_exec(self, tool_name: str, args: Dict[str, Any]):
71
+ await asyncio.sleep(0.5)
72
+ return {
73
+ "result": f"Legacy response for {tool_name}",
74
+ "protocol": "rest-legacy",
75
+ "warning": "MIGRATE_TO_MCP"
76
+ }
34
77
 
35
78
  global_mcp_hub = MCPHub()
79
+ # Example registration (commented out as it requires local binaries)
80
+ # global_mcp_hub.register_server("google-search-mcp", "npx", ["-y", "@modelcontextprotocol/server-google-search"])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentops-cockpit
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Production-grade Agent Operations (AgentOps) Platform
5
5
  Project-URL: Homepage, https://github.com/enriquekalven/agent-ops-cockpit
6
6
  Project-URL: Bug Tracker, https://github.com/enriquekalven/agent-ops-cockpit/issues
@@ -11,6 +11,7 @@ Classifier: Operating System :: OS Independent
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.10
13
13
  Requires-Dist: gitpython>=3.1.0
14
+ Requires-Dist: mcp>=0.1.0
14
15
  Requires-Dist: rich>=13.0.0
15
16
  Requires-Dist: typer>=0.9.0
16
17
  Description-Content-Type: text/markdown
@@ -18,10 +19,20 @@ Description-Content-Type: text/markdown
18
19
  # 🕹️ AgentOps Cockpit
19
20
 
20
21
  <div align="center">
22
+ <img src="https://raw.githubusercontent.com/enriquekalven/agent-cockpit/main/public/og-image.png" alt="AgentOps Cockpit Social Preview" width="100%" />
23
+ </div>
24
+
25
+ <div align="center">
26
+ <br />
27
+ <a href="https://deploy.cloud.google.com?repo=https://github.com/enriquekalven/agent-cockpit">
28
+ <img src="https://deploy.cloud.google.com/button.svg" alt="Deploy to Google Cloud" />
29
+ </a>
30
+ <br />
31
+ <br />
21
32
  <img src="https://img.shields.io/github/stars/enriquekalven/agent-cockpit?style=for-the-badge&color=ffd700" alt="GitHub Stars" />
22
33
  <img src="https://img.shields.io/github/license/enriquekalven/agent-cockpit?style=for-the-badge&color=007bff" alt="License" />
23
34
  <img src="https://img.shields.io/badge/Google-Well--Architected-4285F4?style=for-the-badge&logo=google-cloud" alt="Google Well-Architected" />
24
- <img src="https://img.shields.io/badge/Status-Day%202%20Operations-10b981?style=for-the-badge" alt="Status" />
35
+ <img src="https://img.shields.io/badge/A2A_Standard-Enabled-10b981?style=for-the-badge" alt="A2A Standard" />
25
36
  </div>
26
37
 
27
38
  <br />
@@ -34,7 +45,12 @@ Description-Content-Type: text/markdown
34
45
  ---
35
46
 
36
47
  ## 📽️ The Mission
37
- Most AI agent templates stop at a single Python file and an API key. **The AgentOps Cockpit** is for developers moving into production. While optimized for **ADK**, it provides framework-agnostic governance, safety, and cost guardrails for the entire agentic ecosystem—from CrewAI to LangGraph. Based on the **[Google Well-Architected Framework for Agents](/docs/google-architecture)**.
48
+ Most AI agent templates stop at a single Python file and an API key. **The AgentOps Cockpit** is for developers moving into production. It provides framework-agnostic governance, safety, and cost guardrails for the entire agentic ecosystem.
49
+
50
+ ### Key Pillars:
51
+ - **Governance-as-Code**: Audit your agent against [Google Well-Architected](/docs/google-architecture) best practices.
52
+ - **Agentic Trinity**: Dedicated layers for the Engine (Logic), Face (UX), and Cockpit (Ops).
53
+ - **A2A Connectivity**: Implements the [Agent-to-Agent Transmission Standard](/A2A_GUIDE.md) for secure swarm orchestration.
38
54
 
39
55
  ---
40
56
 
@@ -86,6 +102,9 @@ Don't wait for your users to find prompt injections. Use the built-in Adversaria
86
102
  ### 🏛️ Arch Review & Framework Detection
87
103
  Every agent in the cockpit is graded against a framework-aware checklist. The Cockpit intelligently detects your stack—**Google ADK**, **OpenAI Agentkit**, **Anthropic Claude**, **Microsoft AutoGen/Semantic Kernel**, **AWS Bedrock Agents**, or **CopilotKit**—and runs a tailored audit against corresponding production standards. Use `make arch-review` to verify your **Governance-as-Code**.
88
104
 
105
+ ### 🕹️ MCP Connectivity Hub (Model Context Protocol)
106
+ Stop building one-off tool integrations. The Cockpit provides a unified hub for **MCP Servers**. Connect to Google Search, Slack, or your internal databases via the standardized Model Context Protocol for secure, audited tool execution.
107
+
89
108
  ### 🧗 Quality Hill Climbing (ADK Evaluation)
90
109
  Following **Google ADK Evaluation** best practices, the Cockpit provides an iterative optimization loop. `make quality-baseline` runs your agent against a "Golden Dataset" using **LLM-as-a-Judge** scoring (Response Match & Tool Trajectory), climbing the quality curve until production-grade fidelity is reached.
91
110
 
@@ -14,7 +14,7 @@ agent_ops_cockpit/ops/arch_review.py,sha256=o8ZKYSrmtt-dw74QBROObKz-w8Z-ZwC4G_yk
14
14
  agent_ops_cockpit/ops/cost_optimizer.py,sha256=fisPPo1hykcDBqljs05OG8xn0MBA_HPg7X8SlNDsx0M,1454
15
15
  agent_ops_cockpit/ops/evidence.py,sha256=LRAW57c-2R4ICiMLtc-JA1Tu5dlfO9-VBSUMc3TCLuo,1051
16
16
  agent_ops_cockpit/ops/frameworks.py,sha256=gJdisK8JOs79BY5x0yKu75Lu8WesgDcGJgQrjL9AE7U,19054
17
- agent_ops_cockpit/ops/mcp_hub.py,sha256=IcQNvHvbUhl-PbGPEWvKlUljNVAp8f9QMJR9gypJyE8,1360
17
+ agent_ops_cockpit/ops/mcp_hub.py,sha256=Km-gXPNU0ulrFOe7fg9kPvhS3enataLKN8zyOoyzF6k,3184
18
18
  agent_ops_cockpit/ops/memory_optimizer.py,sha256=whsKhAuJkEJRa2dxfVeJC_xxwDwKjhx5tnmOmkiKgIQ,1635
19
19
  agent_ops_cockpit/ops/orchestrator.py,sha256=WnJ7nv99Ir7lvkWq0EIOEHE2rRzgJv2E4iRi8oDQcPc,3904
20
20
  agent_ops_cockpit/ops/pii_scrubber.py,sha256=HBRzzYv97f8VqIx2Gse9o6UVf6QWXSuop-xF-wVhuKU,1524
@@ -23,8 +23,8 @@ agent_ops_cockpit/ops/secret_scanner.py,sha256=OKojiW8umarrp5ywS4InCTnzzky1hcdBm
23
23
  agent_ops_cockpit/ops/ui_auditor.py,sha256=3Cmc8i3oMQ9Wa0hSkeR0t_J8_s1c-u1_kj2PwxDGD6o,5542
24
24
  agent_ops_cockpit/shadow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  agent_ops_cockpit/shadow/router.py,sha256=HRsgrrd3sQeabi58Ub8pOaDL9c7j4WpayeT9D8zPvOo,2725
26
- agentops_cockpit-0.3.0.dist-info/METADATA,sha256=lL6BFg_T3mHYyu_n8FeH4qhPZmgRRZbXYWcWmSt_InY,7385
27
- agentops_cockpit-0.3.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
28
- agentops_cockpit-0.3.0.dist-info/entry_points.txt,sha256=SOGYPNtUGhMVgxLQ9dEYo7L3M_dvhWEU2eQz2zhaTkY,112
29
- agentops_cockpit-0.3.0.dist-info/licenses/LICENSE,sha256=XNJEk4bvf88tBnKqHdGBGi10l9yJWv2yLWPJvvVie1c,1071
30
- agentops_cockpit-0.3.0.dist-info/RECORD,,
26
+ agentops_cockpit-0.4.0.dist-info/METADATA,sha256=nNpVEjWuXzZupMXp2i0upE_RxTlj8FvInjCvDDBu2Hs,8319
27
+ agentops_cockpit-0.4.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
28
+ agentops_cockpit-0.4.0.dist-info/entry_points.txt,sha256=SOGYPNtUGhMVgxLQ9dEYo7L3M_dvhWEU2eQz2zhaTkY,112
29
+ agentops_cockpit-0.4.0.dist-info/licenses/LICENSE,sha256=XNJEk4bvf88tBnKqHdGBGi10l9yJWv2yLWPJvvVie1c,1071
30
+ agentops_cockpit-0.4.0.dist-info/RECORD,,