agent_os_kernel 3.1.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 (337) hide show
  1. agent_control_plane/__init__.py +662 -0
  2. agent_control_plane/a2a_adapter.py +543 -0
  3. agent_control_plane/adapter.py +417 -0
  4. agent_control_plane/agent_hibernation.py +394 -0
  5. agent_control_plane/agent_kernel.py +470 -0
  6. agent_control_plane/compliance.py +720 -0
  7. agent_control_plane/constraint_graphs.py +478 -0
  8. agent_control_plane/control_plane.py +854 -0
  9. agent_control_plane/example_executors.py +195 -0
  10. agent_control_plane/execution_engine.py +231 -0
  11. agent_control_plane/flight_recorder.py +846 -0
  12. agent_control_plane/governance_layer.py +435 -0
  13. agent_control_plane/hf_utils.py +563 -0
  14. agent_control_plane/interfaces/__init__.py +55 -0
  15. agent_control_plane/interfaces/kernel_interface.py +361 -0
  16. agent_control_plane/interfaces/plugin_interface.py +497 -0
  17. agent_control_plane/interfaces/protocol_interfaces.py +387 -0
  18. agent_control_plane/kernel_space.py +1009 -0
  19. agent_control_plane/langchain_adapter.py +424 -0
  20. agent_control_plane/lifecycle.py +3113 -0
  21. agent_control_plane/mcp_adapter.py +653 -0
  22. agent_control_plane/ml_safety.py +563 -0
  23. agent_control_plane/multimodal.py +727 -0
  24. agent_control_plane/mute_agent.py +422 -0
  25. agent_control_plane/observability.py +787 -0
  26. agent_control_plane/orchestrator.py +482 -0
  27. agent_control_plane/plugin_registry.py +750 -0
  28. agent_control_plane/policy_engine.py +954 -0
  29. agent_control_plane/process_isolation.py +777 -0
  30. agent_control_plane/shadow_mode.py +310 -0
  31. agent_control_plane/signals.py +493 -0
  32. agent_control_plane/supervisor_agents.py +430 -0
  33. agent_control_plane/time_travel_debugger.py +557 -0
  34. agent_control_plane/tool_registry.py +452 -0
  35. agent_control_plane/vfs.py +697 -0
  36. agent_kernel/__init__.py +69 -0
  37. agent_kernel/analyzer.py +435 -0
  38. agent_kernel/auditor.py +36 -0
  39. agent_kernel/completeness_auditor.py +237 -0
  40. agent_kernel/detector.py +203 -0
  41. agent_kernel/kernel.py +744 -0
  42. agent_kernel/memory_manager.py +85 -0
  43. agent_kernel/models.py +374 -0
  44. agent_kernel/nudge_mechanism.py +263 -0
  45. agent_kernel/outcome_analyzer.py +338 -0
  46. agent_kernel/patcher.py +582 -0
  47. agent_kernel/semantic_analyzer.py +316 -0
  48. agent_kernel/semantic_purge.py +349 -0
  49. agent_kernel/simulator.py +449 -0
  50. agent_kernel/teacher.py +85 -0
  51. agent_kernel/triage.py +152 -0
  52. agent_os/__init__.py +409 -0
  53. agent_os/_adversarial_impl.py +200 -0
  54. agent_os/_circuit_breaker_impl.py +232 -0
  55. agent_os/_mcp_metrics.py +193 -0
  56. agent_os/adversarial.py +20 -0
  57. agent_os/agents_compat.py +490 -0
  58. agent_os/audit_logger.py +135 -0
  59. agent_os/base_agent.py +651 -0
  60. agent_os/circuit_breaker.py +34 -0
  61. agent_os/cli/__init__.py +659 -0
  62. agent_os/cli/cmd_audit.py +128 -0
  63. agent_os/cli/cmd_init.py +152 -0
  64. agent_os/cli/cmd_policy.py +41 -0
  65. agent_os/cli/cmd_policy_gen.py +180 -0
  66. agent_os/cli/cmd_validate.py +258 -0
  67. agent_os/cli/mcp_scan.py +265 -0
  68. agent_os/cli/output.py +192 -0
  69. agent_os/cli/policy_checker.py +330 -0
  70. agent_os/compat.py +74 -0
  71. agent_os/constraint_graph.py +234 -0
  72. agent_os/content_governance.py +140 -0
  73. agent_os/context_budget.py +305 -0
  74. agent_os/credential_redactor.py +224 -0
  75. agent_os/diff_policy.py +89 -0
  76. agent_os/egress_policy.py +159 -0
  77. agent_os/escalation.py +276 -0
  78. agent_os/event_bus.py +124 -0
  79. agent_os/exceptions.py +180 -0
  80. agent_os/execution_context_policy.py +141 -0
  81. agent_os/github_enterprise.py +96 -0
  82. agent_os/health.py +20 -0
  83. agent_os/integrations/__init__.py +279 -0
  84. agent_os/integrations/a2a_adapter.py +279 -0
  85. agent_os/integrations/agent_lightning/__init__.py +30 -0
  86. agent_os/integrations/anthropic_adapter.py +420 -0
  87. agent_os/integrations/autogen_adapter.py +620 -0
  88. agent_os/integrations/base.py +1137 -0
  89. agent_os/integrations/compat.py +229 -0
  90. agent_os/integrations/config.py +98 -0
  91. agent_os/integrations/conversation_guardian.py +957 -0
  92. agent_os/integrations/crewai_adapter.py +467 -0
  93. agent_os/integrations/drift_detector.py +425 -0
  94. agent_os/integrations/dry_run.py +124 -0
  95. agent_os/integrations/escalation.py +582 -0
  96. agent_os/integrations/gemini_adapter.py +364 -0
  97. agent_os/integrations/google_adk_adapter.py +633 -0
  98. agent_os/integrations/guardrails_adapter.py +394 -0
  99. agent_os/integrations/health.py +197 -0
  100. agent_os/integrations/langchain_adapter.py +654 -0
  101. agent_os/integrations/llamafirewall.py +343 -0
  102. agent_os/integrations/llamaindex_adapter.py +188 -0
  103. agent_os/integrations/logging.py +191 -0
  104. agent_os/integrations/maf_adapter.py +631 -0
  105. agent_os/integrations/mistral_adapter.py +365 -0
  106. agent_os/integrations/openai_adapter.py +816 -0
  107. agent_os/integrations/openai_agents_sdk.py +406 -0
  108. agent_os/integrations/policy_compose.py +171 -0
  109. agent_os/integrations/profiling.py +144 -0
  110. agent_os/integrations/pydantic_ai_adapter.py +420 -0
  111. agent_os/integrations/rate_limiter.py +130 -0
  112. agent_os/integrations/rbac.py +143 -0
  113. agent_os/integrations/registry.py +113 -0
  114. agent_os/integrations/scope_guard.py +303 -0
  115. agent_os/integrations/semantic_kernel_adapter.py +769 -0
  116. agent_os/integrations/smolagents_adapter.py +629 -0
  117. agent_os/integrations/templates.py +178 -0
  118. agent_os/integrations/token_budget.py +134 -0
  119. agent_os/integrations/tool_aliases.py +190 -0
  120. agent_os/integrations/webhooks.py +177 -0
  121. agent_os/lite.py +208 -0
  122. agent_os/mcp_gateway.py +385 -0
  123. agent_os/mcp_message_signer.py +273 -0
  124. agent_os/mcp_protocols.py +161 -0
  125. agent_os/mcp_response_scanner.py +232 -0
  126. agent_os/mcp_security.py +924 -0
  127. agent_os/mcp_session_auth.py +231 -0
  128. agent_os/mcp_sliding_rate_limiter.py +184 -0
  129. agent_os/memory_guard.py +409 -0
  130. agent_os/metrics.py +134 -0
  131. agent_os/mute.py +428 -0
  132. agent_os/mute_agent.py +209 -0
  133. agent_os/policies/__init__.py +77 -0
  134. agent_os/policies/async_evaluator.py +275 -0
  135. agent_os/policies/backends.py +670 -0
  136. agent_os/policies/bridge.py +169 -0
  137. agent_os/policies/budget.py +85 -0
  138. agent_os/policies/cli.py +294 -0
  139. agent_os/policies/conflict_resolution.py +270 -0
  140. agent_os/policies/data_classification.py +252 -0
  141. agent_os/policies/evaluator.py +239 -0
  142. agent_os/policies/policy_schema.json +228 -0
  143. agent_os/policies/rate_limiting.py +145 -0
  144. agent_os/policies/schema.py +115 -0
  145. agent_os/policies/shared.py +331 -0
  146. agent_os/prompt_injection.py +694 -0
  147. agent_os/providers.py +182 -0
  148. agent_os/py.typed +0 -0
  149. agent_os/retry.py +81 -0
  150. agent_os/reversibility.py +251 -0
  151. agent_os/sandbox.py +432 -0
  152. agent_os/sandbox_provider.py +140 -0
  153. agent_os/secure_codegen.py +525 -0
  154. agent_os/security_skills.py +538 -0
  155. agent_os/semantic_policy.py +422 -0
  156. agent_os/server/__init__.py +15 -0
  157. agent_os/server/__main__.py +25 -0
  158. agent_os/server/app.py +277 -0
  159. agent_os/server/models.py +104 -0
  160. agent_os/shift_left_metrics.py +130 -0
  161. agent_os/stateless.py +742 -0
  162. agent_os/supervisor.py +148 -0
  163. agent_os/task_outcome.py +148 -0
  164. agent_os/transparency.py +181 -0
  165. agent_os/trust_root.py +128 -0
  166. agent_os_kernel-3.1.0.dist-info/METADATA +1269 -0
  167. agent_os_kernel-3.1.0.dist-info/RECORD +337 -0
  168. agent_os_kernel-3.1.0.dist-info/WHEEL +4 -0
  169. agent_os_kernel-3.1.0.dist-info/entry_points.txt +2 -0
  170. agent_os_kernel-3.1.0.dist-info/licenses/LICENSE +21 -0
  171. agent_os_observability/__init__.py +27 -0
  172. agent_os_observability/dashboards.py +898 -0
  173. agent_os_observability/metrics.py +398 -0
  174. agent_os_observability/server.py +223 -0
  175. agent_os_observability/tracer.py +232 -0
  176. agent_primitives/__init__.py +24 -0
  177. agent_primitives/failures.py +84 -0
  178. agent_primitives/py.typed +0 -0
  179. amb_core/__init__.py +177 -0
  180. amb_core/adapters/__init__.py +57 -0
  181. amb_core/adapters/aws_sqs_broker.py +376 -0
  182. amb_core/adapters/azure_servicebus_broker.py +340 -0
  183. amb_core/adapters/kafka_broker.py +260 -0
  184. amb_core/adapters/nats_broker.py +285 -0
  185. amb_core/adapters/rabbitmq_broker.py +235 -0
  186. amb_core/adapters/redis_broker.py +262 -0
  187. amb_core/broker.py +145 -0
  188. amb_core/bus.py +481 -0
  189. amb_core/cloudevents.py +509 -0
  190. amb_core/dlq.py +345 -0
  191. amb_core/hf_utils.py +536 -0
  192. amb_core/memory_broker.py +410 -0
  193. amb_core/models.py +141 -0
  194. amb_core/persistence.py +529 -0
  195. amb_core/schema.py +294 -0
  196. amb_core/tracing.py +358 -0
  197. atr/__init__.py +640 -0
  198. atr/access.py +348 -0
  199. atr/composition.py +645 -0
  200. atr/decorator.py +357 -0
  201. atr/executor.py +384 -0
  202. atr/health.py +557 -0
  203. atr/hf_utils.py +449 -0
  204. atr/injection.py +422 -0
  205. atr/metrics.py +440 -0
  206. atr/policies.py +403 -0
  207. atr/py.typed +2 -0
  208. atr/registry.py +452 -0
  209. atr/schema.py +480 -0
  210. atr/tools/safe/__init__.py +75 -0
  211. atr/tools/safe/calculator.py +467 -0
  212. atr/tools/safe/datetime_tool.py +443 -0
  213. atr/tools/safe/file_reader.py +402 -0
  214. atr/tools/safe/http_client.py +316 -0
  215. atr/tools/safe/json_parser.py +374 -0
  216. atr/tools/safe/text_tool.py +537 -0
  217. atr/tools/safe/toolkit.py +175 -0
  218. caas/__init__.py +162 -0
  219. caas/api/__init__.py +7 -0
  220. caas/api/server.py +1328 -0
  221. caas/caching.py +834 -0
  222. caas/cli.py +210 -0
  223. caas/conversation.py +223 -0
  224. caas/decay.py +72 -0
  225. caas/detection/__init__.py +9 -0
  226. caas/detection/detector.py +238 -0
  227. caas/enrichment.py +130 -0
  228. caas/gateway/__init__.py +27 -0
  229. caas/gateway/trust_gateway.py +474 -0
  230. caas/hf_utils.py +479 -0
  231. caas/ingestion/__init__.py +23 -0
  232. caas/ingestion/processors.py +253 -0
  233. caas/ingestion/structure_parser.py +188 -0
  234. caas/models.py +356 -0
  235. caas/pragmatic_truth.py +444 -0
  236. caas/routing/__init__.py +10 -0
  237. caas/routing/heuristic_router.py +58 -0
  238. caas/storage/__init__.py +9 -0
  239. caas/storage/store.py +389 -0
  240. caas/triad.py +213 -0
  241. caas/tuning/__init__.py +9 -0
  242. caas/tuning/tuner.py +329 -0
  243. caas/vfs/__init__.py +14 -0
  244. caas/vfs/filesystem.py +452 -0
  245. cmvk/__init__.py +218 -0
  246. cmvk/audit.py +402 -0
  247. cmvk/benchmarks.py +478 -0
  248. cmvk/constitutional.py +904 -0
  249. cmvk/hf_utils.py +301 -0
  250. cmvk/metrics.py +473 -0
  251. cmvk/profiles.py +300 -0
  252. cmvk/py.typed +0 -0
  253. cmvk/types.py +12 -0
  254. cmvk/verification.py +956 -0
  255. emk/__init__.py +89 -0
  256. emk/causal.py +352 -0
  257. emk/hf_utils.py +421 -0
  258. emk/indexer.py +83 -0
  259. emk/py.typed +0 -0
  260. emk/schema.py +204 -0
  261. emk/sleep_cycle.py +347 -0
  262. emk/store.py +281 -0
  263. iatp/__init__.py +166 -0
  264. iatp/attestation.py +461 -0
  265. iatp/cli.py +317 -0
  266. iatp/hf_utils.py +472 -0
  267. iatp/ipc_pipes.py +580 -0
  268. iatp/main.py +412 -0
  269. iatp/models/__init__.py +447 -0
  270. iatp/policy_engine.py +337 -0
  271. iatp/py.typed +2 -0
  272. iatp/recovery.py +321 -0
  273. iatp/security/__init__.py +270 -0
  274. iatp/sidecar/__init__.py +519 -0
  275. iatp/telemetry/__init__.py +164 -0
  276. iatp/tests/__init__.py +1 -0
  277. iatp/tests/test_attestation.py +370 -0
  278. iatp/tests/test_cli.py +131 -0
  279. iatp/tests/test_ed25519_attestation.py +211 -0
  280. iatp/tests/test_models.py +130 -0
  281. iatp/tests/test_policy_engine.py +347 -0
  282. iatp/tests/test_recovery.py +281 -0
  283. iatp/tests/test_security.py +222 -0
  284. iatp/tests/test_sidecar.py +167 -0
  285. iatp/tests/test_telemetry.py +175 -0
  286. mcp_kernel_server/__init__.py +28 -0
  287. mcp_kernel_server/cli.py +274 -0
  288. mcp_kernel_server/resources.py +217 -0
  289. mcp_kernel_server/server.py +564 -0
  290. mcp_kernel_server/tools.py +1174 -0
  291. mute_agent/__init__.py +68 -0
  292. mute_agent/core/__init__.py +1 -0
  293. mute_agent/core/execution_agent.py +166 -0
  294. mute_agent/core/handshake_protocol.py +201 -0
  295. mute_agent/core/reasoning_agent.py +238 -0
  296. mute_agent/knowledge_graph/__init__.py +1 -0
  297. mute_agent/knowledge_graph/graph_elements.py +65 -0
  298. mute_agent/knowledge_graph/multidimensional_graph.py +170 -0
  299. mute_agent/knowledge_graph/subgraph.py +224 -0
  300. mute_agent/listener/__init__.py +43 -0
  301. mute_agent/listener/adapters/__init__.py +31 -0
  302. mute_agent/listener/adapters/base_adapter.py +189 -0
  303. mute_agent/listener/adapters/caas_adapter.py +344 -0
  304. mute_agent/listener/adapters/control_plane_adapter.py +436 -0
  305. mute_agent/listener/adapters/iatp_adapter.py +332 -0
  306. mute_agent/listener/adapters/scak_adapter.py +251 -0
  307. mute_agent/listener/listener.py +610 -0
  308. mute_agent/listener/state_observer.py +436 -0
  309. mute_agent/listener/threshold_config.py +313 -0
  310. mute_agent/super_system/__init__.py +1 -0
  311. mute_agent/super_system/router.py +204 -0
  312. mute_agent/visualization/__init__.py +10 -0
  313. mute_agent/visualization/graph_debugger.py +502 -0
  314. nexus/README.md +60 -0
  315. nexus/__init__.py +51 -0
  316. nexus/arbiter.py +359 -0
  317. nexus/client.py +466 -0
  318. nexus/dmz.py +444 -0
  319. nexus/escrow.py +430 -0
  320. nexus/exceptions.py +286 -0
  321. nexus/pyproject.toml +36 -0
  322. nexus/registry.py +393 -0
  323. nexus/reputation.py +425 -0
  324. nexus/schemas/__init__.py +51 -0
  325. nexus/schemas/compliance.py +276 -0
  326. nexus/schemas/escrow.py +251 -0
  327. nexus/schemas/manifest.py +225 -0
  328. nexus/schemas/receipt.py +208 -0
  329. nexus/tests/__init__.py +0 -0
  330. nexus/tests/conftest.py +146 -0
  331. nexus/tests/test_arbiter.py +192 -0
  332. nexus/tests/test_dmz.py +194 -0
  333. nexus/tests/test_escrow.py +276 -0
  334. nexus/tests/test_exceptions.py +225 -0
  335. nexus/tests/test_registry.py +232 -0
  336. nexus/tests/test_reputation.py +328 -0
  337. nexus/tests/test_schemas.py +295 -0
@@ -0,0 +1,898 @@
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
3
+ """
4
+ Pre-built Grafana Dashboards for Agent OS.
5
+
6
+ Provides JSON dashboard definitions ready for import.
7
+ """
8
+
9
+ import json
10
+
11
+
12
+ def get_grafana_dashboard(name: str = "agent-os-overview") -> dict:
13
+ """
14
+ Get a pre-built Grafana dashboard.
15
+
16
+ Available dashboards:
17
+ - agent-os-overview: Main overview for SOC teams
18
+ - agent-os-safety: Safety metrics detail
19
+ - agent-os-performance: Performance metrics
20
+ - agent-os-amb: AMB health and throughput
21
+ - agent-os-cmvk: CMVK verification metrics
22
+
23
+ Usage:
24
+ dashboard = get_grafana_dashboard("agent-os-overview")
25
+ # Import via Grafana API or UI
26
+ """
27
+ dashboards = {
28
+ "agent-os-overview": _overview_dashboard(),
29
+ "agent-os-safety": _safety_dashboard(),
30
+ "agent-os-performance": _performance_dashboard(),
31
+ "agent-os-amb": _amb_dashboard(),
32
+ "agent-os-cmvk": _cmvk_dashboard(),
33
+ }
34
+ return dashboards.get(name, dashboards["agent-os-overview"])
35
+
36
+
37
+ def _overview_dashboard() -> dict:
38
+ """Main Agent OS overview dashboard."""
39
+ return {
40
+ "dashboard": {
41
+ "id": None,
42
+ "uid": "agent-os-overview",
43
+ "title": "Agent OS - Overview",
44
+ "tags": ["agent-os", "ai-safety"],
45
+ "timezone": "browser",
46
+ "schemaVersion": 38,
47
+ "version": 1,
48
+ "refresh": "10s",
49
+ "panels": [
50
+ # Row 1: Key Safety Metrics
51
+ {
52
+ "id": 1,
53
+ "type": "stat",
54
+ "title": "Violation Rate",
55
+ "gridPos": {"h": 4, "w": 6, "x": 0, "y": 0},
56
+ "targets": [
57
+ {
58
+ "expr": "agent_os_violation_rate{window='all_time'}",
59
+ "refId": "A"
60
+ }
61
+ ],
62
+ "options": {
63
+ "colorMode": "value",
64
+ "graphMode": "none",
65
+ "orientation": "auto",
66
+ "textMode": "value_and_name"
67
+ },
68
+ "fieldConfig": {
69
+ "defaults": {
70
+ "unit": "percentunit",
71
+ "thresholds": {
72
+ "mode": "absolute",
73
+ "steps": [
74
+ {"color": "green", "value": None},
75
+ {"color": "yellow", "value": 0.001},
76
+ {"color": "red", "value": 0.01}
77
+ ]
78
+ }
79
+ }
80
+ }
81
+ },
82
+ {
83
+ "id": 2,
84
+ "type": "stat",
85
+ "title": "SIGKILL Count (24h)",
86
+ "gridPos": {"h": 4, "w": 6, "x": 6, "y": 0},
87
+ "targets": [
88
+ {
89
+ "expr": "increase(agent_os_sigkill_total[24h])",
90
+ "refId": "A"
91
+ }
92
+ ],
93
+ "options": {"colorMode": "value"}
94
+ },
95
+ {
96
+ "id": 3,
97
+ "type": "stat",
98
+ "title": "Kernel Uptime",
99
+ "gridPos": {"h": 4, "w": 6, "x": 12, "y": 0},
100
+ "targets": [
101
+ {
102
+ "expr": "agent_os_kernel_uptime_seconds",
103
+ "refId": "A"
104
+ }
105
+ ],
106
+ "fieldConfig": {
107
+ "defaults": {"unit": "s"}
108
+ }
109
+ },
110
+ {
111
+ "id": 4,
112
+ "type": "stat",
113
+ "title": "Active Agents",
114
+ "gridPos": {"h": 4, "w": 6, "x": 18, "y": 0},
115
+ "targets": [
116
+ {
117
+ "expr": "agent_os_active_agents",
118
+ "refId": "A"
119
+ }
120
+ ]
121
+ },
122
+
123
+ # Row 2: Time Series
124
+ {
125
+ "id": 5,
126
+ "type": "timeseries",
127
+ "title": "Requests per Second",
128
+ "gridPos": {"h": 8, "w": 12, "x": 0, "y": 4},
129
+ "targets": [
130
+ {
131
+ "expr": "rate(agent_os_requests_total[1m])",
132
+ "legendFormat": "{{action}} - {{status}}",
133
+ "refId": "A"
134
+ }
135
+ ]
136
+ },
137
+ {
138
+ "id": 6,
139
+ "type": "timeseries",
140
+ "title": "Policy Check Latency (p99)",
141
+ "gridPos": {"h": 8, "w": 12, "x": 12, "y": 4},
142
+ "targets": [
143
+ {
144
+ "expr": "histogram_quantile(0.99, rate(agent_os_policy_check_duration_seconds_bucket[5m]))",
145
+ "legendFormat": "p99",
146
+ "refId": "A"
147
+ },
148
+ {
149
+ "expr": "histogram_quantile(0.50, rate(agent_os_policy_check_duration_seconds_bucket[5m]))",
150
+ "legendFormat": "p50",
151
+ "refId": "B"
152
+ }
153
+ ],
154
+ "fieldConfig": {
155
+ "defaults": {
156
+ "unit": "s",
157
+ "thresholds": {
158
+ "steps": [
159
+ {"color": "green", "value": None},
160
+ {"color": "yellow", "value": 0.005},
161
+ {"color": "red", "value": 0.01}
162
+ ]
163
+ }
164
+ }
165
+ }
166
+ },
167
+
168
+ # Row 3: Violations and Signals
169
+ {
170
+ "id": 7,
171
+ "type": "timeseries",
172
+ "title": "Violations Over Time",
173
+ "gridPos": {"h": 8, "w": 12, "x": 0, "y": 12},
174
+ "targets": [
175
+ {
176
+ "expr": "rate(agent_os_violations_total[5m])",
177
+ "legendFormat": "{{policy}}",
178
+ "refId": "A"
179
+ }
180
+ ],
181
+ "fieldConfig": {
182
+ "defaults": {
183
+ "custom": {
184
+ "fillOpacity": 30
185
+ }
186
+ }
187
+ }
188
+ },
189
+ {
190
+ "id": 8,
191
+ "type": "timeseries",
192
+ "title": "Signals Sent",
193
+ "gridPos": {"h": 8, "w": 12, "x": 12, "y": 12},
194
+ "targets": [
195
+ {
196
+ "expr": "rate(agent_os_signals_total[5m])",
197
+ "legendFormat": "{{signal}}",
198
+ "refId": "A"
199
+ }
200
+ ]
201
+ },
202
+
203
+ # Row 4: Recovery
204
+ {
205
+ "id": 9,
206
+ "type": "histogram",
207
+ "title": "MTTR Distribution",
208
+ "gridPos": {"h": 8, "w": 12, "x": 0, "y": 20},
209
+ "targets": [
210
+ {
211
+ "expr": "agent_os_mttr_seconds_bucket",
212
+ "refId": "A"
213
+ }
214
+ ],
215
+ "fieldConfig": {
216
+ "defaults": {"unit": "s"}
217
+ }
218
+ },
219
+ {
220
+ "id": 10,
221
+ "type": "table",
222
+ "title": "Recent Violations",
223
+ "gridPos": {"h": 8, "w": 12, "x": 12, "y": 20},
224
+ "targets": [
225
+ {
226
+ "expr": "topk(10, agent_os_violations_total)",
227
+ "format": "table",
228
+ "refId": "A"
229
+ }
230
+ ]
231
+ }
232
+ ]
233
+ },
234
+ "folderId": 0,
235
+ "overwrite": True
236
+ }
237
+
238
+
239
+ def _safety_dashboard() -> dict:
240
+ """Detailed safety metrics dashboard."""
241
+ return {
242
+ "dashboard": {
243
+ "id": None,
244
+ "uid": "agent-os-safety",
245
+ "title": "Agent OS - Safety Metrics",
246
+ "tags": ["agent-os", "ai-safety", "compliance"],
247
+ "timezone": "browser",
248
+ "schemaVersion": 38,
249
+ "version": 1,
250
+ "panels": [
251
+ {
252
+ "id": 1,
253
+ "type": "stat",
254
+ "title": "30-Day Violation Count",
255
+ "gridPos": {"h": 6, "w": 8, "x": 0, "y": 0},
256
+ "targets": [
257
+ {
258
+ "expr": "increase(agent_os_violations_total[30d])",
259
+ "refId": "A"
260
+ }
261
+ ],
262
+ "fieldConfig": {
263
+ "defaults": {
264
+ "thresholds": {
265
+ "steps": [
266
+ {"color": "green", "value": None},
267
+ {"color": "red", "value": 1}
268
+ ]
269
+ }
270
+ }
271
+ }
272
+ }
273
+ ]
274
+ }
275
+ }
276
+
277
+
278
+ def _performance_dashboard() -> dict:
279
+ """Performance metrics dashboard."""
280
+ return {
281
+ "dashboard": {
282
+ "id": None,
283
+ "uid": "agent-os-performance",
284
+ "title": "Agent OS - Performance",
285
+ "tags": ["agent-os", "performance"],
286
+ "timezone": "browser",
287
+ "schemaVersion": 38,
288
+ "version": 1,
289
+ "panels": []
290
+ }
291
+ }
292
+
293
+
294
+ def export_dashboard(name: str, path: str):
295
+ """Export dashboard to JSON file."""
296
+ dashboard = get_grafana_dashboard(name)
297
+ with open(path, "w") as f:
298
+ json.dump(dashboard, f, indent=2)
299
+
300
+
301
+ def _amb_dashboard() -> dict:
302
+ """AMB (Agent Message Bus) health dashboard."""
303
+ return {
304
+ "dashboard": {
305
+ "id": None,
306
+ "uid": "agent-os-amb",
307
+ "title": "Agent OS - AMB Health",
308
+ "tags": ["agent-os", "amb", "messaging"],
309
+ "timezone": "browser",
310
+ "schemaVersion": 38,
311
+ "version": 1,
312
+ "refresh": "5s",
313
+ "panels": [
314
+ # Row 1: Key Metrics
315
+ {
316
+ "id": 1,
317
+ "type": "stat",
318
+ "title": "Messages/sec",
319
+ "gridPos": {"h": 4, "w": 6, "x": 0, "y": 0},
320
+ "targets": [
321
+ {
322
+ "expr": "sum(rate(amb_messages_published_total[1m]))",
323
+ "refId": "A"
324
+ }
325
+ ],
326
+ "fieldConfig": {
327
+ "defaults": {
328
+ "unit": "msg/s",
329
+ "thresholds": {
330
+ "steps": [
331
+ {"color": "green", "value": None},
332
+ {"color": "yellow", "value": 10000},
333
+ {"color": "red", "value": 50000}
334
+ ]
335
+ }
336
+ }
337
+ }
338
+ },
339
+ {
340
+ "id": 2,
341
+ "type": "stat",
342
+ "title": "Queue Depth",
343
+ "gridPos": {"h": 4, "w": 6, "x": 6, "y": 0},
344
+ "targets": [
345
+ {
346
+ "expr": "sum(amb_queue_depth)",
347
+ "refId": "A"
348
+ }
349
+ ],
350
+ "fieldConfig": {
351
+ "defaults": {
352
+ "thresholds": {
353
+ "steps": [
354
+ {"color": "green", "value": None},
355
+ {"color": "yellow", "value": 500},
356
+ {"color": "red", "value": 1000}
357
+ ]
358
+ }
359
+ }
360
+ }
361
+ },
362
+ {
363
+ "id": 3,
364
+ "type": "stat",
365
+ "title": "Backpressure Events (1h)",
366
+ "gridPos": {"h": 4, "w": 6, "x": 12, "y": 0},
367
+ "targets": [
368
+ {
369
+ "expr": "increase(amb_backpressure_activated_total[1h])",
370
+ "refId": "A"
371
+ }
372
+ ],
373
+ "fieldConfig": {
374
+ "defaults": {
375
+ "thresholds": {
376
+ "steps": [
377
+ {"color": "green", "value": None},
378
+ {"color": "yellow", "value": 1},
379
+ {"color": "red", "value": 10}
380
+ ]
381
+ }
382
+ }
383
+ }
384
+ },
385
+ {
386
+ "id": 4,
387
+ "type": "stat",
388
+ "title": "Delivery Failures (1h)",
389
+ "gridPos": {"h": 4, "w": 6, "x": 18, "y": 0},
390
+ "targets": [
391
+ {
392
+ "expr": "increase(amb_delivery_failures_total[1h])",
393
+ "refId": "A"
394
+ }
395
+ ],
396
+ "fieldConfig": {
397
+ "defaults": {
398
+ "thresholds": {
399
+ "steps": [
400
+ {"color": "green", "value": None},
401
+ {"color": "yellow", "value": 1},
402
+ {"color": "red", "value": 10}
403
+ ]
404
+ }
405
+ }
406
+ }
407
+ },
408
+
409
+ # Row 2: Throughput
410
+ {
411
+ "id": 5,
412
+ "type": "timeseries",
413
+ "title": "Message Throughput",
414
+ "gridPos": {"h": 8, "w": 12, "x": 0, "y": 4},
415
+ "targets": [
416
+ {
417
+ "expr": "rate(amb_messages_published_total[1m])",
418
+ "legendFormat": "Published - {{topic}}",
419
+ "refId": "A"
420
+ },
421
+ {
422
+ "expr": "rate(amb_messages_delivered_total[1m])",
423
+ "legendFormat": "Delivered - {{topic}}",
424
+ "refId": "B"
425
+ }
426
+ ],
427
+ "fieldConfig": {
428
+ "defaults": {"unit": "msg/s"}
429
+ }
430
+ },
431
+ {
432
+ "id": 6,
433
+ "type": "timeseries",
434
+ "title": "Queue Depth by Topic",
435
+ "gridPos": {"h": 8, "w": 12, "x": 12, "y": 4},
436
+ "targets": [
437
+ {
438
+ "expr": "amb_queue_depth",
439
+ "legendFormat": "{{topic}}",
440
+ "refId": "A"
441
+ }
442
+ ]
443
+ },
444
+
445
+ # Row 3: Latency
446
+ {
447
+ "id": 7,
448
+ "type": "timeseries",
449
+ "title": "Publish Latency",
450
+ "gridPos": {"h": 8, "w": 12, "x": 0, "y": 12},
451
+ "targets": [
452
+ {
453
+ "expr": "histogram_quantile(0.99, rate(amb_publish_duration_seconds_bucket[5m]))",
454
+ "legendFormat": "p99",
455
+ "refId": "A"
456
+ },
457
+ {
458
+ "expr": "histogram_quantile(0.95, rate(amb_publish_duration_seconds_bucket[5m]))",
459
+ "legendFormat": "p95",
460
+ "refId": "B"
461
+ },
462
+ {
463
+ "expr": "histogram_quantile(0.50, rate(amb_publish_duration_seconds_bucket[5m]))",
464
+ "legendFormat": "p50",
465
+ "refId": "C"
466
+ }
467
+ ],
468
+ "fieldConfig": {
469
+ "defaults": {
470
+ "unit": "s",
471
+ "thresholds": {
472
+ "steps": [
473
+ {"color": "green", "value": None},
474
+ {"color": "yellow", "value": 0.01},
475
+ {"color": "red", "value": 0.1}
476
+ ]
477
+ }
478
+ }
479
+ }
480
+ },
481
+ {
482
+ "id": 8,
483
+ "type": "timeseries",
484
+ "title": "Delivery Latency",
485
+ "gridPos": {"h": 8, "w": 12, "x": 12, "y": 12},
486
+ "targets": [
487
+ {
488
+ "expr": "histogram_quantile(0.99, rate(amb_delivery_duration_seconds_bucket[5m]))",
489
+ "legendFormat": "p99",
490
+ "refId": "A"
491
+ },
492
+ {
493
+ "expr": "histogram_quantile(0.50, rate(amb_delivery_duration_seconds_bucket[5m]))",
494
+ "legendFormat": "p50",
495
+ "refId": "B"
496
+ }
497
+ ],
498
+ "fieldConfig": {
499
+ "defaults": {"unit": "s"}
500
+ }
501
+ },
502
+
503
+ # Row 4: Health
504
+ {
505
+ "id": 9,
506
+ "type": "timeseries",
507
+ "title": "Priority Lane Distribution",
508
+ "gridPos": {"h": 8, "w": 12, "x": 0, "y": 20},
509
+ "targets": [
510
+ {
511
+ "expr": "rate(amb_messages_published_total[5m])",
512
+ "legendFormat": "{{priority}}",
513
+ "refId": "A"
514
+ }
515
+ ],
516
+ "options": {
517
+ "legend": {"displayMode": "table"}
518
+ }
519
+ },
520
+ {
521
+ "id": 10,
522
+ "type": "table",
523
+ "title": "Dead Letter Queue",
524
+ "gridPos": {"h": 8, "w": 12, "x": 12, "y": 20},
525
+ "targets": [
526
+ {
527
+ "expr": "amb_dlq_messages_total",
528
+ "format": "table",
529
+ "refId": "A"
530
+ }
531
+ ],
532
+ "fieldConfig": {
533
+ "defaults": {
534
+ "thresholds": {
535
+ "steps": [
536
+ {"color": "green", "value": None},
537
+ {"color": "red", "value": 1}
538
+ ]
539
+ }
540
+ }
541
+ }
542
+ },
543
+
544
+ # Row 5: Broker Health
545
+ {
546
+ "id": 11,
547
+ "type": "stat",
548
+ "title": "Broker Status",
549
+ "gridPos": {"h": 4, "w": 8, "x": 0, "y": 28},
550
+ "targets": [
551
+ {
552
+ "expr": "amb_broker_connected",
553
+ "refId": "A"
554
+ }
555
+ ],
556
+ "fieldConfig": {
557
+ "defaults": {
558
+ "mappings": [
559
+ {"type": "value", "options": {"1": {"text": "Connected", "color": "green"}}},
560
+ {"type": "value", "options": {"0": {"text": "Disconnected", "color": "red"}}}
561
+ ]
562
+ }
563
+ }
564
+ },
565
+ {
566
+ "id": 12,
567
+ "type": "stat",
568
+ "title": "Persistence Status",
569
+ "gridPos": {"h": 4, "w": 8, "x": 8, "y": 28},
570
+ "targets": [
571
+ {
572
+ "expr": "amb_persistence_enabled",
573
+ "refId": "A"
574
+ }
575
+ ],
576
+ "fieldConfig": {
577
+ "defaults": {
578
+ "mappings": [
579
+ {"type": "value", "options": {"1": {"text": "Enabled", "color": "green"}}},
580
+ {"type": "value", "options": {"0": {"text": "Disabled", "color": "yellow"}}}
581
+ ]
582
+ }
583
+ }
584
+ },
585
+ {
586
+ "id": 13,
587
+ "type": "stat",
588
+ "title": "Messages in WAL",
589
+ "gridPos": {"h": 4, "w": 8, "x": 16, "y": 28},
590
+ "targets": [
591
+ {
592
+ "expr": "amb_wal_messages_pending",
593
+ "refId": "A"
594
+ }
595
+ ]
596
+ }
597
+ ]
598
+ },
599
+ "folderId": 0,
600
+ "overwrite": True
601
+ }
602
+
603
+
604
+ def _cmvk_dashboard() -> dict:
605
+ """CMVK (Verification Kernel) dashboard for ML Ops."""
606
+ return {
607
+ "dashboard": {
608
+ "id": None,
609
+ "uid": "agent-os-cmvk",
610
+ "title": "Agent OS - CMVK Verification",
611
+ "tags": ["agent-os", "cmvk", "ml-ops", "verification"],
612
+ "timezone": "browser",
613
+ "schemaVersion": 38,
614
+ "version": 1,
615
+ "refresh": "10s",
616
+ "panels": [
617
+ # Row 1: Key CMVK Metrics
618
+ {
619
+ "id": 1,
620
+ "type": "stat",
621
+ "title": "Model Consensus Rate",
622
+ "description": "Current agreement ratio across verification models (target: >90%)",
623
+ "gridPos": {"h": 4, "w": 6, "x": 0, "y": 0},
624
+ "targets": [
625
+ {
626
+ "expr": "agent_os_cmvk_consensus_ratio",
627
+ "refId": "A"
628
+ }
629
+ ],
630
+ "fieldConfig": {
631
+ "defaults": {
632
+ "unit": "percentunit",
633
+ "thresholds": {
634
+ "steps": [
635
+ {"color": "red", "value": None},
636
+ {"color": "yellow", "value": 0.7},
637
+ {"color": "green", "value": 0.9}
638
+ ]
639
+ }
640
+ }
641
+ }
642
+ },
643
+ {
644
+ "id": 2,
645
+ "type": "stat",
646
+ "title": "Verifications (24h)",
647
+ "gridPos": {"h": 4, "w": 6, "x": 6, "y": 0},
648
+ "targets": [
649
+ {
650
+ "expr": "increase(agent_os_cmvk_verifications_total[24h])",
651
+ "refId": "A"
652
+ }
653
+ ]
654
+ },
655
+ {
656
+ "id": 3,
657
+ "type": "stat",
658
+ "title": "Flagged Claims (24h)",
659
+ "description": "Claims flagged due to model disagreement",
660
+ "gridPos": {"h": 4, "w": 6, "x": 12, "y": 0},
661
+ "targets": [
662
+ {
663
+ "expr": "increase(agent_os_cmvk_verifications_total{result='flagged'}[24h])",
664
+ "refId": "A"
665
+ }
666
+ ],
667
+ "fieldConfig": {
668
+ "defaults": {
669
+ "thresholds": {
670
+ "steps": [
671
+ {"color": "green", "value": None},
672
+ {"color": "yellow", "value": 10},
673
+ {"color": "red", "value": 50}
674
+ ]
675
+ }
676
+ }
677
+ }
678
+ },
679
+ {
680
+ "id": 4,
681
+ "type": "stat",
682
+ "title": "Avg Verification Time",
683
+ "gridPos": {"h": 4, "w": 6, "x": 18, "y": 0},
684
+ "targets": [
685
+ {
686
+ "expr": "histogram_quantile(0.50, rate(agent_os_cmvk_verification_duration_seconds_bucket[5m]))",
687
+ "refId": "A"
688
+ }
689
+ ],
690
+ "fieldConfig": {
691
+ "defaults": {
692
+ "unit": "s",
693
+ "thresholds": {
694
+ "steps": [
695
+ {"color": "green", "value": None},
696
+ {"color": "yellow", "value": 3},
697
+ {"color": "red", "value": 10}
698
+ ]
699
+ }
700
+ }
701
+ }
702
+ },
703
+
704
+ # Row 2: Verification Results
705
+ {
706
+ "id": 5,
707
+ "type": "piechart",
708
+ "title": "Verification Results (24h)",
709
+ "gridPos": {"h": 8, "w": 8, "x": 0, "y": 4},
710
+ "targets": [
711
+ {
712
+ "expr": "increase(agent_os_cmvk_verifications_total[24h])",
713
+ "legendFormat": "{{result}}",
714
+ "refId": "A"
715
+ }
716
+ ],
717
+ "options": {
718
+ "legend": {"displayMode": "table", "placement": "right"}
719
+ }
720
+ },
721
+ {
722
+ "id": 6,
723
+ "type": "timeseries",
724
+ "title": "Verification Rate Over Time",
725
+ "gridPos": {"h": 8, "w": 16, "x": 8, "y": 4},
726
+ "targets": [
727
+ {
728
+ "expr": "rate(agent_os_cmvk_verifications_total[5m])",
729
+ "legendFormat": "{{result}}",
730
+ "refId": "A"
731
+ }
732
+ ],
733
+ "fieldConfig": {
734
+ "defaults": {
735
+ "unit": "req/s",
736
+ "custom": {
737
+ "fillOpacity": 30
738
+ }
739
+ }
740
+ }
741
+ },
742
+
743
+ # Row 3: Drift and Consensus
744
+ {
745
+ "id": 7,
746
+ "type": "timeseries",
747
+ "title": "Drift Score Distribution",
748
+ "description": "Lower is better. High drift = model disagreement.",
749
+ "gridPos": {"h": 8, "w": 12, "x": 0, "y": 12},
750
+ "targets": [
751
+ {
752
+ "expr": "histogram_quantile(0.99, rate(agent_os_cmvk_drift_score_bucket[5m]))",
753
+ "legendFormat": "p99",
754
+ "refId": "A"
755
+ },
756
+ {
757
+ "expr": "histogram_quantile(0.95, rate(agent_os_cmvk_drift_score_bucket[5m]))",
758
+ "legendFormat": "p95",
759
+ "refId": "B"
760
+ },
761
+ {
762
+ "expr": "histogram_quantile(0.50, rate(agent_os_cmvk_drift_score_bucket[5m]))",
763
+ "legendFormat": "p50",
764
+ "refId": "C"
765
+ }
766
+ ],
767
+ "fieldConfig": {
768
+ "defaults": {
769
+ "thresholds": {
770
+ "steps": [
771
+ {"color": "green", "value": None},
772
+ {"color": "yellow", "value": 0.15},
773
+ {"color": "red", "value": 0.30}
774
+ ]
775
+ }
776
+ }
777
+ }
778
+ },
779
+ {
780
+ "id": 8,
781
+ "type": "timeseries",
782
+ "title": "Model Disagreements Rate",
783
+ "gridPos": {"h": 8, "w": 12, "x": 12, "y": 12},
784
+ "targets": [
785
+ {
786
+ "expr": "rate(agent_os_cmvk_model_disagreements_total[5m])",
787
+ "legendFormat": "{{model_pair}}",
788
+ "refId": "A"
789
+ }
790
+ ]
791
+ },
792
+
793
+ # Row 4: Per-Model Performance
794
+ {
795
+ "id": 9,
796
+ "type": "timeseries",
797
+ "title": "Model Response Latency",
798
+ "description": "Individual model response times",
799
+ "gridPos": {"h": 8, "w": 12, "x": 0, "y": 20},
800
+ "targets": [
801
+ {
802
+ "expr": "histogram_quantile(0.95, rate(agent_os_cmvk_model_latency_seconds_bucket[5m]))",
803
+ "legendFormat": "{{model}} p95",
804
+ "refId": "A"
805
+ }
806
+ ],
807
+ "fieldConfig": {
808
+ "defaults": {
809
+ "unit": "s",
810
+ "thresholds": {
811
+ "steps": [
812
+ {"color": "green", "value": None},
813
+ {"color": "yellow", "value": 2},
814
+ {"color": "red", "value": 5}
815
+ ]
816
+ }
817
+ }
818
+ }
819
+ },
820
+ {
821
+ "id": 10,
822
+ "type": "bargauge",
823
+ "title": "Claims by Confidence Level",
824
+ "gridPos": {"h": 8, "w": 12, "x": 12, "y": 20},
825
+ "targets": [
826
+ {
827
+ "expr": "increase(agent_os_cmvk_claims_by_confidence[24h])",
828
+ "legendFormat": "{{confidence_bucket}}",
829
+ "refId": "A"
830
+ }
831
+ ],
832
+ "options": {
833
+ "displayMode": "gradient",
834
+ "orientation": "horizontal"
835
+ },
836
+ "fieldConfig": {
837
+ "defaults": {
838
+ "thresholds": {
839
+ "steps": [
840
+ {"color": "red", "value": None},
841
+ {"color": "yellow", "value": 0},
842
+ {"color": "green", "value": 0}
843
+ ]
844
+ }
845
+ },
846
+ "overrides": [
847
+ {
848
+ "matcher": {"id": "byName", "options": "high"},
849
+ "properties": [{"id": "color", "value": {"mode": "fixed", "fixedColor": "green"}}]
850
+ },
851
+ {
852
+ "matcher": {"id": "byName", "options": "medium"},
853
+ "properties": [{"id": "color", "value": {"mode": "fixed", "fixedColor": "yellow"}}]
854
+ },
855
+ {
856
+ "matcher": {"id": "byName", "options": "low"},
857
+ "properties": [{"id": "color", "value": {"mode": "fixed", "fixedColor": "red"}}]
858
+ }
859
+ ]
860
+ }
861
+ },
862
+
863
+ # Row 5: Verification Duration
864
+ {
865
+ "id": 11,
866
+ "type": "heatmap",
867
+ "title": "Verification Duration Heatmap",
868
+ "gridPos": {"h": 8, "w": 12, "x": 0, "y": 28},
869
+ "targets": [
870
+ {
871
+ "expr": "sum(rate(agent_os_cmvk_verification_duration_seconds_bucket[1m])) by (le)",
872
+ "format": "heatmap",
873
+ "refId": "A"
874
+ }
875
+ ],
876
+ "options": {
877
+ "yAxis": {"unit": "s"}
878
+ }
879
+ },
880
+ {
881
+ "id": 12,
882
+ "type": "table",
883
+ "title": "Recent High-Drift Claims",
884
+ "description": "Claims with drift >0.20 that may need review",
885
+ "gridPos": {"h": 8, "w": 12, "x": 12, "y": 28},
886
+ "targets": [
887
+ {
888
+ "expr": "topk(10, agent_os_cmvk_drift_score > 0.20)",
889
+ "format": "table",
890
+ "refId": "A"
891
+ }
892
+ ]
893
+ }
894
+ ]
895
+ },
896
+ "folderId": 0,
897
+ "overwrite": True
898
+ }