agenticdome-python-sdk 1.2.47__py3-none-any.whl → 1.2.50__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.
- {agenticdome_python_sdk-1.2.47.dist-info → agenticdome_python_sdk-1.2.50.dist-info}/METADATA +48 -27
- {agenticdome_python_sdk-1.2.47.dist-info → agenticdome_python_sdk-1.2.50.dist-info}/RECORD +18 -14
- {agenticdome_python_sdk-1.2.47.dist-info → agenticdome_python_sdk-1.2.50.dist-info}/WHEEL +1 -1
- {agenticdome_python_sdk-1.2.47.dist-info → agenticdome_python_sdk-1.2.50.dist-info}/entry_points.txt +1 -0
- agenticdome_sdk/__init__.py +2 -0
- agenticdome_sdk/catalog_snapshot.json +4 -4
- agenticdome_sdk/client.py +190 -3
- agenticdome_sdk/docker_guard.py +91 -0
- agenticdome_sdk/existing_integration.py +2 -0
- agenticdome_sdk/hook_catalog.py +25 -24
- agenticdome_sdk/http_execution.py +64 -0
- agenticdome_sdk/mcp_host.py +84 -14
- agenticdome_sdk/mcp_schema.py +245 -0
- agenticdome_sdk/onboarding_cli.py +27 -3
- agenticdome_sdk/ownership.py +139 -0
- {agenticdome_python_sdk-1.2.47.dist-info → agenticdome_python_sdk-1.2.50.dist-info}/licenses/LICENSE +0 -0
- {agenticdome_python_sdk-1.2.47.dist-info → agenticdome_python_sdk-1.2.50.dist-info}/licenses/NOTICE +0 -0
- {agenticdome_python_sdk-1.2.47.dist-info → agenticdome_python_sdk-1.2.50.dist-info}/top_level.txt +0 -0
{agenticdome_python_sdk-1.2.47.dist-info → agenticdome_python_sdk-1.2.50.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agenticdome-python-sdk
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.50
|
|
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
|
|
@@ -33,20 +33,20 @@ Requires-Dist: requests>=2.31.0
|
|
|
33
33
|
Requires-Dist: urllib3>=2.0.0
|
|
34
34
|
Requires-Dist: cryptography>=42.0.0
|
|
35
35
|
Provides-Extra: crewai
|
|
36
|
-
Requires-Dist: crewai<=1.15.
|
|
36
|
+
Requires-Dist: crewai<=1.15.34,>=1.15.5; extra == "crewai"
|
|
37
37
|
Provides-Extra: redis
|
|
38
38
|
Requires-Dist: redis>=4.5.0; extra == "redis"
|
|
39
39
|
Provides-Extra: pop
|
|
40
40
|
Requires-Dist: cryptography>=42.0.0; extra == "pop"
|
|
41
41
|
Provides-Extra: pydanticai
|
|
42
|
-
Requires-Dist: pydantic-ai<=2.
|
|
42
|
+
Requires-Dist: pydantic-ai<=2.64.0,>=2.16.0; extra == "pydanticai"
|
|
43
43
|
Requires-Dist: anyio>=4.0.0; extra == "pydanticai"
|
|
44
44
|
Provides-Extra: pydantic
|
|
45
|
-
Requires-Dist: pydantic-ai<=2.
|
|
45
|
+
Requires-Dist: pydantic-ai<=2.64.0,>=2.16.0; extra == "pydantic"
|
|
46
46
|
Requires-Dist: anyio>=4.0.0; extra == "pydantic"
|
|
47
47
|
Provides-Extra: langgraph
|
|
48
|
-
Requires-Dist: langgraph<=1.2.
|
|
49
|
-
Requires-Dist: langchain-core<=1.
|
|
48
|
+
Requires-Dist: langgraph<=1.2.19,>=1.2.9; extra == "langgraph"
|
|
49
|
+
Requires-Dist: langchain-core<=1.7.3,>=1.5.0; extra == "langgraph"
|
|
50
50
|
Requires-Dist: langchain-openai==1.3.5; extra == "langgraph"
|
|
51
51
|
Requires-Dist: anyio>=4.0.0; extra == "langgraph"
|
|
52
52
|
Provides-Extra: microsoft
|
|
@@ -55,51 +55,55 @@ Requires-Dist: autogen-agentchat==0.7.5; extra == "autogen"
|
|
|
55
55
|
Provides-Extra: microsoft-autogen
|
|
56
56
|
Requires-Dist: autogen-agentchat==0.7.5; extra == "microsoft-autogen"
|
|
57
57
|
Provides-Extra: foundry
|
|
58
|
-
Requires-Dist: azure-ai-projects<=2.
|
|
59
|
-
Requires-Dist: azure-identity
|
|
58
|
+
Requires-Dist: azure-ai-projects<=2.10.0,>=2.3.0; extra == "foundry"
|
|
59
|
+
Requires-Dist: azure-identity<=1.27.0,>=1.25.3; extra == "foundry"
|
|
60
60
|
Provides-Extra: agno
|
|
61
|
-
Requires-Dist: agno<=3.
|
|
61
|
+
Requires-Dist: agno<=3.1.12,>=2.8.0; extra == "agno"
|
|
62
62
|
Provides-Extra: openai-agents
|
|
63
|
-
Requires-Dist: openai-agents<=0.
|
|
63
|
+
Requires-Dist: openai-agents<=0.24.0,>=0.18.3; extra == "openai-agents"
|
|
64
64
|
Provides-Extra: mcp
|
|
65
65
|
Requires-Dist: mcp<=2.2.0,>=1.26.0; extra == "mcp"
|
|
66
|
+
Requires-Dist: jsonschema<5,>=4.23; extra == "mcp"
|
|
67
|
+
Requires-Dist: regex>=2024.11.6; extra == "mcp"
|
|
66
68
|
Provides-Extra: bedrock
|
|
67
|
-
Requires-Dist: boto3<=1.43.
|
|
69
|
+
Requires-Dist: boto3<=1.43.123,>=1.43.54; extra == "bedrock"
|
|
68
70
|
Provides-Extra: aws-bedrock
|
|
69
|
-
Requires-Dist: boto3<=1.43.
|
|
71
|
+
Requires-Dist: boto3<=1.43.123,>=1.43.54; extra == "aws-bedrock"
|
|
70
72
|
Provides-Extra: llamaindex
|
|
71
73
|
Requires-Dist: llama-index<=0.14.25,>=0.14.23; extra == "llamaindex"
|
|
72
74
|
Provides-Extra: llama-index
|
|
73
75
|
Requires-Dist: llama-index<=0.14.25,>=0.14.23; extra == "llama-index"
|
|
74
76
|
Provides-Extra: google-adk
|
|
75
|
-
Requires-Dist: google-adk<=2.
|
|
77
|
+
Requires-Dist: google-adk<=2.13.0,>=2.5.0; extra == "google-adk"
|
|
76
78
|
Provides-Extra: adk
|
|
77
|
-
Requires-Dist: google-adk<=2.
|
|
79
|
+
Requires-Dist: google-adk<=2.13.0,>=2.5.0; extra == "adk"
|
|
78
80
|
Provides-Extra: claude
|
|
79
|
-
Requires-Dist: claude-agent-sdk<=0.2.
|
|
81
|
+
Requires-Dist: claude-agent-sdk<=0.2.176,>=0.2.126; extra == "claude"
|
|
80
82
|
Provides-Extra: claude-agent-sdk
|
|
81
|
-
Requires-Dist: claude-agent-sdk<=0.2.
|
|
83
|
+
Requires-Dist: claude-agent-sdk<=0.2.176,>=0.2.126; extra == "claude-agent-sdk"
|
|
82
84
|
Provides-Extra: smolagents
|
|
83
85
|
Requires-Dist: smolagents==1.26.0; extra == "smolagents"
|
|
84
86
|
Provides-Extra: all
|
|
85
|
-
Requires-Dist: crewai<=1.15.
|
|
87
|
+
Requires-Dist: crewai<=1.15.34,>=1.15.5; extra == "all"
|
|
86
88
|
Requires-Dist: redis>=4.5.0; extra == "all"
|
|
87
89
|
Requires-Dist: cryptography>=42.0.0; extra == "all"
|
|
88
|
-
Requires-Dist: pydantic-ai<=2.
|
|
90
|
+
Requires-Dist: pydantic-ai<=2.64.0,>=2.16.0; extra == "all"
|
|
89
91
|
Requires-Dist: anyio>=4.0.0; extra == "all"
|
|
90
|
-
Requires-Dist: langgraph<=1.2.
|
|
91
|
-
Requires-Dist: langchain-core<=1.
|
|
92
|
+
Requires-Dist: langgraph<=1.2.19,>=1.2.9; extra == "all"
|
|
93
|
+
Requires-Dist: langchain-core<=1.7.3,>=1.5.0; extra == "all"
|
|
92
94
|
Requires-Dist: langchain-openai==1.3.5; extra == "all"
|
|
93
95
|
Requires-Dist: autogen-agentchat==0.7.5; extra == "all"
|
|
94
|
-
Requires-Dist: agno<=3.
|
|
95
|
-
Requires-Dist: azure-ai-projects<=2.
|
|
96
|
-
Requires-Dist: azure-identity
|
|
97
|
-
Requires-Dist: openai-agents<=0.
|
|
96
|
+
Requires-Dist: agno<=3.1.12,>=2.8.0; extra == "all"
|
|
97
|
+
Requires-Dist: azure-ai-projects<=2.10.0,>=2.3.0; extra == "all"
|
|
98
|
+
Requires-Dist: azure-identity<=1.27.0,>=1.25.3; extra == "all"
|
|
99
|
+
Requires-Dist: openai-agents<=0.24.0,>=0.18.3; extra == "all"
|
|
98
100
|
Requires-Dist: mcp<=2.2.0,>=1.26.0; extra == "all"
|
|
99
|
-
Requires-Dist: boto3<=1.43.
|
|
101
|
+
Requires-Dist: boto3<=1.43.123,>=1.43.54; extra == "all"
|
|
102
|
+
Requires-Dist: jsonschema<5,>=4.23; extra == "all"
|
|
103
|
+
Requires-Dist: regex>=2024.11.6; extra == "all"
|
|
100
104
|
Requires-Dist: llama-index<=0.14.25,>=0.14.23; extra == "all"
|
|
101
|
-
Requires-Dist: google-adk<=2.
|
|
102
|
-
Requires-Dist: claude-agent-sdk<=0.2.
|
|
105
|
+
Requires-Dist: google-adk<=2.13.0,>=2.5.0; extra == "all"
|
|
106
|
+
Requires-Dist: claude-agent-sdk<=0.2.176,>=0.2.126; extra == "all"
|
|
103
107
|
Requires-Dist: smolagents==1.26.0; extra == "all"
|
|
104
108
|
Provides-Extra: dev
|
|
105
109
|
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
@@ -2899,3 +2903,20 @@ The Python SDK client, public examples, and public SDK documentation in this rep
|
|
|
2899
2903
|
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
2904
|
|
|
2901
2905
|
For enterprise deployments, advanced governance workflows, dedicated regional control planes, or priority integration support, visit **[agenticdome.io](https://agenticdome.io)**.
|
|
2906
|
+
## Exact HTTP execution
|
|
2907
|
+
|
|
2908
|
+
`client.execute_http(method=..., url=..., body=..., headers=..., agent_id=...,
|
|
2909
|
+
tool_name=..., request_purpose=...)` authorizes and sends the same bounded UTF-8
|
|
2910
|
+
request. It requires a compatible sidecar broker and refuses redirects. It
|
|
2911
|
+
raises `ApprovalRequired` before sending when human review is required; resume
|
|
2912
|
+
with `client.resume_approved_http(pending, headers=...)` after approval. Fresh
|
|
2913
|
+
API authentication headers may be supplied; reviewed content and If-Match,
|
|
2914
|
+
If-None-Match or If-Unmodified-Since preconditions cannot change. Existing
|
|
2915
|
+
generic tool callbacks keep their existing contract. Network-level protection
|
|
2916
|
+
also requires routing through a compatible enforcing gateway with direct egress
|
|
2917
|
+
controlled. A returned HTTP response is the provider's outcome, separate from
|
|
2918
|
+
the policy decision and gateway admission.
|
|
2919
|
+
|
|
2920
|
+
### Shared resource adapters and GraphQL
|
|
2921
|
+
|
|
2922
|
+
`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
|
-
agenticdome_python_sdk-1.2.
|
|
2
|
-
agenticdome_python_sdk-1.2.
|
|
3
|
-
agenticdome_sdk/__init__.py,sha256=
|
|
1
|
+
agenticdome_python_sdk-1.2.50.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
2
|
+
agenticdome_python_sdk-1.2.50.dist-info/licenses/NOTICE,sha256=obvKP6kV1Ny5R8_INFOpf0X5um9U2X43LGwQFobO9kg,550
|
|
3
|
+
agenticdome_sdk/__init__.py,sha256=7nGHtISU9udPIEepFh2JFzZ8trV44ziv1o19RClpls0,1270
|
|
4
4
|
agenticdome_sdk/_framework_firewall.py,sha256=87VViabk5bySrN36BCE_Wzooqlz653L21r6usyq_d_Q,32914
|
|
5
5
|
agenticdome_sdk/_mode.py,sha256=XvOgh5sW-FG8S39V483h3uLiFh8wSt14OmYXz_6eDO8,1283
|
|
6
6
|
agenticdome_sdk/action_path_proof.py,sha256=5Zlghy7-LNhtRJM0Unb4NPUASzIsAC0LaWNVFR2yzzo,13497
|
|
@@ -8,41 +8,45 @@ agenticdome_sdk/agno.py,sha256=L3yfjTBHW47xzT67a1DsjtwmvrAoYBkbxADpsr85Cp0,60766
|
|
|
8
8
|
agenticdome_sdk/attestation.py,sha256=ij4cMff7nzLaIS0W02d2WURFcyKe72bcUlSz-dYkaLE,10310
|
|
9
9
|
agenticdome_sdk/autogen.py,sha256=KP4qlIcsNXB-4ZT9D7Slc1xWEeWXRIWkc5HGW0U6k2c,29018
|
|
10
10
|
agenticdome_sdk/aws_bedrock.py,sha256=2zD9j7xi0jna0sMeMf-hKZdc3Y4RPwzj6tMVOUGgIDQ,69581
|
|
11
|
-
agenticdome_sdk/catalog_snapshot.json,sha256=
|
|
11
|
+
agenticdome_sdk/catalog_snapshot.json,sha256=txDICNBLC643wzxHDJZoAMtx1wAnjXYmGgq3Xhnxdj0,957
|
|
12
12
|
agenticdome_sdk/claude.py,sha256=XeY9AUu61SYcJjQVz_AtL_WaN6X4KqP5nprEbbr4Q6A,17456
|
|
13
|
-
agenticdome_sdk/client.py,sha256=
|
|
13
|
+
agenticdome_sdk/client.py,sha256=U7WJVO_3r9canagaiEpcVaYHV18l5mbhk4CF_i0A5Xc,88269
|
|
14
14
|
agenticdome_sdk/connect.py,sha256=WOh9hEOEy6OmX4zrJEWZPsgYJUbl3PR03ukODe3WC4Q,18864
|
|
15
15
|
agenticdome_sdk/copilot_ir.py,sha256=zT13tOX8xu11yrOtIPMRFVud8CQ81Gu3WxsXxyQ4XT0,17928
|
|
16
16
|
agenticdome_sdk/copilot_ir_collector.cjs,sha256=oxLY8ByONo7Es4YjYiJuRz_A7IKL65Sy486UXnu-4Rs,9681
|
|
17
17
|
agenticdome_sdk/crewai.py,sha256=sSJQ49O7-8kqOAD2_jrsMtMOmBOcJmFkeOv7S3-ayMs,52490
|
|
18
18
|
agenticdome_sdk/demo.py,sha256=dyfqt2N_cJoyUWKnjPYuQxuw2hb2DrCNUf1jQKeYYoc,8350
|
|
19
|
-
agenticdome_sdk/
|
|
19
|
+
agenticdome_sdk/docker_guard.py,sha256=ilzw-ZNE_ZL4RJ8CE8FES-ni10cwnG9Iti92x4nQaKM,5075
|
|
20
|
+
agenticdome_sdk/existing_integration.py,sha256=O40rkFucrbuyQsezXhXm6txpt8T9PiXrmg4JmVSkYdw,11543
|
|
20
21
|
agenticdome_sdk/framework_edits.py,sha256=4BgWHxWKEkex8_DMhjVxjovpUVkrMF7TsCZzlS94mpA,23344
|
|
21
22
|
agenticdome_sdk/generic_python.py,sha256=JtXRcYEZ6_Dgxnnv4QgqeMZR8dFVr8EqFDM-XYQ-GMA,6823
|
|
22
23
|
agenticdome_sdk/google_adk.py,sha256=2TA-tUhY0lOnkGcs1BN9CUEz67ebVX4HJ7mnNoRPcZs,57258
|
|
23
24
|
agenticdome_sdk/guided_integration.py,sha256=4NBCacAcwEQkVct86G8NGYwrcTNT7xaxXGZ21aPaygY,52449
|
|
24
|
-
agenticdome_sdk/hook_catalog.py,sha256
|
|
25
|
+
agenticdome_sdk/hook_catalog.py,sha256=rvM0mXHqID8jmDI8kI-rAqFgkRNtUlDnqYcJ8i8__uw,29905
|
|
26
|
+
agenticdome_sdk/http_execution.py,sha256=85bBRxC0TBOKUaRmy4WHyyIoAub71_KkRL_--1YQrm4,3801
|
|
25
27
|
agenticdome_sdk/identity.py,sha256=mrymGgZSVsKJ9THRde54qGmMT7j_uZHmPJ-HtWk7PXE,4635
|
|
26
28
|
agenticdome_sdk/langgraph.py,sha256=FUvF6DSA5aZP3eoBoNeldgGtPrz-dO5xcVmrPPSBEhI,84312
|
|
27
29
|
agenticdome_sdk/lifecycle.py,sha256=obRIbJ9H90TPpfa46pZRTilg9Q8nhLTP5P2bsFbChbI,15210
|
|
28
30
|
agenticdome_sdk/llamaindex.py,sha256=BHplSUIsgMi7k8tBztprzaV9iaOXiljXbdeMRax_2h8,42860
|
|
29
|
-
agenticdome_sdk/mcp_host.py,sha256=
|
|
31
|
+
agenticdome_sdk/mcp_host.py,sha256=KCBUTZsNTQOg2GUFR1U-zD6wWgsVpWjS5uZ_4rB-wNM,76047
|
|
30
32
|
agenticdome_sdk/mcp_http_gateway.py,sha256=XrTgj46ZHIKJ9xS3EQPsac2C9OGUZnrOXomcLdkMk_Y,13629
|
|
31
33
|
agenticdome_sdk/mcp_rehearsal_server.py,sha256=cox4XqUTL8d0gaDzqxDZcEALkaz8otjOjOqHvoUeeCo,2118
|
|
34
|
+
agenticdome_sdk/mcp_schema.py,sha256=OHnh9mWtkxKjmR7OJUWuQYu35w9HYJ0W4wEIxSS22DM,12231
|
|
32
35
|
agenticdome_sdk/mcp_verification.py,sha256=WtRhAFVPTBqGOcHNf_db1m4jX9_TO0oxP98XWk4_ISY,14551
|
|
33
36
|
agenticdome_sdk/microsoft_agent_framework.py,sha256=GfIIuk0n-VhsZaTyoB7P6ilpz9bFLD95TWuX0rFSWeU,67219
|
|
34
37
|
agenticdome_sdk/microsoft_ai_foundry.py,sha256=YlO968s1dbAYcaEqhqufL92NFR66GuTtngnCv7-1mYc,56911
|
|
35
|
-
agenticdome_sdk/onboarding_cli.py,sha256=
|
|
38
|
+
agenticdome_sdk/onboarding_cli.py,sha256=qxU9hTp25qMM7Z6Kwv2Quf6NcY34REHpS78n9NlumB8,172600
|
|
36
39
|
agenticdome_sdk/onboarding_observations.py,sha256=M4UWdpYipMGi6Nw_eP7PvMLZsAv5UpXRYK0qR28qX6o,4498
|
|
37
40
|
agenticdome_sdk/openai_agents.py,sha256=0z-7FDBIG4usxnILpan6yjQHF4zXIzm9YLsh3-bW8Lw,57678
|
|
38
41
|
agenticdome_sdk/outcomes.py,sha256=jadWDzQaZXrHNvpPme8lQY0jihYLCoM3s4CihAq0JRo,2507
|
|
42
|
+
agenticdome_sdk/ownership.py,sha256=KEbRNZWJQn4rPnnBdmmmO4qn177sc2q3G0anKZvGkC4,8032
|
|
39
43
|
agenticdome_sdk/proof.py,sha256=ECKc14xSE0V1HHmcpZjfVz8-Q2H_fooah3BfdblFV8M,2878
|
|
40
44
|
agenticdome_sdk/pydantic.py,sha256=WKb8X0Fgydfid-ep8E-M8Yslz2pWcCP6w7n_aBxt1rI,54961
|
|
41
45
|
agenticdome_sdk/report_scope.py,sha256=Waoaal9hkZsNF5G-ifDXNO_3an0ZjQJVv6-Uzg94oOM,3575
|
|
42
46
|
agenticdome_sdk/simulation.py,sha256=UCbZy3u9AzfxQCfY38SCV3CxGxhinV9EA4aHMPlK4mc,8426
|
|
43
47
|
agenticdome_sdk/smolagents.py,sha256=wjMA1HVAQ-9wRNM38Jr9wlCpKMhF-9vxtTk6R-kwQhs,19094
|
|
44
|
-
agenticdome_python_sdk-1.2.
|
|
45
|
-
agenticdome_python_sdk-1.2.
|
|
46
|
-
agenticdome_python_sdk-1.2.
|
|
47
|
-
agenticdome_python_sdk-1.2.
|
|
48
|
-
agenticdome_python_sdk-1.2.
|
|
48
|
+
agenticdome_python_sdk-1.2.50.dist-info/METADATA,sha256=q92dUdi5nTk83IrIuKbqIQH7Q3lJcFwEMpEZ4CQ1HHs,148059
|
|
49
|
+
agenticdome_python_sdk-1.2.50.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
50
|
+
agenticdome_python_sdk-1.2.50.dist-info/entry_points.txt,sha256=0ObUYdthZhY_pEr8pPH-v6IxWRjUSkgdFVyx-w6u4fc,174
|
|
51
|
+
agenticdome_python_sdk-1.2.50.dist-info/top_level.txt,sha256=LZbbjXco5mqDrGwlTJpIKI5Sp6R_njzHHjExxAs9c3s,16
|
|
52
|
+
agenticdome_python_sdk-1.2.50.dist-info/RECORD,,
|
agenticdome_sdk/__init__.py
CHANGED
|
@@ -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",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "agenticdome.catalog-snapshot.v1",
|
|
3
3
|
"catalog_schema": "agenticdome.hook-catalog.v1",
|
|
4
|
-
"verified_at": "2026-
|
|
5
|
-
"python_sdk_version": "1.2.
|
|
4
|
+
"verified_at": "2026-11-02",
|
|
5
|
+
"python_sdk_version": "1.2.50",
|
|
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.50",
|
|
10
|
+
"url": "https://pypi.org/project/agenticdome-python-sdk/1.2.50/"
|
|
11
11
|
},
|
|
12
12
|
"agenticdome-sdk": {
|
|
13
13
|
"registry": "npm",
|
agenticdome_sdk/client.py
CHANGED
|
@@ -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",
|
|
@@ -423,6 +542,7 @@ class AgenticDomeClient:
|
|
|
423
542
|
use_bearer: bool = False,
|
|
424
543
|
extra_headers: Optional[Dict[str, str]] = None,
|
|
425
544
|
timeout: Optional[Union[int, float, Tuple[float, float]]] = None,
|
|
545
|
+
allow_redirects: Optional[bool] = None,
|
|
426
546
|
) -> Dict[str, Any]:
|
|
427
547
|
if self.is_simulation:
|
|
428
548
|
return self._simulation.request(method, path, json_body)
|
|
@@ -433,15 +553,24 @@ class AgenticDomeClient:
|
|
|
433
553
|
use_bearer=use_bearer,
|
|
434
554
|
extra_headers=extra_headers,
|
|
435
555
|
)
|
|
556
|
+
# Gateway guards already verify direct deployment/workload proofs. A
|
|
557
|
+
# short-lived Docker hook must not mint a token in an extra HTTP exchange
|
|
558
|
+
# on every call. Existing SDK endpoints keep their token lifecycle.
|
|
559
|
+
if path not in {"/gateway/v1/guard","/gateway/v1/guard/ready"}:
|
|
560
|
+
headers=self._managed_headers(path,json_body,headers)
|
|
436
561
|
|
|
562
|
+
request_options = {} if allow_redirects is None else {"allow_redirects": allow_redirects}
|
|
437
563
|
response = self.session.request(
|
|
438
564
|
method=method.upper(),
|
|
439
565
|
url=url,
|
|
440
566
|
headers=headers,
|
|
441
567
|
json=json_body,
|
|
442
568
|
timeout=self._timeout_tuple(timeout),
|
|
569
|
+
**request_options,
|
|
443
570
|
)
|
|
444
571
|
|
|
572
|
+
if allow_redirects is False and 300 <= response.status_code < 400:
|
|
573
|
+
raise AgenticDomeHTTPError(response.status_code, "Gateway redirects are not allowed", "")
|
|
445
574
|
if not response.ok:
|
|
446
575
|
try:
|
|
447
576
|
payload = response.json()
|
|
@@ -589,6 +718,15 @@ class AgenticDomeClient:
|
|
|
589
718
|
# ------------------------------------------------------------------
|
|
590
719
|
# REST Guardrail / Runtime
|
|
591
720
|
# ------------------------------------------------------------------
|
|
721
|
+
def guard_native_tool(self, event: Dict[str, Any]) -> Dict[str, Any]:
|
|
722
|
+
"""Check a Docker mandatory guard event; does not execute or cache permits."""
|
|
723
|
+
from .docker_guard import event_payload
|
|
724
|
+
return self._request("POST", "/gateway/v1/guard", json_body=event_payload(event), allow_redirects=False)
|
|
725
|
+
|
|
726
|
+
def native_guard_ready(self) -> Dict[str, Any]:
|
|
727
|
+
"""Verify assigned Gateway/identity readiness without executing a tool."""
|
|
728
|
+
return self._request("GET", "/gateway/v1/guard/ready", allow_redirects=False)
|
|
729
|
+
|
|
592
730
|
def guardrail_validate(
|
|
593
731
|
self,
|
|
594
732
|
*,
|
|
@@ -635,6 +773,7 @@ class AgenticDomeClient:
|
|
|
635
773
|
execution_boundary_id: Optional[str] = None,
|
|
636
774
|
execution_destination: Optional[str] = None,
|
|
637
775
|
execution_http_method: Optional[str] = None,
|
|
776
|
+
execution_request: Optional[Dict[str, Any]] = None,
|
|
638
777
|
workload_id: Optional[str] = None,
|
|
639
778
|
workload_uuid: Optional[str] = None,
|
|
640
779
|
tenant_id: Optional[Union[str, int]] = None,
|
|
@@ -828,6 +967,10 @@ class AgenticDomeClient:
|
|
|
828
967
|
|
|
829
968
|
if tool_name:
|
|
830
969
|
payload["policy_context"].setdefault("approval_action_id", str(uuid.uuid4()))
|
|
970
|
+
if execution_request is not None:
|
|
971
|
+
if not broker_enabled:
|
|
972
|
+
raise ValueError("Prepared HTTP execution requires the execution broker")
|
|
973
|
+
payload["execution_request"] = json.loads(json.dumps(execution_request, allow_nan=False))
|
|
831
974
|
path = "/tools/execution/authorize" if broker_enabled else "/tools/guardrail/validate"
|
|
832
975
|
if broker_enabled and resolved_broker_mode == "policy" and execution_broker is not True:
|
|
833
976
|
path = "/tools/execution/resolve"
|
|
@@ -855,7 +998,7 @@ class AgenticDomeClient:
|
|
|
855
998
|
)
|
|
856
999
|
return response
|
|
857
1000
|
|
|
858
|
-
def resume_approved_action(self, pending: ApprovalRequired, executor):
|
|
1001
|
+
def resume_approved_action(self, pending: ApprovalRequired, executor, *, with_authorization=False):
|
|
859
1002
|
"""Revalidate and consume one exact-action grant before invoking executor(args).
|
|
860
1003
|
|
|
861
1004
|
The caller retains the prepared request; the portal never holds payloads.
|
|
@@ -866,7 +1009,11 @@ class AgenticDomeClient:
|
|
|
866
1009
|
request_id = str(uuid.UUID(pending.request_id))
|
|
867
1010
|
payload = json.loads(pending._prepared_json)
|
|
868
1011
|
tenant = payload.get("tenant_id")
|
|
869
|
-
|
|
1012
|
+
grant_options={'tenant_id':tenant}
|
|
1013
|
+
if any(os.getenv(name) for name in ('AGENTICDOME_IDENTITY_DEPLOYMENT','AGENTICDOME_AGENT_TOKEN','AGENTICDOME_AGENT_TOKEN_FILE')):
|
|
1014
|
+
grant_options['extra_headers']={'X-AgenticDome-Agent-Id':payload.get('agent_id') or 'application',
|
|
1015
|
+
'X-AgenticDome-Agent-Framework':(payload.get('policy_context') or {}).get('platform') or 'gateway'}
|
|
1016
|
+
grant = self._request("GET", f"/tools/approvals/{request_id}/grant", **grant_options).get("approval_grant")
|
|
870
1017
|
if not isinstance(grant, str) or not grant:
|
|
871
1018
|
raise AgenticDomeError("No current approval grant was returned")
|
|
872
1019
|
payload["policy_context"] = {**(payload.get("policy_context") or {}), "approval_grant": grant}
|
|
@@ -875,7 +1022,47 @@ class AgenticDomeClient:
|
|
|
875
1022
|
broker = response.get("broker") or {}
|
|
876
1023
|
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
1024
|
raise AgenticDomeError("The approved action could not be revalidated and consumed")
|
|
878
|
-
|
|
1025
|
+
exact_args = json.loads(pending._prepared_json)["tool_args"]
|
|
1026
|
+
return executor(exact_args, response) if with_authorization else executor(exact_args)
|
|
1027
|
+
|
|
1028
|
+
def execute_http(self, *, method, url, agent_id, tool_name, body=b"", headers=None, timeout=30, **context):
|
|
1029
|
+
"""Authorize and send the same HTTP request. ApprovalRequired pauses before sending."""
|
|
1030
|
+
from .http_execution import prepare, send
|
|
1031
|
+
prepared, arguments, descriptor = prepare(method, url, body, headers)
|
|
1032
|
+
result = self.guardrail_validate(text="Execute reviewed HTTP operation", agent_id=agent_id,
|
|
1033
|
+
tool_name=tool_name, tool_args=arguments, platform=context.pop("platform", "generic"),
|
|
1034
|
+
execution_broker=True, execution_destination=prepared.url, execution_http_method=prepared.method,
|
|
1035
|
+
execution_request=descriptor, **context)
|
|
1036
|
+
return send(prepared, result, self, workload_id=context.get("workload_id"), timeout=timeout,
|
|
1037
|
+
tool_name=tool_name, arguments=arguments, require_graphql=(context.get("policy_context") or {}).get("required_graphql_schema"))
|
|
1038
|
+
|
|
1039
|
+
def execute_graphql(self, *, url, query, agent_id, tool_name, variables=None, operation_name=None, headers=None, **context):
|
|
1040
|
+
"""Review GraphQL in the sidecar and execute its exact JSON bytes."""
|
|
1041
|
+
if not isinstance(query, str) or not query.strip(): raise ValueError("Supply a complete GraphQL document")
|
|
1042
|
+
if variables is not None and not isinstance(variables, dict): raise ValueError("GraphQL variables must be an object")
|
|
1043
|
+
if any(k.lower() == "content-type" for k in (headers or {})): raise ValueError("GraphQL content type is managed by the SDK")
|
|
1044
|
+
payload = {"query": query, "variables": variables or {}}
|
|
1045
|
+
if operation_name is not None: payload["operationName"] = operation_name
|
|
1046
|
+
context["policy_context"] = {**(context.get("policy_context") or {}), "required_graphql_schema": "agenticdome.graphql-actions.v1"}
|
|
1047
|
+
return self.execute_http(method="POST", url=url, body=json.dumps(payload, allow_nan=False),
|
|
1048
|
+
headers={**(headers or {}), "Content-Type": "application/json"}, agent_id=agent_id, tool_name=tool_name, **context)
|
|
1049
|
+
|
|
1050
|
+
def resume_approved_http(self, pending: ApprovalRequired, *, headers=None, timeout=30):
|
|
1051
|
+
"""Resume the frozen HTTP request; supply fresh authentication headers separately."""
|
|
1052
|
+
from .http_execution import prepare, send, BOUND_HEADERS
|
|
1053
|
+
payload = json.loads(pending._prepared_json)
|
|
1054
|
+
descriptor = payload.get("execution_request")
|
|
1055
|
+
if not isinstance(descriptor, dict):
|
|
1056
|
+
raise ValueError("This approval does not contain a prepared HTTP request")
|
|
1057
|
+
if any(str(k).lower() in BOUND_HEADERS for k in (headers or {})):
|
|
1058
|
+
raise ValueError("Approved content and resource preconditions cannot be changed")
|
|
1059
|
+
prepared, arguments, actual = prepare(payload["http_method"], payload["destination"],
|
|
1060
|
+
base64.b64decode(descriptor["body_base64"], validate=True), {**(headers or {}), **descriptor["headers"]})
|
|
1061
|
+
if arguments != payload["tool_args"] or actual != descriptor:
|
|
1062
|
+
raise AgenticDomeError("Prepared HTTP action changed during resume")
|
|
1063
|
+
return self.resume_approved_action(pending, lambda args, result: send(prepared, result, self,
|
|
1064
|
+
workload_id=payload.get("workload_id"), timeout=timeout, tool_name=payload["tool_name"], arguments=arguments,
|
|
1065
|
+
require_graphql=(payload.get("policy_context") or {}).get("required_graphql_schema")), with_authorization=True)
|
|
879
1066
|
|
|
880
1067
|
@staticmethod
|
|
881
1068
|
def enforcement_headers(result: Dict[str, Any], *, workload_id: Optional[str] = None) -> Dict[str, str]:
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""Docker Agent mandatory guard adapter. JSON in/out; fail closed; never execute."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
import hashlib
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
import sys
|
|
7
|
+
from urllib.parse import urlsplit
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def event_payload(event):
|
|
11
|
+
if not isinstance(event, dict) or event.get("hook_event_name") != "tool_guard":
|
|
12
|
+
raise ValueError("Expected a Docker tool_guard event")
|
|
13
|
+
payload = {key: event.get(key, default) for key, default in {
|
|
14
|
+
"hook_event_name": "", "agent_name": "", "tool_name": "", "tool_input": None,
|
|
15
|
+
"session_id": "", "tool_use_id": "", "tool_category": "unknown", "cwd": ""}.items()}
|
|
16
|
+
if not isinstance(payload["tool_input"], dict): raise ValueError("Expected tool input object")
|
|
17
|
+
if any(not isinstance(payload[key], str) or not payload[key] for key in ("agent_name", "tool_name", "session_id", "tool_use_id")):
|
|
18
|
+
raise ValueError("Incomplete tool guard identity")
|
|
19
|
+
raw=json.dumps(payload,allow_nan=False)
|
|
20
|
+
if len(raw.encode()) > 131072: raise ValueError("Tool input exceeds limit")
|
|
21
|
+
return json.loads(raw)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def configured_client():
|
|
25
|
+
from .client import AgenticDomeClient
|
|
26
|
+
gateway = os.environ["AGENTICDOME_GATEWAY_URL"].rstrip("/")
|
|
27
|
+
parsed = urlsplit(gateway)
|
|
28
|
+
if (parsed.path != "/gateway/v1" or parsed.query or parsed.fragment or not parsed.hostname
|
|
29
|
+
or parsed.username is not None or parsed.password is not None or any(ord(c)<=32 for c in gateway)):
|
|
30
|
+
raise ValueError("Use the assigned Gateway URL ending in /gateway/v1")
|
|
31
|
+
if parsed.scheme != "https" and not (parsed.scheme == "http" and parsed.hostname in {"localhost", "127.0.0.1", "::1"}):
|
|
32
|
+
raise ValueError("Use HTTPS or a loopback sidecar")
|
|
33
|
+
return AgenticDomeClient(api_base=gateway[:-len('/gateway/v1')], timeout=8, mode="live")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def check_tool(event, client=None):
|
|
37
|
+
payload = event_payload(event)
|
|
38
|
+
owned = client is None
|
|
39
|
+
if owned: client = configured_client()
|
|
40
|
+
try:
|
|
41
|
+
expected = hashlib.sha256(json.dumps(payload, sort_keys=True, separators=(",", ":"), ensure_ascii=False).encode()).hexdigest()
|
|
42
|
+
result = client.guard_native_tool(payload)
|
|
43
|
+
if (not isinstance(result, dict) or result.get("schema") != "agenticdome.native-tool-decision.v1"
|
|
44
|
+
or result.get("request_sha256") != expected or result.get("decision") not in {"allow", "deny"}
|
|
45
|
+
or not isinstance(result.get("decision_id"), str) or not result["decision_id"]):
|
|
46
|
+
raise ValueError("Unbound or incomplete native tool decision")
|
|
47
|
+
return {"hook_specific_output": {"hook_event_name": "tool_guard", "permission_decision": result["decision"],
|
|
48
|
+
"permission_decision_reason": "Allowed by AgenticDome policy" if result["decision"] == "allow" else "Blocked by AgenticDome policy",
|
|
49
|
+
"metadata": {"agenticdome_decision_id": result["decision_id"], "evidence_scope": "pre_execution_policy_only"}}}
|
|
50
|
+
finally:
|
|
51
|
+
if owned: client.close()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def main():
|
|
55
|
+
try:
|
|
56
|
+
if sys.argv[1:] == ["--check"]:
|
|
57
|
+
client = configured_client()
|
|
58
|
+
try: report = client.native_guard_ready()
|
|
59
|
+
finally: client.close()
|
|
60
|
+
if (not isinstance(report, dict) or report.get("schema") != "agenticdome.native-guard-readiness.v1"
|
|
61
|
+
or report.get("ready") is not True or report.get("native_tool_guard") is not True):
|
|
62
|
+
raise ValueError("Updated Gateway guard capability is required")
|
|
63
|
+
print(json.dumps(report))
|
|
64
|
+
return 0
|
|
65
|
+
if sys.argv[1:]: raise ValueError("Unknown guard option")
|
|
66
|
+
raw = sys.stdin.buffer.read(131073)
|
|
67
|
+
if len(raw) > 131072: raise ValueError("Input exceeds limit")
|
|
68
|
+
def unique(pairs):
|
|
69
|
+
result = {}
|
|
70
|
+
for key, value in pairs:
|
|
71
|
+
if key in result: raise ValueError("Duplicate input member")
|
|
72
|
+
result[key] = value
|
|
73
|
+
return result
|
|
74
|
+
event = json.loads(raw, object_pairs_hook=unique, parse_constant=lambda _: (_ for _ in ()).throw(ValueError("Non-finite JSON")))
|
|
75
|
+
print(json.dumps(check_tool(event)))
|
|
76
|
+
return 0
|
|
77
|
+
except Exception as exc:
|
|
78
|
+
# Never expose tool arguments, credentials, exception URLs or response bodies.
|
|
79
|
+
if sys.argv[1:]==["--check"]:
|
|
80
|
+
status=getattr(exc,"status_code",None)
|
|
81
|
+
reasons={401:"Caller credentials or identity were rejected",403:"Caller is outside the approved Gateway boundary",
|
|
82
|
+
404:"The assigned sidecar needs the native guard update",503:"The assigned Gateway is not security ready"}
|
|
83
|
+
print(json.dumps({"schema":"agenticdome.native-guard-readiness.v1","ready":False,
|
|
84
|
+
"reason":reasons.get(status,"Load the generated Gateway, tenant, Runtime API key and approved identity settings"),
|
|
85
|
+
"tool_executed":False}))
|
|
86
|
+
return 2
|
|
87
|
+
print(json.dumps({"decision": "block", "reason": "AgenticDome tool check failed. Verify the assigned Gateway, identity and runtime readiness."}))
|
|
88
|
+
return 2
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
if __name__ == "__main__": raise SystemExit(main())
|