control-zero 0.2.0__tar.gz → 0.3.0__tar.gz

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 (109) hide show
  1. {control_zero-0.2.0 → control_zero-0.3.0}/PKG-INFO +100 -9
  2. {control_zero-0.2.0 → control_zero-0.3.0}/README.md +96 -5
  3. control_zero-0.3.0/control_zero/__init__.py +97 -0
  4. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/client.py +412 -63
  5. control_zero-0.3.0/control_zero/integrations/__init__.py +20 -0
  6. control_zero-0.3.0/control_zero/integrations/anthropic.py +184 -0
  7. control_zero-0.3.0/control_zero/integrations/braintrust.py +143 -0
  8. control_zero-0.3.0/control_zero/integrations/google.py +182 -0
  9. control_zero-0.3.0/control_zero/integrations/google_adk/__init__.py +60 -0
  10. control_zero-0.3.0/control_zero/integrations/google_adk/agent.py +282 -0
  11. control_zero-0.3.0/control_zero/integrations/google_adk/tool.py +317 -0
  12. control_zero-0.3.0/control_zero/integrations/langfuse.py +177 -0
  13. control_zero-0.3.0/control_zero/integrations/litellm.py +135 -0
  14. control_zero-0.3.0/control_zero/integrations/openai.py +229 -0
  15. control_zero-0.3.0/control_zero/integrations/vercel_ai.py +133 -0
  16. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/base.py +5 -0
  17. control_zero-0.3.0/control_zero/policy/__init__.py +13 -0
  18. control_zero-0.3.0/control_zero/policy/bundle.py +706 -0
  19. control_zero-0.3.0/control_zero/policy/enforcer.py +187 -0
  20. control_zero-0.3.0/control_zero/secrets/keystore.py +121 -0
  21. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/types.py +11 -1
  22. {control_zero-0.2.0 → control_zero-0.3.0}/examples/README.md +7 -7
  23. {control_zero-0.2.0 → control_zero-0.3.0}/examples/analytics_agent.py +17 -17
  24. control_zero-0.3.0/examples/crewai-docs-pipeline/README.md +53 -0
  25. control_zero-0.3.0/examples/crewai-docs-pipeline/main.py +144 -0
  26. control_zero-0.3.0/examples/crewai-docs-pipeline/requirements.txt +3 -0
  27. control_zero-0.3.0/examples/customer-support-bot/README.md +51 -0
  28. control_zero-0.3.0/examples/customer-support-bot/main.py +222 -0
  29. control_zero-0.3.0/examples/customer-support-bot/requirements.txt +2 -0
  30. {control_zero-0.2.0 → control_zero-0.3.0}/examples/database_agent.py +3 -3
  31. {control_zero-0.2.0 → control_zero-0.3.0}/examples/github_agent.py +2 -2
  32. control_zero-0.3.0/examples/langchain-agent/README.md +51 -0
  33. control_zero-0.3.0/examples/langchain-agent/main.py +139 -0
  34. control_zero-0.3.0/examples/langchain-agent/requirements.txt +5 -0
  35. control_zero-0.3.0/examples/openrouter-multi-model/README.md +62 -0
  36. control_zero-0.3.0/examples/openrouter-multi-model/main.py +74 -0
  37. control_zero-0.3.0/examples/openrouter-multi-model/requirements.txt +2 -0
  38. control_zero-0.3.0/examples/policies.json +39 -0
  39. control_zero-0.3.0/examples/quickstart.py +41 -0
  40. control_zero-0.3.0/examples/rag-pipeline/README.md +61 -0
  41. control_zero-0.3.0/examples/rag-pipeline/main.py +205 -0
  42. control_zero-0.3.0/examples/rag-pipeline/requirements.txt +3 -0
  43. {control_zero-0.2.0 → control_zero-0.3.0}/examples/slack_bot.py +1 -1
  44. {control_zero-0.2.0 → control_zero-0.3.0}/pyproject.toml +4 -4
  45. {control_zero-0.2.0 → control_zero-0.3.0}/tests/test_client.py +82 -20
  46. control_zero-0.3.0/tests/test_governance.py +274 -0
  47. control_zero-0.3.0/tests/test_local_only.py +276 -0
  48. {control_zero-0.2.0 → control_zero-0.3.0}/tests/test_mcp_middleware.py +28 -11
  49. {control_zero-0.2.0 → control_zero-0.3.0}/tests/test_passthrough.py +1 -0
  50. {control_zero-0.2.0 → control_zero-0.3.0}/tests/test_policy.py +18 -15
  51. control_zero-0.3.0/tests/test_wrap_google.py +196 -0
  52. control_zero-0.2.0/control_zero/__init__.py +0 -31
  53. control_zero-0.2.0/control_zero/policy/__init__.py +0 -5
  54. control_zero-0.2.0/control_zero/policy/enforcer.py +0 -99
  55. {control_zero-0.2.0 → control_zero-0.3.0}/.gitignore +0 -0
  56. {control_zero-0.2.0 → control_zero-0.3.0}/LICENSE +0 -0
  57. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/integrations/crewai/__init__.py +0 -0
  58. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/integrations/crewai/agent.py +0 -0
  59. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/integrations/crewai/crew.py +0 -0
  60. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/integrations/crewai/task.py +0 -0
  61. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/integrations/crewai/tool.py +0 -0
  62. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/integrations/langchain/__init__.py +0 -0
  63. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/integrations/langchain/agent.py +0 -0
  64. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/integrations/langchain/callbacks.py +0 -0
  65. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/integrations/langchain/chain.py +0 -0
  66. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/integrations/langchain/graph.py +0 -0
  67. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/integrations/langchain/tool.py +0 -0
  68. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/__init__.py +0 -0
  69. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/anthropic/__init__.py +0 -0
  70. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/anthropic/client.py +0 -0
  71. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/anthropic/messages.py +0 -0
  72. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/cohere/__init__.py +0 -0
  73. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/cohere/client.py +0 -0
  74. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/gemini/__init__.py +0 -0
  75. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/gemini/client.py +0 -0
  76. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/groq/__init__.py +0 -0
  77. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/groq/client.py +0 -0
  78. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/mistral/__init__.py +0 -0
  79. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/mistral/client.py +0 -0
  80. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/ollama/__init__.py +0 -0
  81. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/ollama/client.py +0 -0
  82. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/openai/__init__.py +0 -0
  83. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/openai/chat.py +0 -0
  84. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/llm/openai/client.py +0 -0
  85. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/logging/__init__.py +0 -0
  86. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/logging/async_logger.py +0 -0
  87. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/mcp/__init__.py +0 -0
  88. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/mcp/middleware.py +0 -0
  89. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/secrets/__init__.py +0 -0
  90. {control_zero-0.2.0 → control_zero-0.3.0}/control_zero/secrets/manager.py +0 -0
  91. {control_zero-0.2.0 → control_zero-0.3.0}/examples/guides/crewai_governance.py +0 -0
  92. {control_zero-0.2.0 → control_zero-0.3.0}/examples/guides/langchain_governance.py +0 -0
  93. {control_zero-0.2.0 → control_zero-0.3.0}/examples/guides/langgraph_governance.py +0 -0
  94. {control_zero-0.2.0 → control_zero-0.3.0}/examples/guides/mcp_middleware.py +0 -0
  95. {control_zero-0.2.0 → control_zero-0.3.0}/examples/guides/provider_anthropic_governance.py +0 -0
  96. {control_zero-0.2.0 → control_zero-0.3.0}/examples/guides/provider_deepseek_governance.py +0 -0
  97. {control_zero-0.2.0 → control_zero-0.3.0}/examples/guides/provider_gemini_governance.py +0 -0
  98. {control_zero-0.2.0 → control_zero-0.3.0}/examples/guides/provider_groq_governance.py +0 -0
  99. {control_zero-0.2.0 → control_zero-0.3.0}/examples/guides/provider_moonshot_governance.py +0 -0
  100. {control_zero-0.2.0 → control_zero-0.3.0}/examples/guides/provider_openai_governance.py +0 -0
  101. {control_zero-0.2.0 → control_zero-0.3.0}/examples/multi_tool_agent.py +0 -0
  102. {control_zero-0.2.0 → control_zero-0.3.0}/tests/__init__.py +0 -0
  103. {control_zero-0.2.0 → control_zero-0.3.0}/tests/conftest.py +0 -0
  104. {control_zero-0.2.0 → control_zero-0.3.0}/tests/test_crewai_integration.py +0 -0
  105. {control_zero-0.2.0 → control_zero-0.3.0}/tests/test_langchain_integration.py +0 -0
  106. {control_zero-0.2.0 → control_zero-0.3.0}/tests/test_live_api.py +0 -0
  107. {control_zero-0.2.0 → control_zero-0.3.0}/tests/test_llm_wrappers.py +0 -0
  108. {control_zero-0.2.0 → control_zero-0.3.0}/tests/test_secrets.py +0 -0
  109. {control_zero-0.2.0 → control_zero-0.3.0}/tests/test_types.py +0 -0
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: control-zero
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Enterprise MCP governance SDK - secrets, policies, and observability
5
- Project-URL: Homepage, https://controlzero.dev
6
- Project-URL: Documentation, https://docs.controlzero.dev
7
- Author-email: Control Zero <hello@controlzero.dev>
5
+ Project-URL: Homepage, https://controlzero.ai
6
+ Project-URL: Documentation, https://docs.controlzero.ai
7
+ Author-email: Control Zero <hello@controlzero.ai>
8
8
  License: Proprietary
9
9
  License-File: LICENSE
10
10
  Keywords: governance,mcp,observability,policy,secrets
@@ -47,11 +47,11 @@ Provides-Extra: mcp
47
47
  Requires-Dist: mcp>=0.1.0; extra == 'mcp'
48
48
  Description-Content-Type: text/markdown
49
49
 
50
- # Control Zero Python SDK
50
+ # control-zero
51
51
 
52
- Enterprise MCP governance - secrets, policies, and observability for AI agents.
52
+ AI agent governance SDK for Python.
53
53
 
54
- ## Installation
54
+ ## Install
55
55
 
56
56
  ```bash
57
57
  pip install control-zero
@@ -62,6 +62,48 @@ pip install control-zero
62
62
  ```python
63
63
  from control_zero import ControlZeroClient
64
64
 
65
+ cz = ControlZeroClient(api_key="cz_test_yourkey")
66
+
67
+ # Log a tool call
68
+ cz.log_tool_call("my-agent", "github", "list_issues", {"repo": "myorg/myrepo"})
69
+ ```
70
+
71
+ ## With OpenAI
72
+
73
+ ```python
74
+ from control_zero.integrations.openai import GovernedOpenAI
75
+ import openai
76
+
77
+ cz = ControlZeroClient(api_key="cz_test_yourkey")
78
+ client = GovernedOpenAI(openai.OpenAI(), cz)
79
+ response = client.chat.completions.create(
80
+ model="gpt-4o",
81
+ messages=[{"role": "user", "content": "Hello"}]
82
+ )
83
+ # Token counts and costs are tracked automatically
84
+ ```
85
+
86
+ ## With Anthropic
87
+
88
+ ```python
89
+ from control_zero.integrations.anthropic import GovernedAnthropic
90
+ import anthropic
91
+
92
+ cz = ControlZeroClient(api_key="cz_test_yourkey")
93
+ client = GovernedAnthropic(anthropic.Anthropic(), cz)
94
+ response = client.messages.create(
95
+ model="claude-opus-4-5",
96
+ max_tokens=1024,
97
+ messages=[{"role": "user", "content": "Hello"}]
98
+ )
99
+ # Token counts and costs are tracked automatically
100
+ ```
101
+
102
+ ## Full Client API
103
+
104
+ ```python
105
+ from control_zero import ControlZeroClient
106
+
65
107
  # Initialize with your API key
66
108
  client = ControlZeroClient(api_key="cz_live_xxx")
67
109
 
@@ -80,6 +122,7 @@ client.close()
80
122
  ### Automatic Secret Injection
81
123
 
82
124
  Secrets configured in the Control Zero dashboard are automatically:
125
+
83
126
  1. Fetched encrypted from the server
84
127
  2. Decrypted in memory
85
128
  3. Injected into your MCP calls
@@ -153,10 +196,58 @@ result = await wrapped.call_tool("github", "list_issues")
153
196
  client = ControlZeroClient(
154
197
  api_key="cz_live_xxx", # Required
155
198
  agent_name="marketing-bot", # Optional, for logging
156
- base_url="https://api.controlzero.dev", # Or self-hosted
199
+ base_url="https://api.controlzero.ai", # Or self-hosted
157
200
  )
158
201
  ```
159
202
 
203
+ ## Deployment Modes
204
+
205
+ Control Zero supports three deployment modes for different environments:
206
+
207
+ ### Cloud Mode (Default)
208
+
209
+ Policies are fetched from the API on initialization. Best for cloud deployments with internet connectivity.
210
+
211
+ ```python
212
+ client = ControlZeroClient(api_key="cz_live_xxx")
213
+ # Policies automatically fetched from API
214
+ ```
215
+
216
+ ### Hybrid Mode (Recommended for Production)
217
+
218
+ Policies are cached locally and refreshed in the background. Works offline with cached policies.
219
+
220
+ ```python
221
+ client = ControlZeroClient(
222
+ api_key="cz_live_xxx",
223
+ policy_mode="hybrid",
224
+ policy_cache_path="./cache/policies.json", # Optional
225
+ policy_refresh_interval=300, # Refresh every 5 minutes
226
+ )
227
+ ```
228
+
229
+ ### Local Mode (Air-Gapped)
230
+
231
+ Policies are loaded from a local file. No network calls for policy fetching.
232
+
233
+ ```python
234
+ client = ControlZeroClient(
235
+ api_key="cz_live_xxx",
236
+ policy_mode="local",
237
+ policy_path="./policies.czpolicy",
238
+ )
239
+ ```
240
+
241
+ Download policy bundles from your project dashboard or via API:
242
+
243
+ ```bash
244
+ curl -H "Authorization: Bearer $API_KEY" \
245
+ https://api.controlzero.ai/api/projects/{projectID}/policies/download \
246
+ -o policies.czpolicy
247
+ ```
248
+
249
+ See [deployment modes documentation](https://docs.controlzero.ai/deployment-modes) for detailed comparison and migration guides.
250
+
160
251
  ## API Key Types
161
252
 
162
253
  - `cz_live_*` - Production keys (real secrets, real logging)
@@ -207,7 +298,7 @@ See the [examples/](./examples/) directory for complete usage examples:
207
298
 
208
299
  - **slack_bot.py** - Secure Slack messaging with channel restrictions
209
300
  - **database_agent.py** - PostgreSQL with read-only policies
210
- - **analytics_agent.py** - ClickHouse queries with governance
301
+ - **analytics_agent.py** - Analytics queries with governance
211
302
  - **github_agent.py** - GitHub operations with branch protection
212
303
  - **multi_tool_agent.py** - Complete multi-tool workflow
213
304
 
@@ -1,8 +1,8 @@
1
- # Control Zero Python SDK
1
+ # control-zero
2
2
 
3
- Enterprise MCP governance - secrets, policies, and observability for AI agents.
3
+ AI agent governance SDK for Python.
4
4
 
5
- ## Installation
5
+ ## Install
6
6
 
7
7
  ```bash
8
8
  pip install control-zero
@@ -13,6 +13,48 @@ pip install control-zero
13
13
  ```python
14
14
  from control_zero import ControlZeroClient
15
15
 
16
+ cz = ControlZeroClient(api_key="cz_test_yourkey")
17
+
18
+ # Log a tool call
19
+ cz.log_tool_call("my-agent", "github", "list_issues", {"repo": "myorg/myrepo"})
20
+ ```
21
+
22
+ ## With OpenAI
23
+
24
+ ```python
25
+ from control_zero.integrations.openai import GovernedOpenAI
26
+ import openai
27
+
28
+ cz = ControlZeroClient(api_key="cz_test_yourkey")
29
+ client = GovernedOpenAI(openai.OpenAI(), cz)
30
+ response = client.chat.completions.create(
31
+ model="gpt-4o",
32
+ messages=[{"role": "user", "content": "Hello"}]
33
+ )
34
+ # Token counts and costs are tracked automatically
35
+ ```
36
+
37
+ ## With Anthropic
38
+
39
+ ```python
40
+ from control_zero.integrations.anthropic import GovernedAnthropic
41
+ import anthropic
42
+
43
+ cz = ControlZeroClient(api_key="cz_test_yourkey")
44
+ client = GovernedAnthropic(anthropic.Anthropic(), cz)
45
+ response = client.messages.create(
46
+ model="claude-opus-4-5",
47
+ max_tokens=1024,
48
+ messages=[{"role": "user", "content": "Hello"}]
49
+ )
50
+ # Token counts and costs are tracked automatically
51
+ ```
52
+
53
+ ## Full Client API
54
+
55
+ ```python
56
+ from control_zero import ControlZeroClient
57
+
16
58
  # Initialize with your API key
17
59
  client = ControlZeroClient(api_key="cz_live_xxx")
18
60
 
@@ -31,6 +73,7 @@ client.close()
31
73
  ### Automatic Secret Injection
32
74
 
33
75
  Secrets configured in the Control Zero dashboard are automatically:
76
+
34
77
  1. Fetched encrypted from the server
35
78
  2. Decrypted in memory
36
79
  3. Injected into your MCP calls
@@ -104,10 +147,58 @@ result = await wrapped.call_tool("github", "list_issues")
104
147
  client = ControlZeroClient(
105
148
  api_key="cz_live_xxx", # Required
106
149
  agent_name="marketing-bot", # Optional, for logging
107
- base_url="https://api.controlzero.dev", # Or self-hosted
150
+ base_url="https://api.controlzero.ai", # Or self-hosted
108
151
  )
109
152
  ```
110
153
 
154
+ ## Deployment Modes
155
+
156
+ Control Zero supports three deployment modes for different environments:
157
+
158
+ ### Cloud Mode (Default)
159
+
160
+ Policies are fetched from the API on initialization. Best for cloud deployments with internet connectivity.
161
+
162
+ ```python
163
+ client = ControlZeroClient(api_key="cz_live_xxx")
164
+ # Policies automatically fetched from API
165
+ ```
166
+
167
+ ### Hybrid Mode (Recommended for Production)
168
+
169
+ Policies are cached locally and refreshed in the background. Works offline with cached policies.
170
+
171
+ ```python
172
+ client = ControlZeroClient(
173
+ api_key="cz_live_xxx",
174
+ policy_mode="hybrid",
175
+ policy_cache_path="./cache/policies.json", # Optional
176
+ policy_refresh_interval=300, # Refresh every 5 minutes
177
+ )
178
+ ```
179
+
180
+ ### Local Mode (Air-Gapped)
181
+
182
+ Policies are loaded from a local file. No network calls for policy fetching.
183
+
184
+ ```python
185
+ client = ControlZeroClient(
186
+ api_key="cz_live_xxx",
187
+ policy_mode="local",
188
+ policy_path="./policies.czpolicy",
189
+ )
190
+ ```
191
+
192
+ Download policy bundles from your project dashboard or via API:
193
+
194
+ ```bash
195
+ curl -H "Authorization: Bearer $API_KEY" \
196
+ https://api.controlzero.ai/api/projects/{projectID}/policies/download \
197
+ -o policies.czpolicy
198
+ ```
199
+
200
+ See [deployment modes documentation](https://docs.controlzero.ai/deployment-modes) for detailed comparison and migration guides.
201
+
111
202
  ## API Key Types
112
203
 
113
204
  - `cz_live_*` - Production keys (real secrets, real logging)
@@ -158,7 +249,7 @@ See the [examples/](./examples/) directory for complete usage examples:
158
249
 
159
250
  - **slack_bot.py** - Secure Slack messaging with channel restrictions
160
251
  - **database_agent.py** - PostgreSQL with read-only policies
161
- - **analytics_agent.py** - ClickHouse queries with governance
252
+ - **analytics_agent.py** - Analytics queries with governance
162
253
  - **github_agent.py** - GitHub operations with branch protection
163
254
  - **multi_tool_agent.py** - Complete multi-tool workflow
164
255
 
@@ -0,0 +1,97 @@
1
+ """
2
+ Control Zero - Enterprise MCP Governance SDK
3
+
4
+ The "magic" SDK that handles authentication, secret injection, policy enforcement,
5
+ and observability for MCP tool calls.
6
+
7
+ Usage:
8
+ import controlzero
9
+
10
+ # Quickstart: one-line init using CZ_API_KEY env var
11
+ cz = controlzero.init()
12
+
13
+ # Or explicitly:
14
+ from control_zero import ControlZeroClient
15
+ client = ControlZeroClient(api_key="cz_live_xxx")
16
+
17
+ # Call MCP tools - secrets are injected automatically
18
+ result = client.call_tool("github", "list_issues", {"repo": "acme/app"})
19
+ """
20
+
21
+ from control_zero.client import ControlZeroClient, AsyncControlZeroClient
22
+ from control_zero.mcp import MCPMiddleware
23
+ from control_zero.policy import (
24
+ PolicyDecision,
25
+ PolicyDeniedError,
26
+ BundleVerificationError,
27
+ BundleTamperError,
28
+ )
29
+ from control_zero.types import ToolConfig, SessionConfig
30
+
31
+ # Alias: docs and quickstart reference `ControlZero` and `controlzero.init()`
32
+ ControlZero = ControlZeroClient
33
+
34
+
35
+ def init(api_key: str = None, **kwargs) -> ControlZeroClient:
36
+ """Create and return a ControlZeroClient.
37
+
38
+ Reads the CZ_API_KEY environment variable if api_key is not provided.
39
+ The client lazily initializes on first use, so calling init() alone does
40
+ not make a network request.
41
+
42
+ For local-only mode (no API key, no account), pass policy_path
43
+ without an api_key::
44
+
45
+ cz = controlzero.init(policy_path="./policies.json")
46
+
47
+ Args:
48
+ api_key: A Control Zero API key (cz_live_* or cz_test_*).
49
+ Falls back to the CZ_API_KEY environment variable.
50
+ Can be omitted when policy_path is provided (local-only mode).
51
+ **kwargs: Additional keyword arguments forwarded to ControlZeroClient.
52
+
53
+ Returns:
54
+ A configured ControlZeroClient instance.
55
+ """
56
+ import os
57
+ key = api_key or os.environ.get("CZ_API_KEY") or None
58
+ client = ControlZeroClient(api_key=key, **kwargs)
59
+ return client
60
+
61
+
62
+ __version__ = "0.2.0"
63
+
64
+ # Pre-release build warning
65
+ # Versions like 0.3.0a1, 0.3.0.dev1, or anything with 'a', 'b', 'rc', 'dev'
66
+ # are test builds published from CI. They are NOT connected to production
67
+ # accounts and may contain breaking changes.
68
+ import re as _re
69
+ if _re.search(r"(a|b|rc|dev)\d*$", __version__):
70
+ import warnings as _warnings
71
+ _warnings.warn(
72
+ f"\n"
73
+ f" You are using a TEST BUILD of control-zero (v{__version__}).\n"
74
+ f" This build is not stable and may contain breaking changes.\n"
75
+ f" It is NOT connected to your production account.\n"
76
+ f"\n"
77
+ f" For production use, install the stable version:\n"
78
+ f" pip install control-zero\n"
79
+ f"\n"
80
+ f" Test builds are for development and evaluation only.",
81
+ UserWarning,
82
+ stacklevel=2,
83
+ )
84
+
85
+ __all__ = [
86
+ "ControlZeroClient",
87
+ "AsyncControlZeroClient",
88
+ "ControlZero",
89
+ "init",
90
+ "MCPMiddleware",
91
+ "PolicyDecision",
92
+ "PolicyDeniedError",
93
+ "BundleVerificationError",
94
+ "BundleTamperError",
95
+ "ToolConfig",
96
+ "SessionConfig",
97
+ ]