axonflow 0.11.0__tar.gz → 1.4.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 (45) hide show
  1. {axonflow-0.11.0 → axonflow-1.4.0}/PKG-INFO +129 -8
  2. {axonflow-0.11.0 → axonflow-1.4.0}/README.md +128 -7
  3. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/__init__.py +5 -5
  4. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/client.py +794 -90
  5. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/code_governance.py +14 -1
  6. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/policies.py +52 -25
  7. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/types.py +221 -9
  8. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow.egg-info/PKG-INFO +129 -8
  9. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow.egg-info/SOURCES.txt +5 -0
  10. {axonflow-0.11.0 → axonflow-1.4.0}/pyproject.toml +3 -3
  11. axonflow-1.4.0/tests/test_audit.py +402 -0
  12. {axonflow-0.11.0 → axonflow-1.4.0}/tests/test_auth_headers.py +64 -105
  13. {axonflow-0.11.0 → axonflow-1.4.0}/tests/test_client.py +511 -23
  14. axonflow-1.4.0/tests/test_client_coverage.py +252 -0
  15. axonflow-1.4.0/tests/test_cost_controls.py +558 -0
  16. {axonflow-0.11.0 → axonflow-1.4.0}/tests/test_gateway.py +61 -0
  17. {axonflow-0.11.0 → axonflow-1.4.0}/tests/test_integration.py +1 -1
  18. axonflow-1.4.0/tests/test_interceptors_coverage.py +384 -0
  19. axonflow-1.4.0/tests/test_interceptors_execution.py +1064 -0
  20. {axonflow-0.11.0 → axonflow-1.4.0}/tests/test_policies.py +41 -38
  21. {axonflow-0.11.0 → axonflow-1.4.0}/tests/test_selfhosted_zero_config.py +9 -19
  22. {axonflow-0.11.0 → axonflow-1.4.0}/tests/test_types.py +8 -8
  23. {axonflow-0.11.0 → axonflow-1.4.0}/LICENSE +0 -0
  24. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/exceptions.py +0 -0
  25. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/interceptors/__init__.py +0 -0
  26. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/interceptors/anthropic.py +0 -0
  27. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/interceptors/base.py +0 -0
  28. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/interceptors/bedrock.py +0 -0
  29. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/interceptors/gemini.py +0 -0
  30. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/interceptors/ollama.py +0 -0
  31. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/interceptors/openai.py +0 -0
  32. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/py.typed +0 -0
  33. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/utils/__init__.py +0 -0
  34. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/utils/cache.py +0 -0
  35. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/utils/logging.py +0 -0
  36. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow/utils/retry.py +0 -0
  37. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow.egg-info/dependency_links.txt +0 -0
  38. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow.egg-info/requires.txt +0 -0
  39. {axonflow-0.11.0 → axonflow-1.4.0}/axonflow.egg-info/top_level.txt +0 -0
  40. {axonflow-0.11.0 → axonflow-1.4.0}/setup.cfg +0 -0
  41. {axonflow-0.11.0 → axonflow-1.4.0}/setup.py +0 -0
  42. {axonflow-0.11.0 → axonflow-1.4.0}/tests/test_contract.py +0 -0
  43. {axonflow-0.11.0 → axonflow-1.4.0}/tests/test_exceptions.py +0 -0
  44. {axonflow-0.11.0 → axonflow-1.4.0}/tests/test_interceptors.py +0 -0
  45. {axonflow-0.11.0 → axonflow-1.4.0}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: axonflow
3
- Version: 0.11.0
3
+ Version: 1.4.0
4
4
  Summary: AxonFlow Python SDK - Enterprise AI Governance in 3 Lines of Code
5
5
  Author-email: AxonFlow <dev@getaxonflow.com>
6
6
  Maintainer-email: AxonFlow <dev@getaxonflow.com>
@@ -89,7 +89,7 @@ from axonflow import AxonFlow
89
89
 
90
90
  async def main():
91
91
  async with AxonFlow(
92
- agent_url="https://your-agent.axonflow.com",
92
+ endpoint="https://your-agent.axonflow.com",
93
93
  client_id="your-client-id",
94
94
  client_secret="your-client-secret"
95
95
  ) as client:
@@ -110,7 +110,7 @@ asyncio.run(main())
110
110
  from axonflow import AxonFlow
111
111
 
112
112
  with AxonFlow.sync(
113
- agent_url="https://your-agent.axonflow.com",
113
+ endpoint="https://your-agent.axonflow.com",
114
114
  client_id="your-client-id",
115
115
  client_secret="your-client-secret"
116
116
  ) as client:
@@ -202,6 +202,38 @@ result = await client.query_connector(
202
202
  )
203
203
  ```
204
204
 
205
+ ### MCP Policy Features (v3.2.0)
206
+
207
+ **Exfiltration Detection** - Prevent large-scale data extraction:
208
+
209
+ ```python
210
+ # Query with exfiltration limits (default: 10K rows, 10MB)
211
+ result = await client.query_connector(
212
+ user_token="user-jwt",
213
+ connector_name="postgres",
214
+ operation="query",
215
+ params={"sql": "SELECT * FROM customers"}
216
+ )
217
+
218
+ # Check exfiltration info
219
+ if result.policy_info.exfiltration_check.exceeded:
220
+ print(f"Limit exceeded: {result.policy_info.exfiltration_check.limit_type}")
221
+
222
+ # Configure: MCP_MAX_ROWS_PER_QUERY=1000, MCP_MAX_BYTES_PER_QUERY=5242880
223
+ ```
224
+
225
+ **Dynamic Policy Evaluation** - Orchestrator-based rate limiting, budget controls:
226
+
227
+ ```python
228
+ # Response includes dynamic policy info when enabled
229
+ if result.policy_info.dynamic_policy_info.orchestrator_reachable:
230
+ print(f"Policies evaluated: {result.policy_info.dynamic_policy_info.policies_evaluated}")
231
+ for policy in result.policy_info.dynamic_policy_info.matched_policies:
232
+ print(f" {policy.policy_name}: {policy.action}")
233
+
234
+ # Enable: MCP_DYNAMIC_POLICIES_ENABLED=true
235
+ ```
236
+
205
237
  ### Multi-Agent Planning
206
238
 
207
239
  Generate and execute multi-agent plans:
@@ -226,10 +258,9 @@ print(f"Result: {result.result}")
226
258
  from axonflow import AxonFlow, Mode, RetryConfig
227
259
 
228
260
  client = AxonFlow(
229
- agent_url="https://your-agent.axonflow.com",
230
- client_id="your-client-id",
231
- client_secret="your-client-secret",
232
- license_key="optional-license-key", # For enterprise features
261
+ endpoint="https://your-agent.axonflow.com",
262
+ client_id="your-client-id", # Required for enterprise features
263
+ client_secret="your-client-secret", # Required for enterprise features
233
264
  mode=Mode.PRODUCTION, # or Mode.SANDBOX
234
265
  debug=True, # Enable debug logging
235
266
  timeout=60.0, # Request timeout in seconds
@@ -305,12 +336,102 @@ ruff format .
305
336
  mypy axonflow
306
337
  ```
307
338
 
339
+ ## Examples
340
+
341
+ Complete working examples for all features are available in the [examples folder](https://github.com/getaxonflow/axonflow/tree/main/examples).
342
+
343
+ ### Community Features
344
+
345
+ ```python
346
+ # PII Detection - Automatically detect sensitive data
347
+ result = await client.get_policy_approved_context(
348
+ user_token="user-123",
349
+ query="My SSN is 123-45-6789"
350
+ )
351
+ # result.approved = True, result.requires_redaction = True (SSN detected)
352
+
353
+ # SQL Injection Detection - Block malicious queries
354
+ result = await client.get_policy_approved_context(
355
+ user_token="user-123",
356
+ query="SELECT * FROM users; DROP TABLE users;"
357
+ )
358
+ # result.approved = False, result.block_reason = "SQL injection detected"
359
+
360
+ # Static Policies - List and manage built-in policies
361
+ policies = await client.list_policies()
362
+ # Returns: [Policy(name="pii-detection", enabled=True), ...]
363
+
364
+ # Dynamic Policies - Create runtime policies
365
+ await client.create_dynamic_policy(
366
+ name="block-competitor-queries",
367
+ conditions={"contains": ["competitor", "pricing"]},
368
+ action="block"
369
+ )
370
+
371
+ # MCP Connectors - Query external data sources
372
+ resp = await client.query_connector(
373
+ user_token="user-123",
374
+ connector_name="postgres-db",
375
+ operation="query",
376
+ params={"sql": "SELECT name FROM customers"}
377
+ )
378
+
379
+ # Multi-Agent Planning - Orchestrate complex workflows
380
+ plan = await client.generate_plan(
381
+ query="Research AI governance regulations",
382
+ domain="legal"
383
+ )
384
+ result = await client.execute_plan(plan.plan_id)
385
+
386
+ # Audit Logging - Track all LLM interactions
387
+ await client.audit_llm_call(
388
+ context_id=ctx.context_id,
389
+ response_summary="AI response summary",
390
+ provider="openai",
391
+ model="gpt-4",
392
+ token_usage=TokenUsage(prompt_tokens=100, completion_tokens=200, total_tokens=300),
393
+ latency_ms=450
394
+ )
395
+ ```
396
+
397
+ ### Enterprise Features
398
+
399
+ These features require an AxonFlow Enterprise license:
400
+
401
+ ```python
402
+ # Code Governance - Automated PR reviews with AI
403
+ pr_result = await client.review_pull_request(
404
+ repo_owner="your-org",
405
+ repo_name="your-repo",
406
+ pr_number=123,
407
+ check_types=["security", "style", "performance"]
408
+ )
409
+
410
+ # Cost Controls - Budget management for LLM usage
411
+ budget = await client.get_budget("team-engineering")
412
+ # Returns: Budget(limit=1000.00, used=234.56, remaining=765.44)
413
+
414
+ # MCP Policy Enforcement - Automatic PII redaction in connector responses
415
+ resp = await client.query_connector("user", "postgres", "SELECT * FROM customers", {})
416
+ # resp.policy_info.redacted = True
417
+ # resp.policy_info.redacted_fields = ["ssn", "credit_card"]
418
+ ```
419
+
420
+ For enterprise features, contact [sales@getaxonflow.com](mailto:sales@getaxonflow.com).
421
+
308
422
  ## Documentation
309
423
 
310
424
  - [Getting Started](https://docs.getaxonflow.com/sdk/python-getting-started)
311
425
  - [Gateway Mode Guide](https://docs.getaxonflow.com/sdk/gateway-mode)
312
- - [Examples](https://github.com/getaxonflow/axonflow/tree/main/examples)
426
+
427
+ ## Support
428
+
429
+ - **Documentation**: https://docs.getaxonflow.com
430
+ - **Issues**: https://github.com/getaxonflow/axonflow-sdk-python/issues
431
+ - **Email**: dev@getaxonflow.com
313
432
 
314
433
  ## License
315
434
 
316
435
  MIT - See [LICENSE](LICENSE) for details.
436
+
437
+ <img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=fbda6e64-1812-428b-b135-ed2b548ce50d" />
@@ -30,7 +30,7 @@ from axonflow import AxonFlow
30
30
 
31
31
  async def main():
32
32
  async with AxonFlow(
33
- agent_url="https://your-agent.axonflow.com",
33
+ endpoint="https://your-agent.axonflow.com",
34
34
  client_id="your-client-id",
35
35
  client_secret="your-client-secret"
36
36
  ) as client:
@@ -51,7 +51,7 @@ asyncio.run(main())
51
51
  from axonflow import AxonFlow
52
52
 
53
53
  with AxonFlow.sync(
54
- agent_url="https://your-agent.axonflow.com",
54
+ endpoint="https://your-agent.axonflow.com",
55
55
  client_id="your-client-id",
56
56
  client_secret="your-client-secret"
57
57
  ) as client:
@@ -143,6 +143,38 @@ result = await client.query_connector(
143
143
  )
144
144
  ```
145
145
 
146
+ ### MCP Policy Features (v3.2.0)
147
+
148
+ **Exfiltration Detection** - Prevent large-scale data extraction:
149
+
150
+ ```python
151
+ # Query with exfiltration limits (default: 10K rows, 10MB)
152
+ result = await client.query_connector(
153
+ user_token="user-jwt",
154
+ connector_name="postgres",
155
+ operation="query",
156
+ params={"sql": "SELECT * FROM customers"}
157
+ )
158
+
159
+ # Check exfiltration info
160
+ if result.policy_info.exfiltration_check.exceeded:
161
+ print(f"Limit exceeded: {result.policy_info.exfiltration_check.limit_type}")
162
+
163
+ # Configure: MCP_MAX_ROWS_PER_QUERY=1000, MCP_MAX_BYTES_PER_QUERY=5242880
164
+ ```
165
+
166
+ **Dynamic Policy Evaluation** - Orchestrator-based rate limiting, budget controls:
167
+
168
+ ```python
169
+ # Response includes dynamic policy info when enabled
170
+ if result.policy_info.dynamic_policy_info.orchestrator_reachable:
171
+ print(f"Policies evaluated: {result.policy_info.dynamic_policy_info.policies_evaluated}")
172
+ for policy in result.policy_info.dynamic_policy_info.matched_policies:
173
+ print(f" {policy.policy_name}: {policy.action}")
174
+
175
+ # Enable: MCP_DYNAMIC_POLICIES_ENABLED=true
176
+ ```
177
+
146
178
  ### Multi-Agent Planning
147
179
 
148
180
  Generate and execute multi-agent plans:
@@ -167,10 +199,9 @@ print(f"Result: {result.result}")
167
199
  from axonflow import AxonFlow, Mode, RetryConfig
168
200
 
169
201
  client = AxonFlow(
170
- agent_url="https://your-agent.axonflow.com",
171
- client_id="your-client-id",
172
- client_secret="your-client-secret",
173
- license_key="optional-license-key", # For enterprise features
202
+ endpoint="https://your-agent.axonflow.com",
203
+ client_id="your-client-id", # Required for enterprise features
204
+ client_secret="your-client-secret", # Required for enterprise features
174
205
  mode=Mode.PRODUCTION, # or Mode.SANDBOX
175
206
  debug=True, # Enable debug logging
176
207
  timeout=60.0, # Request timeout in seconds
@@ -246,12 +277,102 @@ ruff format .
246
277
  mypy axonflow
247
278
  ```
248
279
 
280
+ ## Examples
281
+
282
+ Complete working examples for all features are available in the [examples folder](https://github.com/getaxonflow/axonflow/tree/main/examples).
283
+
284
+ ### Community Features
285
+
286
+ ```python
287
+ # PII Detection - Automatically detect sensitive data
288
+ result = await client.get_policy_approved_context(
289
+ user_token="user-123",
290
+ query="My SSN is 123-45-6789"
291
+ )
292
+ # result.approved = True, result.requires_redaction = True (SSN detected)
293
+
294
+ # SQL Injection Detection - Block malicious queries
295
+ result = await client.get_policy_approved_context(
296
+ user_token="user-123",
297
+ query="SELECT * FROM users; DROP TABLE users;"
298
+ )
299
+ # result.approved = False, result.block_reason = "SQL injection detected"
300
+
301
+ # Static Policies - List and manage built-in policies
302
+ policies = await client.list_policies()
303
+ # Returns: [Policy(name="pii-detection", enabled=True), ...]
304
+
305
+ # Dynamic Policies - Create runtime policies
306
+ await client.create_dynamic_policy(
307
+ name="block-competitor-queries",
308
+ conditions={"contains": ["competitor", "pricing"]},
309
+ action="block"
310
+ )
311
+
312
+ # MCP Connectors - Query external data sources
313
+ resp = await client.query_connector(
314
+ user_token="user-123",
315
+ connector_name="postgres-db",
316
+ operation="query",
317
+ params={"sql": "SELECT name FROM customers"}
318
+ )
319
+
320
+ # Multi-Agent Planning - Orchestrate complex workflows
321
+ plan = await client.generate_plan(
322
+ query="Research AI governance regulations",
323
+ domain="legal"
324
+ )
325
+ result = await client.execute_plan(plan.plan_id)
326
+
327
+ # Audit Logging - Track all LLM interactions
328
+ await client.audit_llm_call(
329
+ context_id=ctx.context_id,
330
+ response_summary="AI response summary",
331
+ provider="openai",
332
+ model="gpt-4",
333
+ token_usage=TokenUsage(prompt_tokens=100, completion_tokens=200, total_tokens=300),
334
+ latency_ms=450
335
+ )
336
+ ```
337
+
338
+ ### Enterprise Features
339
+
340
+ These features require an AxonFlow Enterprise license:
341
+
342
+ ```python
343
+ # Code Governance - Automated PR reviews with AI
344
+ pr_result = await client.review_pull_request(
345
+ repo_owner="your-org",
346
+ repo_name="your-repo",
347
+ pr_number=123,
348
+ check_types=["security", "style", "performance"]
349
+ )
350
+
351
+ # Cost Controls - Budget management for LLM usage
352
+ budget = await client.get_budget("team-engineering")
353
+ # Returns: Budget(limit=1000.00, used=234.56, remaining=765.44)
354
+
355
+ # MCP Policy Enforcement - Automatic PII redaction in connector responses
356
+ resp = await client.query_connector("user", "postgres", "SELECT * FROM customers", {})
357
+ # resp.policy_info.redacted = True
358
+ # resp.policy_info.redacted_fields = ["ssn", "credit_card"]
359
+ ```
360
+
361
+ For enterprise features, contact [sales@getaxonflow.com](mailto:sales@getaxonflow.com).
362
+
249
363
  ## Documentation
250
364
 
251
365
  - [Getting Started](https://docs.getaxonflow.com/sdk/python-getting-started)
252
366
  - [Gateway Mode Guide](https://docs.getaxonflow.com/sdk/gateway-mode)
253
- - [Examples](https://github.com/getaxonflow/axonflow/tree/main/examples)
367
+
368
+ ## Support
369
+
370
+ - **Documentation**: https://docs.getaxonflow.com
371
+ - **Issues**: https://github.com/getaxonflow/axonflow-sdk-python/issues
372
+ - **Email**: dev@getaxonflow.com
254
373
 
255
374
  ## License
256
375
 
257
376
  MIT - See [LICENSE](LICENSE) for details.
377
+
378
+ <img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=fbda6e64-1812-428b-b135-ed2b548ce50d" />
@@ -9,7 +9,7 @@ Example:
9
9
  >>>
10
10
  >>> # Async usage
11
11
  >>> async with AxonFlow(
12
- ... agent_url="https://your-agent.axonflow.com",
12
+ ... endpoint="https://your-agent.axonflow.com",
13
13
  ... client_id="your-client-id",
14
14
  ... client_secret="your-client-secret"
15
15
  ... ) as client:
@@ -18,7 +18,7 @@ Example:
18
18
  >>>
19
19
  >>> # Sync usage
20
20
  >>> client = AxonFlow.sync(
21
- ... agent_url="https://your-agent.axonflow.com",
21
+ ... endpoint="https://your-agent.axonflow.com",
22
22
  ... client_id="your-client-id",
23
23
  ... client_secret="your-client-secret"
24
24
  ... )
@@ -61,8 +61,8 @@ from axonflow.policies import (
61
61
  CreatePolicyOverrideRequest,
62
62
  CreateStaticPolicyRequest,
63
63
  DynamicPolicy,
64
+ DynamicPolicyAction,
64
65
  DynamicPolicyCondition,
65
- DynamicPolicyConfig,
66
66
  EffectivePoliciesOptions,
67
67
  ListDynamicPoliciesOptions,
68
68
  ListStaticPoliciesOptions,
@@ -128,7 +128,7 @@ from axonflow.types import (
128
128
  UsageSummary,
129
129
  )
130
130
 
131
- __version__ = "0.6.0"
131
+ __version__ = "1.2.0"
132
132
  __all__ = [
133
133
  # Main client
134
134
  "AxonFlow",
@@ -173,7 +173,7 @@ __all__ = [
173
173
  "DynamicPolicy",
174
174
  "PolicyOverride",
175
175
  "PolicyVersion",
176
- "DynamicPolicyConfig",
176
+ "DynamicPolicyAction",
177
177
  "DynamicPolicyCondition",
178
178
  "TestPatternResult",
179
179
  "TestPatternMatch",