agenticdome-python-sdk 1.1.0__py3-none-any.whl → 1.1.2__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,8 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agenticdome-python-sdk
3
- Version: 1.1.0
4
- Summary: Official Python SDK for AgentGuard Intelligence Engine and Action Firewall.
5
- Home-page: https://github.com/agenticdome/agenticdome-python-sdk-python
3
+ Version: 1.1.2
4
+ Summary: Official Python SDK for AgenticDome security guardrails, DLP, tool authorization, and multi-agent delegation enforcement.
6
5
  Author: AgenticDome
7
6
  License: Proprietary
8
7
  Project-URL: Homepage, https://au.agenticdome.io
@@ -84,9 +83,9 @@ Requires-Dist: ruff>=0.5.0; extra == "dev"
84
83
  Requires-Dist: mypy>=1.8.0; extra == "dev"
85
84
  Requires-Dist: build>=1.0.0; extra == "dev"
86
85
  Requires-Dist: twine>=5.0.0; extra == "dev"
87
- Dynamic: home-page
88
86
  Dynamic: license-file
89
- Dynamic: requires-python
87
+
88
+
90
89
 
91
90
  # AgenticDome Python SDK
92
91
 
@@ -276,7 +275,6 @@ If you are an Enterprise Administrator securing your OpenClaw stack or another P
276
275
  1. Create an account in the AgenticDome Management Console for the AU region.
277
276
  2. Log in and copy your unique workspace or organization tenant identifier from organization settings.
278
277
  3. Navigate to the access-control or API-key section and generate a production API key.
279
- 4. Configure your local OpenClaw runtime, server, worker, or hosting container with the required environment variables before attaching any SDK framework integration.
280
278
 
281
279
  ---
282
280
 
@@ -3008,8 +3006,6 @@ client.report_incident(
3008
3006
  )
3009
3007
  ```
3010
3008
 
3011
- ---
3012
-
3013
3009
  ## Prompt Guardrail Example
3014
3010
 
3015
3011
  ```python
@@ -3307,25 +3303,123 @@ from agenticdome_sdk.llamaindex import AgenticDomeLlamaIndexFirewall, FirewallCo
3307
3303
 
3308
3304
  ---
3309
3305
 
3310
- ## Package Build
3306
+ ## Package Build and Verification
3311
3307
 
3312
- For maintainers:
3308
+ For maintainers, run the Python SDK release gate from the SDK root:
3313
3309
 
3314
3310
  ```bash
3315
3311
  python3 -m venv .venv
3316
3312
  source .venv/bin/activate
3317
3313
 
3318
- python -m pip install --upgrade pip setuptools wheel build twine pytest
3314
+ python -m pip install --upgrade pip setuptools wheel
3319
3315
  python -m pip install -e ".[dev]"
3320
3316
  python -m pip install -e ".[crewai,pydanticai,langgraph,microsoft,foundry,agno,openai-agents,mcp,bedrock,google-adk,llamaindex,redis]"
3321
3317
 
3322
- pytest -q
3318
+ python -m pytest -q
3319
+ rm -rf build dist *.egg-info agenticdome_sdk.egg-info agenticdome_python_sdk.egg-info
3320
+ python -m build
3321
+ python -m twine check dist/*
3322
+ ```
3323
+
3324
+ `python -m pytest -q` runs the core SDK tests, package metadata contract tests, and every dependency-light framework adapter test in one go. This is the normal offline full-suite command for all supported Python integrations.
3325
+
3326
+ The adapter tests use fake framework/client boundaries where possible so normal CI can verify authorization, delegation-token handling, sanitized tool arguments, output DLP, streaming sanitization, rate limits, and fail-open/fail-closed behavior without requiring live third-party services.
3327
+
3328
+ To run one framework at a time, execute the matching test file from the matrix below. For example, `python -m pytest -q tests/test_langgraph_integration.py` runs only the LangGraph/LangChain adapter tests.
3329
+
3330
+ ### Verification Command Details
3331
+
3332
+ Use this focused verification command when you only want release/package checks plus the optional live tenant smoke tests:
3333
+
3334
+ ```bash
3335
+ python -m pytest -q tests/test_packaging_contract.py tests/test_live_tenant.py
3336
+ ```
3337
+
3338
+ What each part does:
3339
+
3340
+ | Part | Meaning |
3341
+ | :--- | :--- |
3342
+ | `python -m pytest` | Runs `pytest` using the current Python environment. |
3343
+ | `-q` | Quiet mode. It prints compact test results instead of verbose test names. |
3344
+ | `tests/test_packaging_contract.py` | Runs packaging and release-quality checks: `pyproject.toml` metadata, the minimal `setup.py` shim, public imports, `.gitignore`, `MANIFEST.in`, and README verification coverage. |
3345
+ | `tests/test_live_tenant.py` | Runs live AgenticDome tenant smoke tests only when explicitly enabled. By default these tests are skipped. |
3346
+
3347
+ By default, `tests/test_live_tenant.py` is skipped unless you set:
3348
+
3349
+ ```bash
3350
+ export AGENTICDOME_LIVE_TENANT_TEST=1
3351
+ ```
3352
+
3353
+ For strict live policy validation, also set:
3354
+
3355
+ ```bash
3356
+ export AGENTICDOME_LIVE_EXPECT_STRICT=1
3357
+ ```
3358
+
3359
+ ### Framework Test Matrix
3360
+
3361
+ | Runtime / integration | Test command | Coverage focus |
3362
+ | :--- | :--- | :--- |
3363
+ | Core SDK client | `python -m pytest -q tests/test_client.py` | Request validation, headers, guardrail calls, A2A/MCP JSON-RPC calls, Mesh DLP, HTTP errors, and JSON handling. |
3364
+ | Package contract | `python -m pytest -q tests/test_packaging_contract.py` | `pyproject.toml` metadata, legacy `setup.py` shim, public exports, manifest hygiene, ignored build artifacts, and documented extras. |
3365
+ | CrewAI | `python -m pytest -q tests/test_crewai_integration.py` | Prompt/tool hooks, manager handoff token injection, specialist verification, output redaction, schema checks, rate limits, retries, and streaming DLP. |
3366
+ | PydanticAI | `python -m pytest -q tests/test_pydanticai_integration.py` | Agent hooks, secure tools, sanitized arguments, token-store fallback, production session enforcement, rate limits, retries, and streaming output. |
3367
+ | LangGraph / LangChain | `python -m pytest -q tests/test_langgraph_integration.py` | Graph input, transition, tool, retrieval, middleware, security routing, token consumption, output DLP, and streaming events. |
3368
+ | Microsoft Agent Framework | `python -m pytest -q tests/test_microsoft_agent_framework_integration.py` | Tool/run boundaries, delegated tool verification, middleware install helpers, identity context, Copilot enforcement hooks, and streaming output. |
3369
+ | Microsoft AI Foundry | `python -m pytest -q tests/test_microsoft_ai_foundry_integration.py` | Prompt threat contracts, local tool executors, run boundaries, bearer/API-key configuration, delegated execution, circuit breaker, and stream DLP. |
3370
+ | OpenAI Agents SDK | `python -m pytest -q tests/test_openai_agents_integration.py` | Runner wrappers, guardrail helpers, function-tool wrappers, handoff/delegated tools, HMAC token storage, schema checks, retries, and streaming output. |
3371
+ | Agno | `python -m pytest -q tests/test_agno_integration.py` | Agent/team hooks, tool hooks, middleware/plugin helpers, delegated specialist execution, retrieved text sanitization, schema checks, and stream DLP. |
3372
+ | MCP host / gateway | `python -m pytest -q tests/test_mcp_host_integration.py` | JSON-RPC preflight, tool/resource/prompt authorization, private metadata stripping, delegated token verification, response filtering, and forwarder DLP. |
3373
+ | AWS Bedrock | `python -m pytest -q tests/test_aws_bedrock_integration.py` | Converse/InvokeModel wrappers, Bedrock Agents streams, action-group Lambda wrappers, retrieval DLP, tool authorization, handoff tokens, and retries. |
3374
+ | Google ADK | `python -m pytest -q tests/test_google_adk_integration.py` | Model/tool callbacks, plugin helpers, secure tools, delegated execution, sanitized args, production sessions, rate limits, retries, and stream DLP. |
3375
+ | LlamaIndex | `python -m pytest -q tests/test_llamaindex_integration.py` | FunctionTool/query/retrieval wrappers, callback handlers, secure tools, delegated execution, fail-open behavior, and output DLP. |
3376
+
3377
+ For a single-framework development loop, install only the extra and run the matching test file, for example:
3378
+
3379
+ ```bash
3380
+ python -m pip install -e ".[langgraph]"
3381
+ python -m pytest -q tests/test_langgraph_integration.py
3382
+ ```
3383
+
3384
+ ### Release Gates
3385
+
3386
+ For metadata and artifact validation only:
3387
+
3388
+ ```bash
3389
+ python -m pytest -q tests/test_packaging_contract.py
3390
+ rm -rf build dist *.egg-info agenticdome_sdk.egg-info agenticdome_python_sdk.egg-info
3391
+ python -m build
3392
+ python -m twine check dist/*
3393
+ ```
3394
+
3395
+ For a full offline release gate across all supported Python integrations:
3323
3396
 
3397
+ ```bash
3398
+ python -m pip install -e ".[dev,crewai,pydanticai,langgraph,microsoft,foundry,agno,openai-agents,mcp,bedrock,google-adk,llamaindex,redis]"
3399
+ python -m pytest -q
3324
3400
  rm -rf build dist *.egg-info agenticdome_sdk.egg-info agenticdome_python_sdk.egg-info
3325
3401
  python -m build
3326
3402
  python -m twine check dist/*
3327
3403
  ```
3328
3404
 
3405
+ For a release gate against a real AgenticDome tenant:
3406
+
3407
+ ```bash
3408
+ export AGENTICDOME_API_BASE="https://www.agenticdome.io"
3409
+ export AGENTICDOME_TENANT_ID="<tenant_id>"
3410
+ export AGENTICDOME_API_KEY="<tenant_api_key>"
3411
+ export AGENTICDOME_LIVE_TENANT_TEST=1
3412
+ python -m pytest -q tests/test_live_tenant.py
3413
+ ```
3414
+
3415
+ For strict security-policy validation, add:
3416
+
3417
+ ```bash
3418
+ export AGENTICDOME_LIVE_EXPECT_STRICT=1
3419
+ ```
3420
+
3421
+ The live tenant test performs real `guardrail_validate()` and `mesh_validate()` calls through the core client. Framework-specific behavior remains covered by the offline adapter test matrix above, because those tests assert where each framework boundary calls the shared AgenticDome client and how it handles policy decisions.
3422
+
3329
3423
  ---
3330
3424
 
3331
3425
  ## License
@@ -3339,5 +3433,5 @@ or terms published by AgenticDome for this package.
3339
3433
  For enterprise deployments, advanced governance workflows, dedicated regional control planes, or priority integration support, visit:
3340
3434
 
3341
3435
  ```text
3342
- https://au.agenticdome.io
3436
+ https://agenticdome.io
3343
3437
  ```
@@ -1,9 +1,9 @@
1
- agenticdome_python_sdk-1.1.0.dist-info/licenses/LICENSE,sha256=lqAH8G9tU2WPK9fzrnM_QMd4XUrh9fsmPqKE_hniKpM,718
2
- agenticdome_sdk/__init__.py,sha256=yNHRjMpEE3-knPsjSJ0LBwIk3lD6qbilKvFH_yXSPAs,567
1
+ agenticdome_python_sdk-1.1.2.dist-info/licenses/LICENSE,sha256=lqAH8G9tU2WPK9fzrnM_QMd4XUrh9fsmPqKE_hniKpM,718
2
+ agenticdome_sdk/__init__.py,sha256=87__SX3oTttDLur7z8BhzAe6QMOSK1GXjoaTZRVTbc0,223
3
3
  agenticdome_sdk/agno.py,sha256=3gbc5URNTAHyNVAaAH882CpQpMecTv0R6S0CNMDOgos,60686
4
4
  agenticdome_sdk/aws_bedrock.py,sha256=Z1Rcbps7VgvETmq_wrUbIvg6lJxsoe7YJEPZYkBKr80,69498
5
- agenticdome_sdk/client.py,sha256=h1__ManOybAYxYV0ScZXf2J7grm-pPiZ9Z1uTw-LwBY,41831
6
- agenticdome_sdk/crewai.py,sha256=MAX5rA2OmpAfSKOIbHL0WDDVcsVuOs31OJXggJtCwOc,51815
5
+ agenticdome_sdk/client.py,sha256=9OJqaE5OMr7_mcqFI5b_QodQU-ZP9LxgRRoUU38rYW0,43513
6
+ agenticdome_sdk/crewai.py,sha256=7o7yapjbGfxfHGrmKtnpERIeJlDKIRgqz2h1WpLQJkQ,52389
7
7
  agenticdome_sdk/google_adk.py,sha256=U23uSvUxgeQRUX6fGewls0CU0GI8mru67O1mHti7RkA,57175
8
8
  agenticdome_sdk/langgraph.py,sha256=Eyaq-zcScLVlvT4VBHPN1H_K1An45LI7lKi0YgsXCOs,82660
9
9
  agenticdome_sdk/llamaindex.py,sha256=uFDzeYNz4Y72W-5XdluhdHvKAc8xkPJRkPaLFvwhlSk,42777
@@ -13,7 +13,7 @@ agenticdome_sdk/microsoft_ai_foundry.py,sha256=aIofnEUKU30P-4vKkWx1YdZZVHQIZECjE
13
13
  agenticdome_sdk/openai_agents.py,sha256=bWoJ2hjCyXDWl5Eo4pjeRr_MOQgNOZW7QE9WRDo6oDw,57243
14
14
  agenticdome_sdk/pydantic.py,sha256=7R6X0JgPIMLcWO682wcpN0X8dSMVEiwvVc4ydUN111s,54882
15
15
  agenticdome_sdk/scenarios.py,sha256=QROC_JWKwub5AdpP9pLXdJCpotEACkF-qgKAnDAo8XA,7882
16
- agenticdome_python_sdk-1.1.0.dist-info/METADATA,sha256=qv0tAcX_wBzycN0i6P5NAH3BhfLswCtsKJU4pfDDtRg,157806
17
- agenticdome_python_sdk-1.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
18
- agenticdome_python_sdk-1.1.0.dist-info/top_level.txt,sha256=LZbbjXco5mqDrGwlTJpIKI5Sp6R_njzHHjExxAs9c3s,16
19
- agenticdome_python_sdk-1.1.0.dist-info/RECORD,,
16
+ agenticdome_python_sdk-1.1.2.dist-info/METADATA,sha256=GHTOzz2LHgIz8fSzDkj1tICoBiD5ZO7p4wOoFUWnCuo,163986
17
+ agenticdome_python_sdk-1.1.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
18
+ agenticdome_python_sdk-1.1.2.dist-info/top_level.txt,sha256=LZbbjXco5mqDrGwlTJpIKI5Sp6R_njzHHjExxAs9c3s,16
19
+ agenticdome_python_sdk-1.1.2.dist-info/RECORD,,
@@ -1,22 +1,6 @@
1
- from .client import AgentGuardClient
2
-
3
- try:
4
- from .client import GuardrailClient
5
- except Exception:
6
- GuardrailClient = AgentGuardClient
7
-
8
- try:
9
- from .exceptions import AgentGuardError, AgentGuardHTTPError
10
- except Exception:
11
- try:
12
- from .client import AgentGuardError, AgentGuardHTTPError
13
- except Exception:
14
- class AgentGuardError(Exception):
15
- pass
16
-
17
- class AgentGuardHTTPError(AgentGuardError):
18
- pass
1
+ from .client import AgentGuardClient, AgentGuardError, AgentGuardHTTPError
19
2
 
3
+ GuardrailClient = AgentGuardClient
20
4
 
21
5
  __all__ = [
22
6
  "AgentGuardClient",
agenticdome_sdk/client.py CHANGED
@@ -1,6 +1,6 @@
1
1
  import base64
2
2
  import os
3
- from typing import Optional, Dict, List, Any, Union
3
+ from typing import Optional, Dict, List, Any, Tuple, Union
4
4
 
5
5
  import requests
6
6
  from requests.adapters import HTTPAdapter
@@ -51,6 +51,10 @@ class AgentGuardClient:
51
51
  timeout: int = 20,
52
52
  user_agent: str = "agenticdome-python-sdk/0.4.0",
53
53
  max_retries: int = 3,
54
+ connect_timeout: Optional[float] = None,
55
+ pool_connections: int = 20,
56
+ pool_maxsize: int = 100,
57
+ pool_block: bool = False,
54
58
  ):
55
59
  self.api_base = self._require_nonempty("api_base", api_base).rstrip("/")
56
60
  self.api_key = self._require_nonempty(
@@ -66,6 +70,11 @@ class AgentGuardClient:
66
70
  or os.getenv("AGENTICDOME_BEARER_TOKEN")
67
71
  )
68
72
  self.timeout = timeout
73
+ self.connect_timeout = self._positive_float(
74
+ "connect_timeout",
75
+ connect_timeout if connect_timeout is not None else os.getenv("AGENTICDOME_CONNECT_TIMEOUT_S", "5"),
76
+ default=5.0,
77
+ )
69
78
  self.user_agent = user_agent
70
79
 
71
80
  self.session = requests.Session()
@@ -77,7 +86,12 @@ class AgentGuardClient:
77
86
  status_forcelist=(429, 500, 502, 503, 504),
78
87
  allowed_methods=frozenset(["GET", "POST", "PUT", "PATCH", "DELETE"]),
79
88
  )
80
- adapter = HTTPAdapter(max_retries=retry)
89
+ adapter = HTTPAdapter(
90
+ max_retries=retry,
91
+ pool_connections=max(1, int(pool_connections)),
92
+ pool_maxsize=max(1, int(pool_maxsize)),
93
+ pool_block=bool(pool_block),
94
+ )
81
95
  self.session.mount("http://", adapter)
82
96
  self.session.mount("https://", adapter)
83
97
 
@@ -136,6 +150,22 @@ class AgentGuardClient:
136
150
  s = str(value).strip()
137
151
  return s or None
138
152
 
153
+ def _positive_float(self, name: str, value: Any, *, default: float) -> float:
154
+ try:
155
+ parsed = float(value)
156
+ except Exception:
157
+ parsed = default
158
+ if parsed <= 0:
159
+ parsed = default
160
+ return parsed
161
+
162
+ def _timeout_tuple(self, timeout: Optional[Union[int, float, Tuple[float, float]]]) -> Union[float, Tuple[float, float]]:
163
+ if isinstance(timeout, tuple):
164
+ return timeout
165
+ read_timeout = self._positive_float("timeout", timeout if timeout is not None else self.timeout, default=float(self.timeout or 20))
166
+ connect_timeout = min(self.connect_timeout, read_timeout)
167
+ return (connect_timeout, read_timeout)
168
+
139
169
  def _normalize_direction(self, direction: Optional[str]) -> str:
140
170
  """
141
171
  Normalize common direction synonyms to the canonical values expected by the API.
@@ -239,7 +269,7 @@ class AgentGuardClient:
239
269
  tenant_id: Optional[Union[str, int]] = None,
240
270
  use_bearer: bool = False,
241
271
  extra_headers: Optional[Dict[str, str]] = None,
242
- timeout: Optional[int] = None,
272
+ timeout: Optional[Union[int, float, Tuple[float, float]]] = None,
243
273
  ) -> Dict[str, Any]:
244
274
  url = f"{self.api_base}{path}"
245
275
  headers = self._headers(
@@ -253,7 +283,7 @@ class AgentGuardClient:
253
283
  url=url,
254
284
  headers=headers,
255
285
  json=json_body,
256
- timeout=timeout or self.timeout,
286
+ timeout=self._timeout_tuple(timeout),
257
287
  )
258
288
 
259
289
  if not response.ok:
@@ -647,16 +677,20 @@ class AgentGuardClient:
647
677
  def reset_trust_score(
648
678
  self,
649
679
  agent_id: str,
650
- admin_secret: str,
680
+ admin_secret: Optional[str] = None,
651
681
  tenant_id: Optional[Union[str, int]] = None,
652
682
  is_agent: bool = True,
683
+ service_token: Optional[str] = None,
653
684
  ) -> Dict[str, Any]:
685
+ token = service_token or admin_secret or os.getenv("AGENTICDOME_SERVICE_TOKEN") or os.getenv("SERVICE_SECRET")
686
+ if not token:
687
+ raise ValueError("reset_trust_score requires service_token or AGENTICDOME_SERVICE_TOKEN")
654
688
  path = f"/trust/reset/{agent_id}?is_agent={'true' if is_agent else 'false'}"
655
689
  return self._request(
656
690
  "POST",
657
691
  path,
658
692
  tenant_id=tenant_id,
659
- extra_headers={"X-Admin-Secret": admin_secret},
693
+ extra_headers={"X-Service-Token": token},
660
694
  )
661
695
 
662
696
  # ------------------------------------------------------------------
@@ -1060,7 +1094,7 @@ class AgentGuardClient:
1060
1094
  payload: Dict[str, Any],
1061
1095
  *,
1062
1096
  api_version: str = "2025-09-01",
1063
- timeout: Optional[int] = None,
1097
+ timeout: Optional[Union[int, float, Tuple[float, float]]] = None,
1064
1098
  ) -> Dict[str, Any]:
1065
1099
  return self._request(
1066
1100
  "POST",
@@ -1075,7 +1109,7 @@ class AgentGuardClient:
1075
1109
  payload: Dict[str, Any],
1076
1110
  *,
1077
1111
  api_version: str = "2025-09-01",
1078
- timeout: Optional[int] = None,
1112
+ timeout: Optional[Union[int, float, Tuple[float, float]]] = None,
1079
1113
  ) -> Dict[str, Any]:
1080
1114
  return self._request(
1081
1115
  "POST",
agenticdome_sdk/crewai.py CHANGED
@@ -25,6 +25,19 @@ except Exception as exc: # pragma: no cover
25
25
  "Install with: pip install 'agenticdome-python-sdk[crewai]'"
26
26
  ) from exc
27
27
 
28
+
29
+
30
+ def _preserve_hook_function(register: Callable[[Callable[..., Any]], Any]) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
31
+ def decorator(fn: Callable[..., Any]) -> Callable[..., Any]:
32
+ registered = register(fn)
33
+ return fn if registered is None else registered
34
+ return decorator
35
+
36
+
37
+ register_after_tool_call_hook = _preserve_hook_function(register_after_tool_call_hook)
38
+ register_before_llm_call_hook = _preserve_hook_function(register_before_llm_call_hook)
39
+ register_before_tool_call_hook = _preserve_hook_function(register_before_tool_call_hook)
40
+
28
41
  from agenticdome_sdk.client import AgentGuardClient
29
42
 
30
43
  try: