agenticdome-python-sdk 1.2.47__tar.gz → 1.2.49__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.
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/PKG-INFO +18 -1
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/README.md +17 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_python_sdk.egg-info/PKG-INFO +18 -1
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_python_sdk.egg-info/SOURCES.txt +3 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/__init__.py +2 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/catalog_snapshot.json +3 -3
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/client.py +172 -3
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/existing_integration.py +2 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/hook_catalog.py +5 -4
- agenticdome_python_sdk-1.2.49/agenticdome_sdk/http_execution.py +64 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/mcp_host.py +22 -6
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/onboarding_cli.py +27 -3
- agenticdome_python_sdk-1.2.49/agenticdome_sdk/ownership.py +139 -0
- agenticdome_python_sdk-1.2.49/docs/resource-adapters.md +202 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/pyproject.toml +1 -1
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/CONTRIBUTING.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/LICENSE +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/MANIFEST.in +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/NOTICE +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/SECURITY.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_python_sdk.egg-info/dependency_links.txt +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_python_sdk.egg-info/entry_points.txt +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_python_sdk.egg-info/requires.txt +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_python_sdk.egg-info/top_level.txt +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/_framework_firewall.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/_mode.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/action_path_proof.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/agno.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/attestation.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/autogen.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/aws_bedrock.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/claude.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/connect.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/copilot_ir.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/copilot_ir_collector.cjs +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/crewai.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/demo.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/framework_edits.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/generic_python.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/google_adk.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/guided_integration.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/identity.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/langgraph.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/lifecycle.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/llamaindex.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/mcp_http_gateway.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/mcp_rehearsal_server.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/mcp_verification.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/microsoft_agent_framework.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/microsoft_ai_foundry.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/onboarding_observations.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/openai_agents.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/outcomes.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/proof.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/pydantic.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/report_scope.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/simulation.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/smolagents.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/customer-onboarding.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/frameworks/README.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/frameworks/agno.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/frameworks/autogen.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/frameworks/aws-bedrock.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/frameworks/claude-agent-sdk.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/frameworks/crewai.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/frameworks/custom-python.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/frameworks/google-adk.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/frameworks/langgraph.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/frameworks/llamaindex.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/frameworks/microsoft-agent-framework.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/frameworks/microsoft-ai-foundry.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/frameworks/openai-agents.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/frameworks/pydanticai.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/frameworks/smolagents.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/mcp-integration.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/performance-evidence.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/docs/runtime-deployment.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/PRODUCTION_INTEGRATION.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/README.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/attack_demo.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/crewai_agenticdome_firewall.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/README.md +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/_shared.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/agno.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/autogen.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/aws_bedrock.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/claude_agent_sdk.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/crewai.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/custom_python.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/google_adk.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/langgraph.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/llamaindex.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/mcp.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/microsoft_agent_framework.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/microsoft_ai_foundry.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/openai_agents.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/pydanticai.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/frameworks/smolagents.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/langgraph_agenticdome_firewall.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/local_simulation_gallery.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/examples/mcp_gateway_action_firewall.py +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/setup.cfg +0 -0
- {agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agenticdome-python-sdk
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.49
|
|
4
4
|
Summary: Official Python SDK for AgenticDome security guardrails, DLP, tool authorization, and multi-agent delegation enforcement.
|
|
5
5
|
Author: AgenticDome
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -2899,3 +2899,20 @@ The Python SDK client, public examples, and public SDK documentation in this rep
|
|
|
2899
2899
|
Security vulnerabilities must be reported privately as described in [SECURITY.md](https://github.com/agenticdome/agenticdome-python-sdk/blob/main/SECURITY.md), not through a public issue.
|
|
2900
2900
|
|
|
2901
2901
|
For enterprise deployments, advanced governance workflows, dedicated regional control planes, or priority integration support, visit **[agenticdome.io](https://agenticdome.io)**.
|
|
2902
|
+
## Exact HTTP execution
|
|
2903
|
+
|
|
2904
|
+
`client.execute_http(method=..., url=..., body=..., headers=..., agent_id=...,
|
|
2905
|
+
tool_name=..., request_purpose=...)` authorizes and sends the same bounded UTF-8
|
|
2906
|
+
request. It requires a compatible sidecar broker and refuses redirects. It
|
|
2907
|
+
raises `ApprovalRequired` before sending when human review is required; resume
|
|
2908
|
+
with `client.resume_approved_http(pending, headers=...)` after approval. Fresh
|
|
2909
|
+
API authentication headers may be supplied; reviewed content and If-Match,
|
|
2910
|
+
If-None-Match or If-Unmodified-Since preconditions cannot change. Existing
|
|
2911
|
+
generic tool callbacks keep their existing contract. Network-level protection
|
|
2912
|
+
also requires routing through a compatible enforcing gateway with direct egress
|
|
2913
|
+
controlled. A returned HTTP response is the provider's outcome, separate from
|
|
2914
|
+
the policy decision and gateway admission.
|
|
2915
|
+
|
|
2916
|
+
### Shared resource adapters and GraphQL
|
|
2917
|
+
|
|
2918
|
+
`OwnershipGuard` and `ResourceRule` verify tenant, resource identity, ownership or explicit entitlements and permitted operations through trusted provider callbacks. Attach the guard to the client or MCP gateway; HTTP approval resume rechecks current facts. `execute_graphql` sends exact prepared JSON through the interpreting sidecar. GraphQL rules use `tool#Mutation.field` and resolved field arguments, never an asserted owner or unused variable. See [resource adapter examples](docs/resource-adapters.md).
|
|
@@ -2786,3 +2786,20 @@ The Python SDK client, public examples, and public SDK documentation in this rep
|
|
|
2786
2786
|
Security vulnerabilities must be reported privately as described in [SECURITY.md](https://github.com/agenticdome/agenticdome-python-sdk/blob/main/SECURITY.md), not through a public issue.
|
|
2787
2787
|
|
|
2788
2788
|
For enterprise deployments, advanced governance workflows, dedicated regional control planes, or priority integration support, visit **[agenticdome.io](https://agenticdome.io)**.
|
|
2789
|
+
## Exact HTTP execution
|
|
2790
|
+
|
|
2791
|
+
`client.execute_http(method=..., url=..., body=..., headers=..., agent_id=...,
|
|
2792
|
+
tool_name=..., request_purpose=...)` authorizes and sends the same bounded UTF-8
|
|
2793
|
+
request. It requires a compatible sidecar broker and refuses redirects. It
|
|
2794
|
+
raises `ApprovalRequired` before sending when human review is required; resume
|
|
2795
|
+
with `client.resume_approved_http(pending, headers=...)` after approval. Fresh
|
|
2796
|
+
API authentication headers may be supplied; reviewed content and If-Match,
|
|
2797
|
+
If-None-Match or If-Unmodified-Since preconditions cannot change. Existing
|
|
2798
|
+
generic tool callbacks keep their existing contract. Network-level protection
|
|
2799
|
+
also requires routing through a compatible enforcing gateway with direct egress
|
|
2800
|
+
controlled. A returned HTTP response is the provider's outcome, separate from
|
|
2801
|
+
the policy decision and gateway admission.
|
|
2802
|
+
|
|
2803
|
+
### Shared resource adapters and GraphQL
|
|
2804
|
+
|
|
2805
|
+
`OwnershipGuard` and `ResourceRule` verify tenant, resource identity, ownership or explicit entitlements and permitted operations through trusted provider callbacks. Attach the guard to the client or MCP gateway; HTTP approval resume rechecks current facts. `execute_graphql` sends exact prepared JSON through the interpreting sidecar. GraphQL rules use `tool#Mutation.field` and resolved field arguments, never an asserted owner or unused variable. See [resource adapter examples](docs/resource-adapters.md).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agenticdome-python-sdk
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.49
|
|
4
4
|
Summary: Official Python SDK for AgenticDome security guardrails, DLP, tool authorization, and multi-agent delegation enforcement.
|
|
5
5
|
Author: AgenticDome
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -2899,3 +2899,20 @@ The Python SDK client, public examples, and public SDK documentation in this rep
|
|
|
2899
2899
|
Security vulnerabilities must be reported privately as described in [SECURITY.md](https://github.com/agenticdome/agenticdome-python-sdk/blob/main/SECURITY.md), not through a public issue.
|
|
2900
2900
|
|
|
2901
2901
|
For enterprise deployments, advanced governance workflows, dedicated regional control planes, or priority integration support, visit **[agenticdome.io](https://agenticdome.io)**.
|
|
2902
|
+
## Exact HTTP execution
|
|
2903
|
+
|
|
2904
|
+
`client.execute_http(method=..., url=..., body=..., headers=..., agent_id=...,
|
|
2905
|
+
tool_name=..., request_purpose=...)` authorizes and sends the same bounded UTF-8
|
|
2906
|
+
request. It requires a compatible sidecar broker and refuses redirects. It
|
|
2907
|
+
raises `ApprovalRequired` before sending when human review is required; resume
|
|
2908
|
+
with `client.resume_approved_http(pending, headers=...)` after approval. Fresh
|
|
2909
|
+
API authentication headers may be supplied; reviewed content and If-Match,
|
|
2910
|
+
If-None-Match or If-Unmodified-Since preconditions cannot change. Existing
|
|
2911
|
+
generic tool callbacks keep their existing contract. Network-level protection
|
|
2912
|
+
also requires routing through a compatible enforcing gateway with direct egress
|
|
2913
|
+
controlled. A returned HTTP response is the provider's outcome, separate from
|
|
2914
|
+
the policy decision and gateway admission.
|
|
2915
|
+
|
|
2916
|
+
### Shared resource adapters and GraphQL
|
|
2917
|
+
|
|
2918
|
+
`OwnershipGuard` and `ResourceRule` verify tenant, resource identity, ownership or explicit entitlements and permitted operations through trusted provider callbacks. Attach the guard to the client or MCP gateway; HTTP approval resume rechecks current facts. `execute_graphql` sends exact prepared JSON through the interpreting sidecar. GraphQL rules use `tool#Mutation.field` and resolved field arguments, never an asserted owner or unused variable. See [resource adapter examples](docs/resource-adapters.md).
|
|
@@ -34,6 +34,7 @@ agenticdome_sdk/generic_python.py
|
|
|
34
34
|
agenticdome_sdk/google_adk.py
|
|
35
35
|
agenticdome_sdk/guided_integration.py
|
|
36
36
|
agenticdome_sdk/hook_catalog.py
|
|
37
|
+
agenticdome_sdk/http_execution.py
|
|
37
38
|
agenticdome_sdk/identity.py
|
|
38
39
|
agenticdome_sdk/langgraph.py
|
|
39
40
|
agenticdome_sdk/lifecycle.py
|
|
@@ -48,6 +49,7 @@ agenticdome_sdk/onboarding_cli.py
|
|
|
48
49
|
agenticdome_sdk/onboarding_observations.py
|
|
49
50
|
agenticdome_sdk/openai_agents.py
|
|
50
51
|
agenticdome_sdk/outcomes.py
|
|
52
|
+
agenticdome_sdk/ownership.py
|
|
51
53
|
agenticdome_sdk/proof.py
|
|
52
54
|
agenticdome_sdk/pydantic.py
|
|
53
55
|
agenticdome_sdk/report_scope.py
|
|
@@ -56,6 +58,7 @@ agenticdome_sdk/smolagents.py
|
|
|
56
58
|
docs/customer-onboarding.md
|
|
57
59
|
docs/mcp-integration.md
|
|
58
60
|
docs/performance-evidence.md
|
|
61
|
+
docs/resource-adapters.md
|
|
59
62
|
docs/runtime-deployment.md
|
|
60
63
|
docs/frameworks/README.md
|
|
61
64
|
docs/frameworks/agno.md
|
|
@@ -5,8 +5,10 @@ from ._mode import LIVE_MODE, LOCAL_SIM_MODE, is_local_sim_mode, resolve_mode
|
|
|
5
5
|
from .lifecycle import VerifiedActionContext, VerifiedActionDenied, VerifiedActionReporter, verified_action
|
|
6
6
|
from .action_path_proof import ExecutionSpy
|
|
7
7
|
from .generic_python import AgenticDomeActionDenied, guarded_tool_executor
|
|
8
|
+
from .ownership import OwnershipGuard, OwnershipDenied, ResourceRule
|
|
8
9
|
|
|
9
10
|
__all__ = [
|
|
11
|
+
"OwnershipGuard", "OwnershipDenied", "ResourceRule",
|
|
10
12
|
"AgenticDomeClient",
|
|
11
13
|
"AgenticDomeError",
|
|
12
14
|
"AgenticDomeHTTPError",
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"schema": "agenticdome.catalog-snapshot.v1",
|
|
3
3
|
"catalog_schema": "agenticdome.hook-catalog.v1",
|
|
4
4
|
"verified_at": "2026-10-12",
|
|
5
|
-
"python_sdk_version": "1.2.
|
|
5
|
+
"python_sdk_version": "1.2.49",
|
|
6
6
|
"published_packages": {
|
|
7
7
|
"agenticdome-python-sdk": {
|
|
8
8
|
"registry": "pypi",
|
|
9
|
-
"version": "1.2.
|
|
10
|
-
"url": "https://pypi.org/project/agenticdome-python-sdk/1.2.
|
|
9
|
+
"version": "1.2.49",
|
|
10
|
+
"url": "https://pypi.org/project/agenticdome-python-sdk/1.2.49/"
|
|
11
11
|
},
|
|
12
12
|
"agenticdome-sdk": {
|
|
13
13
|
"registry": "npm",
|
|
@@ -4,6 +4,9 @@ import json
|
|
|
4
4
|
import uuid
|
|
5
5
|
import logging
|
|
6
6
|
import os
|
|
7
|
+
import threading
|
|
8
|
+
from contextlib import contextmanager
|
|
9
|
+
from contextvars import ContextVar
|
|
7
10
|
import re
|
|
8
11
|
from importlib import metadata
|
|
9
12
|
from typing import Optional, Dict, List, Any, Tuple, Union, Mapping
|
|
@@ -73,6 +76,9 @@ class ApprovalRequired(AgenticDomeError):
|
|
|
73
76
|
return cls({"context": {"approval": {"id": approval["id"]}, "approval_url": approval.get("url", "")}}, record["prepared_request"])
|
|
74
77
|
|
|
75
78
|
|
|
79
|
+
_CALL_IDENTITIES=ContextVar('agenticdome_client_identities',default=None)
|
|
80
|
+
|
|
81
|
+
|
|
76
82
|
class AgenticDomeClient:
|
|
77
83
|
"""
|
|
78
84
|
Official Python SDK for the AgenticDome Action Firewall.
|
|
@@ -111,7 +117,11 @@ class AgenticDomeClient:
|
|
|
111
117
|
tool_provenance: Optional[Mapping[str, Mapping[str, str]]] = None,
|
|
112
118
|
execution_broker_mode: Optional[str] = None,
|
|
113
119
|
mode: Optional[str] = None,
|
|
120
|
+
ownership_guard=None,
|
|
114
121
|
):
|
|
122
|
+
self.ownership_guard = ownership_guard
|
|
123
|
+
self._managed_token_lock=None
|
|
124
|
+
self._managed_token_cache={}
|
|
115
125
|
self.mode = resolve_mode(mode)
|
|
116
126
|
self.is_simulation = self.mode == LOCAL_SIM_MODE
|
|
117
127
|
if self.is_simulation:
|
|
@@ -218,8 +228,70 @@ class AgenticDomeClient:
|
|
|
218
228
|
if extra_headers:
|
|
219
229
|
headers.update(extra_headers)
|
|
220
230
|
|
|
231
|
+
# Renewed projected/JWT-SVID proof files are read on every request.
|
|
232
|
+
for environment, header in (("AGENTICDOME_AGENT_CREDENTIAL", "X-AgenticDome-Agent-Credential"),
|
|
233
|
+
("AGENTICDOME_IDENTITY_DEPLOYMENT", "X-AgenticDome-Deployment"),
|
|
234
|
+
("AGENTICDOME_AGENT_ID", "X-AgenticDome-Agent-Id"),
|
|
235
|
+
("AGENTICDOME_AGENT_FRAMEWORK", "X-AgenticDome-Agent-Framework"),
|
|
236
|
+
("AGENTICDOME_AGENT_TOKEN", "X-AgenticDome-Agent-Token"),
|
|
237
|
+
("AGENTICDOME_WORKLOAD_TOKEN", "X-AgenticDome-Workload-Token"),
|
|
238
|
+
("AGENTICDOME_USER_TOKEN", "X-AgenticDome-User-Token"),
|
|
239
|
+
("AGENTICDOME_DELEGATION_TOKEN", "X-AgenticDome-Delegation-Token"),
|
|
240
|
+
("AGENTICDOME_TASK_ID", "X-AgenticDome-Task-Id")):
|
|
241
|
+
value = os.getenv(environment, "").strip(); filename=os.getenv(environment+'_FILE','').strip()
|
|
242
|
+
if value and filename:
|
|
243
|
+
raise ValueError('Configure one identity value or file for '+environment)
|
|
244
|
+
if filename:
|
|
245
|
+
with open(filename,'rb') as handle:
|
|
246
|
+
raw=handle.read(16385)
|
|
247
|
+
if len(raw)>16384:
|
|
248
|
+
raise ValueError('Identity proof exceeds the size limit')
|
|
249
|
+
value=raw.decode().strip()
|
|
250
|
+
if not value:
|
|
251
|
+
raise ValueError('Identity proof file is empty')
|
|
252
|
+
if len(value)>16384 or any(ord(c)<32 or ord(c)==127 for c in value):
|
|
253
|
+
raise ValueError('Identity header contains an invalid value')
|
|
254
|
+
if value:
|
|
255
|
+
headers.setdefault(header,value)
|
|
256
|
+
scoped=(_CALL_IDENTITIES.get() or {}).get(id(self),{})
|
|
257
|
+
for header,value in scoped.items():
|
|
258
|
+
if extra_headers and header in extra_headers:continue
|
|
259
|
+
if value is None:headers.pop(header,None)
|
|
260
|
+
else:headers[header]=value
|
|
261
|
+
if headers.get('X-AgenticDome-Agent-Token'):
|
|
262
|
+
headers.pop('X-AgenticDome-Agent-Credential',None);headers.pop('X-AgenticDome-Workload-Token',None)
|
|
263
|
+
|
|
221
264
|
return headers
|
|
222
265
|
|
|
266
|
+
@contextmanager
|
|
267
|
+
def identity_context(self,*,user_token: Optional[str]=None,delegation_token: Optional[str]=None,task_id: Optional[str]=None):
|
|
268
|
+
"""Bind one request/task identity to existing hooks without sharing it across tasks."""
|
|
269
|
+
if user_token and delegation_token:raise ValueError('Use a user token or a delegation token, not both')
|
|
270
|
+
if delegation_token and not task_id:raise ValueError('A delegation token requires its task ID')
|
|
271
|
+
contexts=dict(_CALL_IDENTITIES.get() or {});headers=dict(contexts.get(id(self),{}))
|
|
272
|
+
if user_token or delegation_token:
|
|
273
|
+
headers.update({'X-AgenticDome-User-Token':None,'X-AgenticDome-Delegation-Token':None})
|
|
274
|
+
for value,header,limit in ((user_token,'X-AgenticDome-User-Token',16384),(delegation_token,'X-AgenticDome-Delegation-Token',16384),(task_id,'X-AgenticDome-Task-Id',256)):
|
|
275
|
+
if value is not None:
|
|
276
|
+
if not isinstance(value,str) or not value.strip() or len(value)>limit or any(ord(c)<32 or ord(c)==127 for c in value):raise ValueError('Invalid scoped identity value')
|
|
277
|
+
headers[header]=value.strip()
|
|
278
|
+
contexts[id(self)]=headers;token=_CALL_IDENTITIES.set(contexts)
|
|
279
|
+
try:yield self
|
|
280
|
+
finally:_CALL_IDENTITIES.reset(token)
|
|
281
|
+
|
|
282
|
+
def enrol_identity(self, agent_id: str, framework: str = 'application') -> Dict[str, Any]:
|
|
283
|
+
"""Obtain/renew a short-lived managed identity using configured deployment proof."""
|
|
284
|
+
return self._request('POST','/identity/v1/enrol',json_body={'agent_id':agent_id,'framework':framework})
|
|
285
|
+
|
|
286
|
+
def delegate_identity(self, recipient_agent_id: str, task_id: str, *, subject_token: Optional[str] = None) -> Dict[str, Any]:
|
|
287
|
+
payload={'recipient_agent_id':recipient_agent_id,'task_id':task_id,'scope':'identity:act'}
|
|
288
|
+
if subject_token:payload['subject_token']=subject_token
|
|
289
|
+
return self._request('POST','/identity/v1/delegate',json_body=payload)
|
|
290
|
+
|
|
291
|
+
def exchange_identity(self, subject_token: str, audience: str, task_id: str, scope: str) -> Dict[str, Any]:
|
|
292
|
+
return self._request('POST','/identity/v1/token',json_body={'grant_type':'urn:ietf:params:oauth:grant-type:token-exchange',
|
|
293
|
+
'subject_token':subject_token,'subject_token_type':'urn:ietf:params:oauth:token-type:access_token','audience':audience,'task_id':task_id,'scope':scope})
|
|
294
|
+
|
|
223
295
|
def _require_nonempty(self, name: str, value: Optional[str]) -> str:
|
|
224
296
|
"""
|
|
225
297
|
Require a non-empty, non-whitespace-only string.
|
|
@@ -229,6 +301,53 @@ class AgenticDomeClient:
|
|
|
229
301
|
raise ValueError(f"'{name}' is required and cannot be blank")
|
|
230
302
|
return s
|
|
231
303
|
|
|
304
|
+
def _managed_headers(self,path,json_body,headers):
|
|
305
|
+
"""Fail closed on old runtimes; reuse a short-lived token across existing hooks."""
|
|
306
|
+
if not path.startswith(('/tools/','/a2a','/mcp')):
|
|
307
|
+
return headers
|
|
308
|
+
if not any(headers.get(h) for h in ('X-AgenticDome-Deployment','X-AgenticDome-Agent-Token')):
|
|
309
|
+
if headers.get('X-AgenticDome-User-Token') or headers.get('X-AgenticDome-Delegation-Token'):raise AgenticDomeError('Configure deployment proof or an enrolled agent token before supplying delegated identity')
|
|
310
|
+
return headers
|
|
311
|
+
import hashlib,time
|
|
312
|
+
body=json_body if isinstance(json_body,dict) else {}
|
|
313
|
+
params=body.get('params') if isinstance(body.get('params'),dict) else {}
|
|
314
|
+
if isinstance(params.get('arguments'),dict):body=params['arguments']
|
|
315
|
+
elif params.get('agent_id'):body=params
|
|
316
|
+
context=body.get('policy_context') if isinstance(body.get('policy_context'),dict) else {}
|
|
317
|
+
native=body.get('agent_id') or headers.get('X-AgenticDome-Agent-Id') or 'application'
|
|
318
|
+
framework=context.get('platform') or body.get('platform') or headers.get('X-AgenticDome-Agent-Framework') or 'gateway'
|
|
319
|
+
explicit=headers.get('X-AgenticDome-Agent-Token')
|
|
320
|
+
proof=explicit or headers.get('X-AgenticDome-Agent-Credential') or headers.get('X-AgenticDome-Workload-Token') or ''
|
|
321
|
+
cache_key=hashlib.sha256(json.dumps([headers.get('X-Tenant-Id'),headers.get('X-AgenticDome-Deployment'),native,framework,proof]).encode()).hexdigest()
|
|
322
|
+
if self._managed_token_lock is None:
|
|
323
|
+
self._managed_token_lock=threading.RLock()
|
|
324
|
+
with self._managed_token_lock:
|
|
325
|
+
cached=self._managed_token_cache.get(cache_key)
|
|
326
|
+
if not cached or cached[1]<=time.time()+30:
|
|
327
|
+
clean={k:v for k,v in headers.items() if k.lower() not in {'x-agenticdome-user-token','x-agenticdome-delegation-token','x-agenticdome-task-id'}}
|
|
328
|
+
endpoint='/identity/v1/introspect' if explicit else '/identity/v1/enrol'
|
|
329
|
+
payload={'token':explicit} if explicit else {'agent_id':native,'framework':framework}
|
|
330
|
+
result=self.session.request(method='POST',url=self.api_base+endpoint,headers=clean,json=payload,timeout=self._timeout_tuple(None))
|
|
331
|
+
if not result.ok:
|
|
332
|
+
raise AgenticDomeHTTPError(result.status_code,'Managed identity could not be verified. Check deployment approval and update the assigned sidecar.',result.text)
|
|
333
|
+
issued=result.json()
|
|
334
|
+
if explicit:
|
|
335
|
+
if issued.get('active') is not True or issued.get('token_use')!='agent_identity':
|
|
336
|
+
raise AgenticDomeError('Managed agent token is not active')
|
|
337
|
+
token=explicit;expires=float(issued.get('exp',0))
|
|
338
|
+
else:
|
|
339
|
+
token=issued.get('access_token');expires=time.time()+min(float(issued.get('expires_in',0)),3600)
|
|
340
|
+
if not isinstance(token,str) or not token or not time.time()<expires<=time.time()+3601:
|
|
341
|
+
raise AgenticDomeError('Runtime returned an invalid managed identity response')
|
|
342
|
+
# Bound cache entries when frameworks create short-lived specialist names.
|
|
343
|
+
if len(self._managed_token_cache)>=1000:
|
|
344
|
+
self._managed_token_cache={k:v for k,v in self._managed_token_cache.items() if v[1]>time.time()+30}
|
|
345
|
+
if len(self._managed_token_cache)>=1000:self._managed_token_cache.pop(next(iter(self._managed_token_cache)))
|
|
346
|
+
cached=(token,expires);self._managed_token_cache[cache_key]=cached
|
|
347
|
+
headers=dict(headers);headers.pop('X-AgenticDome-Agent-Credential',None);headers.pop('X-AgenticDome-Workload-Token',None)
|
|
348
|
+
headers['X-AgenticDome-Agent-Token']=cached[0]
|
|
349
|
+
return headers
|
|
350
|
+
|
|
232
351
|
def _effective_tenant_id(self, tenant_id: Optional[Union[str, int]] = None) -> str:
|
|
233
352
|
return self._require_nonempty(
|
|
234
353
|
"tenant_id",
|
|
@@ -433,6 +552,7 @@ class AgenticDomeClient:
|
|
|
433
552
|
use_bearer=use_bearer,
|
|
434
553
|
extra_headers=extra_headers,
|
|
435
554
|
)
|
|
555
|
+
headers=self._managed_headers(path,json_body,headers)
|
|
436
556
|
|
|
437
557
|
response = self.session.request(
|
|
438
558
|
method=method.upper(),
|
|
@@ -635,6 +755,7 @@ class AgenticDomeClient:
|
|
|
635
755
|
execution_boundary_id: Optional[str] = None,
|
|
636
756
|
execution_destination: Optional[str] = None,
|
|
637
757
|
execution_http_method: Optional[str] = None,
|
|
758
|
+
execution_request: Optional[Dict[str, Any]] = None,
|
|
638
759
|
workload_id: Optional[str] = None,
|
|
639
760
|
workload_uuid: Optional[str] = None,
|
|
640
761
|
tenant_id: Optional[Union[str, int]] = None,
|
|
@@ -828,6 +949,10 @@ class AgenticDomeClient:
|
|
|
828
949
|
|
|
829
950
|
if tool_name:
|
|
830
951
|
payload["policy_context"].setdefault("approval_action_id", str(uuid.uuid4()))
|
|
952
|
+
if execution_request is not None:
|
|
953
|
+
if not broker_enabled:
|
|
954
|
+
raise ValueError("Prepared HTTP execution requires the execution broker")
|
|
955
|
+
payload["execution_request"] = json.loads(json.dumps(execution_request, allow_nan=False))
|
|
831
956
|
path = "/tools/execution/authorize" if broker_enabled else "/tools/guardrail/validate"
|
|
832
957
|
if broker_enabled and resolved_broker_mode == "policy" and execution_broker is not True:
|
|
833
958
|
path = "/tools/execution/resolve"
|
|
@@ -855,7 +980,7 @@ class AgenticDomeClient:
|
|
|
855
980
|
)
|
|
856
981
|
return response
|
|
857
982
|
|
|
858
|
-
def resume_approved_action(self, pending: ApprovalRequired, executor):
|
|
983
|
+
def resume_approved_action(self, pending: ApprovalRequired, executor, *, with_authorization=False):
|
|
859
984
|
"""Revalidate and consume one exact-action grant before invoking executor(args).
|
|
860
985
|
|
|
861
986
|
The caller retains the prepared request; the portal never holds payloads.
|
|
@@ -866,7 +991,11 @@ class AgenticDomeClient:
|
|
|
866
991
|
request_id = str(uuid.UUID(pending.request_id))
|
|
867
992
|
payload = json.loads(pending._prepared_json)
|
|
868
993
|
tenant = payload.get("tenant_id")
|
|
869
|
-
|
|
994
|
+
grant_options={'tenant_id':tenant}
|
|
995
|
+
if any(os.getenv(name) for name in ('AGENTICDOME_IDENTITY_DEPLOYMENT','AGENTICDOME_AGENT_TOKEN','AGENTICDOME_AGENT_TOKEN_FILE')):
|
|
996
|
+
grant_options['extra_headers']={'X-AgenticDome-Agent-Id':payload.get('agent_id') or 'application',
|
|
997
|
+
'X-AgenticDome-Agent-Framework':(payload.get('policy_context') or {}).get('platform') or 'gateway'}
|
|
998
|
+
grant = self._request("GET", f"/tools/approvals/{request_id}/grant", **grant_options).get("approval_grant")
|
|
870
999
|
if not isinstance(grant, str) or not grant:
|
|
871
1000
|
raise AgenticDomeError("No current approval grant was returned")
|
|
872
1001
|
payload["policy_context"] = {**(payload.get("policy_context") or {}), "approval_grant": grant}
|
|
@@ -875,7 +1004,47 @@ class AgenticDomeClient:
|
|
|
875
1004
|
broker = response.get("broker") or {}
|
|
876
1005
|
if response.get("verdict") != "ALLOWED" or not broker.get("verified") or not broker.get("token_consumed") or broker.get("approval_request_id") != request_id or not response.get("execution_receipt"):
|
|
877
1006
|
raise AgenticDomeError("The approved action could not be revalidated and consumed")
|
|
878
|
-
|
|
1007
|
+
exact_args = json.loads(pending._prepared_json)["tool_args"]
|
|
1008
|
+
return executor(exact_args, response) if with_authorization else executor(exact_args)
|
|
1009
|
+
|
|
1010
|
+
def execute_http(self, *, method, url, agent_id, tool_name, body=b"", headers=None, timeout=30, **context):
|
|
1011
|
+
"""Authorize and send the same HTTP request. ApprovalRequired pauses before sending."""
|
|
1012
|
+
from .http_execution import prepare, send
|
|
1013
|
+
prepared, arguments, descriptor = prepare(method, url, body, headers)
|
|
1014
|
+
result = self.guardrail_validate(text="Execute reviewed HTTP operation", agent_id=agent_id,
|
|
1015
|
+
tool_name=tool_name, tool_args=arguments, platform=context.pop("platform", "generic"),
|
|
1016
|
+
execution_broker=True, execution_destination=prepared.url, execution_http_method=prepared.method,
|
|
1017
|
+
execution_request=descriptor, **context)
|
|
1018
|
+
return send(prepared, result, self, workload_id=context.get("workload_id"), timeout=timeout,
|
|
1019
|
+
tool_name=tool_name, arguments=arguments, require_graphql=(context.get("policy_context") or {}).get("required_graphql_schema"))
|
|
1020
|
+
|
|
1021
|
+
def execute_graphql(self, *, url, query, agent_id, tool_name, variables=None, operation_name=None, headers=None, **context):
|
|
1022
|
+
"""Review GraphQL in the sidecar and execute its exact JSON bytes."""
|
|
1023
|
+
if not isinstance(query, str) or not query.strip(): raise ValueError("Supply a complete GraphQL document")
|
|
1024
|
+
if variables is not None and not isinstance(variables, dict): raise ValueError("GraphQL variables must be an object")
|
|
1025
|
+
if any(k.lower() == "content-type" for k in (headers or {})): raise ValueError("GraphQL content type is managed by the SDK")
|
|
1026
|
+
payload = {"query": query, "variables": variables or {}}
|
|
1027
|
+
if operation_name is not None: payload["operationName"] = operation_name
|
|
1028
|
+
context["policy_context"] = {**(context.get("policy_context") or {}), "required_graphql_schema": "agenticdome.graphql-actions.v1"}
|
|
1029
|
+
return self.execute_http(method="POST", url=url, body=json.dumps(payload, allow_nan=False),
|
|
1030
|
+
headers={**(headers or {}), "Content-Type": "application/json"}, agent_id=agent_id, tool_name=tool_name, **context)
|
|
1031
|
+
|
|
1032
|
+
def resume_approved_http(self, pending: ApprovalRequired, *, headers=None, timeout=30):
|
|
1033
|
+
"""Resume the frozen HTTP request; supply fresh authentication headers separately."""
|
|
1034
|
+
from .http_execution import prepare, send, BOUND_HEADERS
|
|
1035
|
+
payload = json.loads(pending._prepared_json)
|
|
1036
|
+
descriptor = payload.get("execution_request")
|
|
1037
|
+
if not isinstance(descriptor, dict):
|
|
1038
|
+
raise ValueError("This approval does not contain a prepared HTTP request")
|
|
1039
|
+
if any(str(k).lower() in BOUND_HEADERS for k in (headers or {})):
|
|
1040
|
+
raise ValueError("Approved content and resource preconditions cannot be changed")
|
|
1041
|
+
prepared, arguments, actual = prepare(payload["http_method"], payload["destination"],
|
|
1042
|
+
base64.b64decode(descriptor["body_base64"], validate=True), {**(headers or {}), **descriptor["headers"]})
|
|
1043
|
+
if arguments != payload["tool_args"] or actual != descriptor:
|
|
1044
|
+
raise AgenticDomeError("Prepared HTTP action changed during resume")
|
|
1045
|
+
return self.resume_approved_action(pending, lambda args, result: send(prepared, result, self,
|
|
1046
|
+
workload_id=payload.get("workload_id"), timeout=timeout, tool_name=payload["tool_name"], arguments=arguments,
|
|
1047
|
+
require_graphql=(payload.get("policy_context") or {}).get("required_graphql_schema")), with_authorization=True)
|
|
879
1048
|
|
|
880
1049
|
@staticmethod
|
|
881
1050
|
def enforcement_headers(result: Dict[str, Any], *, workload_id: Optional[str] = None) -> Dict[str, str]:
|
|
@@ -33,6 +33,7 @@ README_METHODS = {
|
|
|
33
33
|
"invoke_agent_securely", "wrap_retriever", "create_node_postprocessor",
|
|
34
34
|
"create_callback_handler",
|
|
35
35
|
"guarded_tool_executor",
|
|
36
|
+
"execute_http", "execute_graphql",
|
|
36
37
|
}
|
|
37
38
|
FRAMEWORK_METHODS = (CATALOG_METHODS | README_METHODS) - {"guardrail_validate", "mesh_validate"}
|
|
38
39
|
A2A_METHODS = {
|
|
@@ -53,6 +54,7 @@ OUTPUT_METHODS = {
|
|
|
53
54
|
"sanitize_streaming_events", "sanitize_retrieval_documents",
|
|
54
55
|
}
|
|
55
56
|
TOOL_METHODS = {
|
|
57
|
+
"execute_http", "execute_graphql",
|
|
56
58
|
"authorize_tool_call", "authorize_transition", "transition_node",
|
|
57
59
|
"wrap_tool_handler", "wrap_tool_node", "wrap_tool_function",
|
|
58
60
|
"wrap_tool_executor", "wrap_action_group_lambda", "secure_tool",
|
{agenticdome_python_sdk-1.2.47 → agenticdome_python_sdk-1.2.49}/agenticdome_sdk/hook_catalog.py
RENAMED
|
@@ -51,8 +51,8 @@ PUBLISHED_AGENTICDOME_PACKAGES: Dict[str, Dict[str, str]] = {
|
|
|
51
51
|
|
|
52
52
|
# Prepared artifacts are kept separate from registry-verified published releases.
|
|
53
53
|
RELEASE_CANDIDATE_PACKAGES = {
|
|
54
|
-
'agenticdome-python-sdk': {'version': '1.2.
|
|
55
|
-
'agenticdome-sdk': {'version': '0.6.
|
|
54
|
+
'agenticdome-python-sdk': {'version': '1.2.48', 'status': 'unpublished'},
|
|
55
|
+
'agenticdome-sdk': {'version': '0.6.16', 'status': 'unpublished'},
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
|
|
@@ -298,7 +298,7 @@ FRAMEWORK_HOOK_CATALOG: Dict[str, Dict[str, Any]] = {
|
|
|
298
298
|
"Custom Python",
|
|
299
299
|
"agenticdome_sdk",
|
|
300
300
|
"AgenticDomeClient",
|
|
301
|
-
["guardrail_validate", "mesh_validate"],
|
|
301
|
+
["guardrail_validate", "mesh_validate", "execute_http", "execute_graphql"],
|
|
302
302
|
docs="docs/frameworks/custom-python.md",
|
|
303
303
|
),
|
|
304
304
|
"typescript": {
|
|
@@ -311,6 +311,7 @@ FRAMEWORK_HOOK_CATALOG: Dict[str, Dict[str, Any]] = {
|
|
|
311
311
|
"adapter_module": "agenticdome-sdk",
|
|
312
312
|
"adapter_class": "AgenticDomeClient",
|
|
313
313
|
"attachment_methods": ["guardrailValidate", "meshValidate"],
|
|
314
|
+
"action_adapters": {"http": "executeHttp", "graphql": "executeGraphql", "ownership": "OwnershipGuard", "qualification": "Verify these optional exports in the installed npm package before use; Python catalogue publication does not certify an npm release."},
|
|
314
315
|
"native_hooks": [],
|
|
315
316
|
"docs": "agenticdome-sdk package README",
|
|
316
317
|
},
|
|
@@ -445,7 +446,7 @@ _HARNESS_VERIFICATION: Dict[str, Dict[str, Any]] = {
|
|
|
445
446
|
},
|
|
446
447
|
"custom-python": {
|
|
447
448
|
"adapter_attrs": ["AgenticDomeClient"],
|
|
448
|
-
"firewall_methods": ["guardrail_validate", "mesh_validate"],
|
|
449
|
+
"firewall_methods": ["guardrail_validate", "mesh_validate", "execute_http", "execute_graphql"],
|
|
449
450
|
},
|
|
450
451
|
}
|
|
451
452
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Prepare once and send the policy-reviewed HTTP bytes without redirects."""
|
|
2
|
+
import base64
|
|
3
|
+
import json
|
|
4
|
+
from urllib.parse import urlsplit, urlunsplit
|
|
5
|
+
|
|
6
|
+
import requests
|
|
7
|
+
|
|
8
|
+
BOUND_HEADERS = ("content-type", "if-match", "if-none-match", "if-unmodified-since")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def prepare(method, url, body=b"", headers=None):
|
|
12
|
+
method = method.upper()
|
|
13
|
+
if method not in {"GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"}:
|
|
14
|
+
raise ValueError("Unsupported exact HTTP method")
|
|
15
|
+
if isinstance(body, str):
|
|
16
|
+
body = body.encode("utf-8")
|
|
17
|
+
if not isinstance(body, bytes) or len(body) > 131072:
|
|
18
|
+
raise ValueError("Supply at most 128 KiB of UTF-8 HTTP body bytes")
|
|
19
|
+
if method in {"GET", "HEAD"} and body:
|
|
20
|
+
raise ValueError("GET/HEAD bodies are not supported")
|
|
21
|
+
body.decode("utf-8")
|
|
22
|
+
headers = dict(headers or {})
|
|
23
|
+
if any(str(k).lower() in {"host", "content-length", "transfer-encoding", "content-encoding"} or str(k).lower().startswith("x-agenticdome-") for k in headers):
|
|
24
|
+
raise ValueError("HTTP transport and AgenticDome headers are managed by the SDK")
|
|
25
|
+
parsed = urlsplit(url)
|
|
26
|
+
if parsed.scheme not in {"http", "https"} or not parsed.hostname or parsed.username is not None or parsed.password is not None or parsed.fragment:
|
|
27
|
+
raise ValueError("Use an absolute HTTP(S) URL without credentials or fragment")
|
|
28
|
+
host = parsed.hostname.lower()
|
|
29
|
+
if ":" in host:
|
|
30
|
+
host = "[" + host + "]"
|
|
31
|
+
if parsed.port and parsed.port != (443 if parsed.scheme == "https" else 80):
|
|
32
|
+
host += ":" + str(parsed.port)
|
|
33
|
+
url = urlunsplit((parsed.scheme, host, parsed.path or "/", parsed.query, ""))
|
|
34
|
+
prepared = requests.Request(method, url, data=body, headers=headers).prepare()
|
|
35
|
+
bound = {k.lower(): v for k, v in prepared.headers.items() if k.lower() in BOUND_HEADERS}
|
|
36
|
+
content = None
|
|
37
|
+
if body:
|
|
38
|
+
content = json.loads(body) if "json" in bound.get("content-type", "").lower() else body.decode("utf-8")
|
|
39
|
+
arguments = {"method": method, "url": prepared.url, "body": content, "headers": bound}
|
|
40
|
+
descriptor = {"body_base64": base64.b64encode(body).decode("ascii"), "headers": bound}
|
|
41
|
+
return prepared, arguments, descriptor
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def send(prepared, authorization, client, *, workload_id=None, timeout=30, tool_name=None, arguments=None, require_graphql=None):
|
|
45
|
+
from .client import AgenticDomeError
|
|
46
|
+
broker = authorization.get("broker") or {}
|
|
47
|
+
evidence = authorization.get("enforcement_evidence") or {}
|
|
48
|
+
if authorization.get("verdict") != "ALLOWED" or not broker.get("verified") or not broker.get("token_consumed") or evidence.get("http_request_bound") is not True:
|
|
49
|
+
raise AgenticDomeError("Exact HTTP execution requires a compatible enforcing broker receipt")
|
|
50
|
+
if require_graphql and evidence.get("graphql_interpretation") != require_graphql:
|
|
51
|
+
raise AgenticDomeError("GraphQL execution requires a compatible interpreting sidecar")
|
|
52
|
+
if client.ownership_guard is not None:
|
|
53
|
+
if not client.tenant_id:
|
|
54
|
+
raise AgenticDomeError("Configure the enforcement tenant when using resource ownership adapters")
|
|
55
|
+
client.ownership_guard.check_http(tool_name, arguments, evidence, expected_tenant=client.tenant_id)
|
|
56
|
+
prepared.headers.update(client.enforcement_headers(authorization, workload_id=workload_id))
|
|
57
|
+
# A fresh session has no agent-supplied hooks, cookies or automatic retries.
|
|
58
|
+
with requests.Session() as session:
|
|
59
|
+
settings = session.merge_environment_settings(prepared.url, {}, False, True, None)
|
|
60
|
+
response = session.send(prepared, timeout=timeout, allow_redirects=False, **settings)
|
|
61
|
+
if 300 <= response.status_code < 400:
|
|
62
|
+
response.close()
|
|
63
|
+
raise AgenticDomeError("Redirect refused; authorize its destination as a new action")
|
|
64
|
+
return response
|
|
@@ -363,6 +363,7 @@ class AgenticDomeMCPHostFirewall:
|
|
|
363
363
|
lifecycle_reporter: Optional[VerifiedActionReporter] = None,
|
|
364
364
|
provider_action_rules: Optional[Dict[str, "ProviderActionRule"]] = None,
|
|
365
365
|
resolve_provider_facts: Optional[Callable[[str, Dict[str, Any]], Any]] = None,
|
|
366
|
+
ownership_guard=None,
|
|
366
367
|
) -> None:
|
|
367
368
|
self.config = config or load_config()
|
|
368
369
|
if not credentials_or_local_sim(self.config.api_base, self.config.api_key, self.config.tenant_id):
|
|
@@ -382,6 +383,7 @@ class AgenticDomeMCPHostFirewall:
|
|
|
382
383
|
api_base=self.config.api_base, api_key=self.config.api_key, sender=getattr(self.client, "report_action_evidence", None))
|
|
383
384
|
self.provider_action_rules = dict(provider_action_rules or {})
|
|
384
385
|
self.resolve_provider_facts = resolve_provider_facts
|
|
386
|
+
self.ownership_guard = ownership_guard
|
|
385
387
|
self._rate_lock = Lock()
|
|
386
388
|
self._rate_events: Dict[str, Deque[float]] = defaultdict(deque)
|
|
387
389
|
|
|
@@ -674,7 +676,7 @@ class AgenticDomeMCPHostFirewall:
|
|
|
674
676
|
logger.warning("AgenticDome incident reporting failed; continuing. reason=%s", exc)
|
|
675
677
|
|
|
676
678
|
def _fail_or_raise(self, message: str, exc: Optional[Exception] = None) -> None:
|
|
677
|
-
if self.config.fail_closed:
|
|
679
|
+
if self.config.fail_closed or self.ownership_guard is not None:
|
|
678
680
|
if exc is not None:
|
|
679
681
|
raise MCPToolBlocked(message) from exc
|
|
680
682
|
raise MCPToolBlocked(message)
|
|
@@ -1249,6 +1251,9 @@ class AgenticDomeMCPHostFirewall:
|
|
|
1249
1251
|
if not isinstance(mcp_request, dict):
|
|
1250
1252
|
return self.jsonrpc_error(None, -32600, "Invalid Request")
|
|
1251
1253
|
|
|
1254
|
+
if self._method(mcp_request) == "tools/call" or (self.ownership_guard is not None and self._method(mcp_request) in {"resources/read", "prompts/get"}):
|
|
1255
|
+
mcp_request = copy.deepcopy(mcp_request)
|
|
1256
|
+
|
|
1252
1257
|
rid = self._request_id(mcp_request)
|
|
1253
1258
|
method = self._method(mcp_request)
|
|
1254
1259
|
params = self._params(mcp_request)
|
|
@@ -1270,28 +1275,36 @@ class AgenticDomeMCPHostFirewall:
|
|
|
1270
1275
|
if blocked:
|
|
1271
1276
|
return blocked
|
|
1272
1277
|
sanitized_args = self._sanitized_args(decision, explicit_only=self._verdict(decision) == "REDACTED")
|
|
1273
|
-
forwarded_args = sanitized_args if sanitized_args is not None else self._strip_internal_args(tool_args)
|
|
1278
|
+
forwarded_args = copy.deepcopy(sanitized_args if sanitized_args is not None else self._strip_internal_args(tool_args))
|
|
1274
1279
|
await self._check_provider_action(tool_name=tool_name, arguments=forwarded_args)
|
|
1280
|
+
if self.ownership_guard is not None:
|
|
1281
|
+
await self.ownership_guard.check_async(tool_name, forwarded_args, expected_tenant=self.config.tenant_id)
|
|
1275
1282
|
self._audit("mcp_request_allowed", context=local_context, details={"method": method, "operation": tool_name})
|
|
1276
1283
|
return self._replace_tool_args(mcp_request, forwarded_args)
|
|
1277
1284
|
|
|
1278
|
-
if method == "resources/read" and self.config.protect_resources_read:
|
|
1285
|
+
if method == "resources/read" and (self.config.protect_resources_read or self.ownership_guard is not None):
|
|
1279
1286
|
uri, resource_params = self._extract_resource_read(mcp_request)
|
|
1280
1287
|
decision = await self.authorize_mcp_resource_read(uri=uri, params=resource_params, context=local_context)
|
|
1281
1288
|
blocked = await self._handle_blocking_decision(decision=decision, rid=rid, context=local_context, method=method, operation=uri)
|
|
1282
1289
|
if blocked:
|
|
1283
1290
|
return blocked
|
|
1284
1291
|
sanitized_params = self._sanitized_args(decision, explicit_only=self._verdict(decision) == "REDACTED")
|
|
1292
|
+
if self.ownership_guard is not None:
|
|
1293
|
+
sanitized_params = copy.deepcopy(sanitized_params if sanitized_params is not None else resource_params)
|
|
1294
|
+
await self.ownership_guard.check_async("mcp.resources/read", sanitized_params, expected_tenant=self.config.tenant_id)
|
|
1285
1295
|
self._audit("mcp_request_allowed", context=local_context, details={"method": method, "operation": uri})
|
|
1286
1296
|
return self._replace_params(mcp_request, sanitized_params) if sanitized_params is not None else mcp_request
|
|
1287
1297
|
|
|
1288
|
-
if method == "prompts/get" and self.config.protect_prompts_get:
|
|
1298
|
+
if method == "prompts/get" and (self.config.protect_prompts_get or self.ownership_guard is not None):
|
|
1289
1299
|
name, prompt_params = self._extract_prompt_get(mcp_request)
|
|
1290
1300
|
decision = await self.authorize_mcp_prompt_get(name=name, params=prompt_params, context=local_context)
|
|
1291
1301
|
blocked = await self._handle_blocking_decision(decision=decision, rid=rid, context=local_context, method=method, operation=name)
|
|
1292
1302
|
if blocked:
|
|
1293
1303
|
return blocked
|
|
1294
1304
|
sanitized_params = self._sanitized_args(decision, explicit_only=self._verdict(decision) == "REDACTED")
|
|
1305
|
+
if self.ownership_guard is not None:
|
|
1306
|
+
sanitized_params = copy.deepcopy(sanitized_params if sanitized_params is not None else prompt_params)
|
|
1307
|
+
await self.ownership_guard.check_async("mcp.prompts/get", sanitized_params, expected_tenant=self.config.tenant_id)
|
|
1295
1308
|
self._audit("mcp_request_allowed", context=local_context, details={"method": method, "operation": name})
|
|
1296
1309
|
return self._replace_params(mcp_request, sanitized_params) if sanitized_params is not None else mcp_request
|
|
1297
1310
|
|
|
@@ -1322,8 +1335,11 @@ class AgenticDomeMCPHostFirewall:
|
|
|
1322
1335
|
except MCPToolBlocked as exc:
|
|
1323
1336
|
return self.jsonrpc_error(rid, -32000, "AgenticDome Blocked: MCP request not authorized", data={"method": method})
|
|
1324
1337
|
except (AgenticDomeHTTPError, Exception) as exc:
|
|
1325
|
-
if method
|
|
1326
|
-
return self.jsonrpc_error(rid, -32000, "AgenticDome Blocked:
|
|
1338
|
+
if method in {"resources/read", "prompts/get"} and self.ownership_guard is not None and self.ownership_guard.protects("mcp." + method):
|
|
1339
|
+
return self.jsonrpc_error(rid, -32000, "AgenticDome Blocked: Provider resource authorization unavailable", data={"method": method})
|
|
1340
|
+
if method == "tools/call" and (self._extract_tool_call(mcp_request)[0] in self.provider_action_rules or
|
|
1341
|
+
self.ownership_guard is not None and self.ownership_guard.protects(self._extract_tool_call(mcp_request)[0])):
|
|
1342
|
+
return self.jsonrpc_error(rid, -32000, "AgenticDome Blocked: Provider resource authorization unavailable", data={"method": method})
|
|
1327
1343
|
if self.config.fail_closed:
|
|
1328
1344
|
return self.jsonrpc_error(rid, -32000, "AgenticDome Blocked: MCP preflight unavailable", data={"method": method})
|
|
1329
1345
|
logger.warning("AgenticDome MCP preflight failed open. reason=%s", exc)
|