keelgate 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- keelgate-0.1.0/.gitignore +57 -0
- keelgate-0.1.0/LICENSE +201 -0
- keelgate-0.1.0/PKG-INFO +264 -0
- keelgate-0.1.0/README.md +208 -0
- keelgate-0.1.0/deploy/README.md +10 -0
- keelgate-0.1.0/ee/LICENSE +26 -0
- keelgate-0.1.0/ee/README.md +42 -0
- keelgate-0.1.0/examples/README.md +12 -0
- keelgate-0.1.0/policies/README.md +53 -0
- keelgate-0.1.0/policies/cedar_minimal/cedar_minimal.cedar +42 -0
- keelgate-0.1.0/policies/finance_basic/.gitkeep +0 -0
- keelgate-0.1.0/policies/finance_basic/finance_basic.rego +230 -0
- keelgate-0.1.0/policies/finance_basic/finance_basic_test.rego +260 -0
- keelgate-0.1.0/policies/keelgate/health.rego +10 -0
- keelgate-0.1.0/pyproject.toml +267 -0
- keelgate-0.1.0/src/keelgate/__init__.py +21 -0
- keelgate-0.1.0/src/keelgate/adapters/__init__.py +1 -0
- keelgate-0.1.0/src/keelgate/adapters/a2a/__init__.py +104 -0
- keelgate-0.1.0/src/keelgate/adapters/a2a/intake.py +216 -0
- keelgate-0.1.0/src/keelgate/adapters/claude_agent_sdk/__init__.py +130 -0
- keelgate-0.1.0/src/keelgate/adapters/governed.py +109 -0
- keelgate-0.1.0/src/keelgate/adapters/langgraph/__init__.py +21 -0
- keelgate-0.1.0/src/keelgate/adapters/langgraph/chat_model.py +117 -0
- keelgate-0.1.0/src/keelgate/adapters/langgraph/tools.py +39 -0
- keelgate-0.1.0/src/keelgate/adapters/mcp/__init__.py +32 -0
- keelgate-0.1.0/src/keelgate/adapters/mcp/client.py +210 -0
- keelgate-0.1.0/src/keelgate/adapters/mcp/server.py +109 -0
- keelgate-0.1.0/src/keelgate/adapters/openai_agents/__init__.py +16 -0
- keelgate-0.1.0/src/keelgate/adapters/openai_agents/model.py +186 -0
- keelgate-0.1.0/src/keelgate/adapters/openai_agents/tools.py +58 -0
- keelgate-0.1.0/src/keelgate/adapters/temporal/__init__.py +152 -0
- keelgate-0.1.0/src/keelgate/approvals/__init__.py +45 -0
- keelgate-0.1.0/src/keelgate/approvals/cli.py +124 -0
- keelgate-0.1.0/src/keelgate/approvals/models.py +117 -0
- keelgate-0.1.0/src/keelgate/approvals/queue.py +341 -0
- keelgate-0.1.0/src/keelgate/approvals/rest.py +113 -0
- keelgate-0.1.0/src/keelgate/approvals/tiers.py +30 -0
- keelgate-0.1.0/src/keelgate/audit/__init__.py +29 -0
- keelgate-0.1.0/src/keelgate/audit/log.py +80 -0
- keelgate-0.1.0/src/keelgate/audit/records.py +245 -0
- keelgate-0.1.0/src/keelgate/audit/stores.py +254 -0
- keelgate-0.1.0/src/keelgate/capabilities/__init__.py +60 -0
- keelgate-0.1.0/src/keelgate/capabilities/capability.py +62 -0
- keelgate-0.1.0/src/keelgate/capabilities/errors.py +37 -0
- keelgate-0.1.0/src/keelgate/capabilities/grants.py +394 -0
- keelgate-0.1.0/src/keelgate/capabilities/stores.py +116 -0
- keelgate-0.1.0/src/keelgate/context/__init__.py +60 -0
- keelgate-0.1.0/src/keelgate/context/builder.py +312 -0
- keelgate-0.1.0/src/keelgate/context/compaction.py +149 -0
- keelgate-0.1.0/src/keelgate/context/item.py +127 -0
- keelgate-0.1.0/src/keelgate/context/tokens.py +28 -0
- keelgate-0.1.0/src/keelgate/evals/__init__.py +1 -0
- keelgate-0.1.0/src/keelgate/llm/__init__.py +34 -0
- keelgate-0.1.0/src/keelgate/llm/pricing.py +54 -0
- keelgate-0.1.0/src/keelgate/llm/providers/__init__.py +11 -0
- keelgate-0.1.0/src/keelgate/llm/providers/_common.py +82 -0
- keelgate-0.1.0/src/keelgate/llm/providers/anthropic.py +148 -0
- keelgate-0.1.0/src/keelgate/llm/providers/google.py +176 -0
- keelgate-0.1.0/src/keelgate/llm/providers/ollama.py +140 -0
- keelgate-0.1.0/src/keelgate/llm/providers/openai.py +171 -0
- keelgate-0.1.0/src/keelgate/llm/types.py +135 -0
- keelgate-0.1.0/src/keelgate/loop/__init__.py +95 -0
- keelgate-0.1.0/src/keelgate/loop/checkpoint.py +161 -0
- keelgate-0.1.0/src/keelgate/loop/engine.py +848 -0
- keelgate-0.1.0/src/keelgate/loop/kinds.py +180 -0
- keelgate-0.1.0/src/keelgate/loop/langgraph_store.py +126 -0
- keelgate-0.1.0/src/keelgate/loop/roles.py +229 -0
- keelgate-0.1.0/src/keelgate/loop/runner.py +99 -0
- keelgate-0.1.0/src/keelgate/loop/state.py +163 -0
- keelgate-0.1.0/src/keelgate/loop/stop.py +50 -0
- keelgate-0.1.0/src/keelgate/memory/__init__.py +45 -0
- keelgate-0.1.0/src/keelgate/memory/backends.py +466 -0
- keelgate-0.1.0/src/keelgate/memory/embedder.py +57 -0
- keelgate-0.1.0/src/keelgate/memory/http_embedders.py +120 -0
- keelgate-0.1.0/src/keelgate/memory/tiers.py +469 -0
- keelgate-0.1.0/src/keelgate/memory/types.py +149 -0
- keelgate-0.1.0/src/keelgate/policy/__init__.py +35 -0
- keelgate-0.1.0/src/keelgate/policy/cedar.py +185 -0
- keelgate-0.1.0/src/keelgate/policy/engine.py +154 -0
- keelgate-0.1.0/src/keelgate/policy/opa.py +100 -0
- keelgate-0.1.0/src/keelgate/policy/rego.py +75 -0
- keelgate-0.1.0/src/keelgate/policy/types.py +116 -0
- keelgate-0.1.0/src/keelgate/py.typed +0 -0
- keelgate-0.1.0/src/keelgate/telemetry/__init__.py +1 -0
- keelgate-0.1.0/src/keelgate/testing/__init__.py +29 -0
- keelgate-0.1.0/src/keelgate/testing/fake_llm.py +176 -0
- keelgate-0.1.0/src/keelgate/testing/harness.py +180 -0
- keelgate-0.1.0/src/keelgate/testing/plugin.py +60 -0
- keelgate-0.1.0/src/keelgate/tools/__init__.py +53 -0
- keelgate-0.1.0/src/keelgate/tools/gateway.py +738 -0
- keelgate-0.1.0/src/keelgate/tools/idempotency.py +204 -0
- keelgate-0.1.0/src/keelgate/tools/outcomes.py +120 -0
- keelgate-0.1.0/src/keelgate/tools/spec.py +227 -0
- keelgate-0.1.0/tests/__init__.py +0 -0
- keelgate-0.1.0/tests/conftest.py +271 -0
- keelgate-0.1.0/tests/lg_writer.py +45 -0
- keelgate-0.1.0/tests/live/__init__.py +0 -0
- keelgate-0.1.0/tests/live/test_live_claude_agent_sdk.py +78 -0
- keelgate-0.1.0/tests/live/test_live_providers.py +201 -0
- keelgate-0.1.0/tests/loop_support.py +291 -0
- keelgate-0.1.0/tests/loop_worker.py +103 -0
- keelgate-0.1.0/tests/mcp_stdio_server.py +31 -0
- keelgate-0.1.0/tests/test_adapter_a2a.py +294 -0
- keelgate-0.1.0/tests/test_adapter_claude_agent_sdk.py +160 -0
- keelgate-0.1.0/tests/test_adapter_langgraph.py +205 -0
- keelgate-0.1.0/tests/test_adapter_mcp.py +571 -0
- keelgate-0.1.0/tests/test_adapter_openai_agents.py +202 -0
- keelgate-0.1.0/tests/test_adapter_temporal.py +156 -0
- keelgate-0.1.0/tests/test_approvals.py +683 -0
- keelgate-0.1.0/tests/test_audit.py +575 -0
- keelgate-0.1.0/tests/test_capabilities.py +517 -0
- keelgate-0.1.0/tests/test_checkpoint_contract.py +211 -0
- keelgate-0.1.0/tests/test_context.py +454 -0
- keelgate-0.1.0/tests/test_docs.py +80 -0
- keelgate-0.1.0/tests/test_durable_stores.py +290 -0
- keelgate-0.1.0/tests/test_edge_paths.py +193 -0
- keelgate-0.1.0/tests/test_gateway.py +1090 -0
- keelgate-0.1.0/tests/test_gateway_hardening.py +251 -0
- keelgate-0.1.0/tests/test_imports.py +97 -0
- keelgate-0.1.0/tests/test_llm_providers.py +515 -0
- keelgate-0.1.0/tests/test_loop.py +785 -0
- keelgate-0.1.0/tests/test_loop_resume.py +366 -0
- keelgate-0.1.0/tests/test_loop_subprocess.py +99 -0
- keelgate-0.1.0/tests/test_memory.py +682 -0
- keelgate-0.1.0/tests/test_packaging.py +54 -0
- keelgate-0.1.0/tests/test_policy_cedar.py +276 -0
- keelgate-0.1.0/tests/test_policy_conformance.py +349 -0
- keelgate-0.1.0/tests/test_policy_engines.py +392 -0
- keelgate-0.1.0/tests/test_prompt_injection.py +287 -0
- keelgate-0.1.0/tests/test_properties.py +347 -0
- keelgate-0.1.0/tests/test_quickstart.py +72 -0
- keelgate-0.1.0/tests/test_repo_layout.py +66 -0
- keelgate-0.1.0/tests/test_research_loop_example.py +28 -0
- keelgate-0.1.0/tests/test_testing_kit.py +170 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.eggs/
|
|
6
|
+
build/
|
|
7
|
+
dist/
|
|
8
|
+
*.so
|
|
9
|
+
|
|
10
|
+
# Environments
|
|
11
|
+
.venv/
|
|
12
|
+
venv/
|
|
13
|
+
.python-version
|
|
14
|
+
|
|
15
|
+
# Secrets — never commit real values; see .env.example
|
|
16
|
+
.env
|
|
17
|
+
.env.*
|
|
18
|
+
!.env.example
|
|
19
|
+
*.pem
|
|
20
|
+
*.key
|
|
21
|
+
secrets/
|
|
22
|
+
|
|
23
|
+
# Tooling caches
|
|
24
|
+
.pytest_cache/
|
|
25
|
+
.mypy_cache/
|
|
26
|
+
.ruff_cache/
|
|
27
|
+
.hypothesis/
|
|
28
|
+
.coverage
|
|
29
|
+
.coverage.*
|
|
30
|
+
coverage.xml
|
|
31
|
+
htmlcov/
|
|
32
|
+
|
|
33
|
+
# Docs
|
|
34
|
+
site/
|
|
35
|
+
|
|
36
|
+
# Local state (durable loops, audit logs, checkpoints)
|
|
37
|
+
*.sqlite
|
|
38
|
+
*.sqlite3
|
|
39
|
+
*.db
|
|
40
|
+
.keelgate/
|
|
41
|
+
|
|
42
|
+
# Editors / OS
|
|
43
|
+
.idea/
|
|
44
|
+
.vscode/
|
|
45
|
+
.DS_Store
|
|
46
|
+
Thumbs.db
|
|
47
|
+
|
|
48
|
+
# Terraform
|
|
49
|
+
.terraform/
|
|
50
|
+
*.tfstate
|
|
51
|
+
*.tfstate.*
|
|
52
|
+
*.tfvars
|
|
53
|
+
!*.tfvars.example
|
|
54
|
+
|
|
55
|
+
# Node (ee/dashboard)
|
|
56
|
+
node_modules/
|
|
57
|
+
.next/
|
keelgate-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 The Keelgate Authors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
keelgate-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: keelgate
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Safety-first agent harness for AI agents that touch money and regulated actions. The LLM proposes; deterministic code decides.
|
|
5
|
+
Project-URL: Homepage, https://github.com/anilatambharii/keelgate
|
|
6
|
+
Project-URL: Repository, https://github.com/anilatambharii/keelgate
|
|
7
|
+
Project-URL: Issues, https://github.com/anilatambharii/keelgate/issues
|
|
8
|
+
Project-URL: Documentation, https://github.com/anilatambharii/keelgate/tree/main/docs
|
|
9
|
+
Author: The Keelgate Authors
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: agents,audit,fintech,governance,guardrails,human-in-the-loop,llm,opentelemetry,policy-as-code,safety
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Security
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: httpx<1,>=0.28
|
|
25
|
+
Requires-Dist: opentelemetry-api<2,>=1.45
|
|
26
|
+
Requires-Dist: opentelemetry-sdk<2,>=1.45
|
|
27
|
+
Requires-Dist: pydantic<3,>=2.11
|
|
28
|
+
Requires-Dist: pyseto<2,>=1.10
|
|
29
|
+
Requires-Dist: regopy<2,>=1.5
|
|
30
|
+
Provides-Extra: a2a
|
|
31
|
+
Requires-Dist: a2a-sdk<2,>=1.2; extra == 'a2a'
|
|
32
|
+
Provides-Extra: anthropic
|
|
33
|
+
Requires-Dist: anthropic<2,>=1.11; extra == 'anthropic'
|
|
34
|
+
Requires-Dist: claude-agent-sdk<1,>=0.2; extra == 'anthropic'
|
|
35
|
+
Provides-Extra: cedar
|
|
36
|
+
Requires-Dist: cedarpy<5,>=4.12; extra == 'cedar'
|
|
37
|
+
Provides-Extra: google
|
|
38
|
+
Requires-Dist: google-genai<3,>=2.28; extra == 'google'
|
|
39
|
+
Provides-Extra: langgraph
|
|
40
|
+
Requires-Dist: langgraph-checkpoint-postgres<4,>=3.1; extra == 'langgraph'
|
|
41
|
+
Requires-Dist: langgraph-checkpoint-sqlite<4,>=3.1; extra == 'langgraph'
|
|
42
|
+
Requires-Dist: langgraph<2,>=1.2; extra == 'langgraph'
|
|
43
|
+
Provides-Extra: mcp
|
|
44
|
+
Requires-Dist: mcp<3,>=2.3; extra == 'mcp'
|
|
45
|
+
Provides-Extra: openai
|
|
46
|
+
Requires-Dist: openai-agents<1,>=0.23; extra == 'openai'
|
|
47
|
+
Requires-Dist: openai<4,>=3.24; extra == 'openai'
|
|
48
|
+
Provides-Extra: server
|
|
49
|
+
Requires-Dist: fastapi<1,>=0.142; extra == 'server'
|
|
50
|
+
Requires-Dist: psycopg[binary,pool]<4,>=3.3; extra == 'server'
|
|
51
|
+
Requires-Dist: redis<9,>=8.1; extra == 'server'
|
|
52
|
+
Requires-Dist: uvicorn[standard]<1,>=0.54; extra == 'server'
|
|
53
|
+
Provides-Extra: temporal
|
|
54
|
+
Requires-Dist: temporalio<2,>=1.34; extra == 'temporal'
|
|
55
|
+
Description-Content-Type: text/markdown
|
|
56
|
+
|
|
57
|
+
# Keelgate
|
|
58
|
+
|
|
59
|
+
**A safety-first agent harness for AI agents that touch money and regulated actions.**
|
|
60
|
+
|
|
61
|
+
> The LLM proposes; deterministic code decides.
|
|
62
|
+
|
|
63
|
+
[](https://github.com/anilatambharii/keelgate/actions/workflows/ci.yml)
|
|
64
|
+
[](LICENSE)
|
|
65
|
+
[](pyproject.toml)
|
|
66
|
+
|
|
67
|
+
Large language models are good at proposing actions and bad at being a control.
|
|
68
|
+
Keelgate takes the proposal and puts a deterministic gate in front of anything
|
|
69
|
+
that writes: capability-scoped tools, policy-as-code risk gates, human approvals,
|
|
70
|
+
and a tamper-evident audit trail. A prompt is never a safety boundary.
|
|
71
|
+
|
|
72
|
+
Keelgate **wraps** the frameworks you already use — LangGraph, the OpenAI Agents
|
|
73
|
+
SDK, the Claude Agent SDK, MCP, A2A. It does not compete with them.
|
|
74
|
+
|
|
75
|
+
## Why
|
|
76
|
+
|
|
77
|
+
If an agent can move money, the interesting question is not "how capable is the
|
|
78
|
+
model" but "what happens on the model's worst day". Keelgate is built around
|
|
79
|
+
that question:
|
|
80
|
+
|
|
81
|
+
- **Capability-scoped tools** — nothing is callable that was not explicitly granted.
|
|
82
|
+
- **Policy-as-code risk gates** — OPA/Rego by default, Cedar optional, behind one interface.
|
|
83
|
+
- **Durable budgeted loops** — bounded cost and steps, checkpointed, resumable.
|
|
84
|
+
- **As-of-time context** — nothing published after `as_of` can enter the context. No lookahead, no leakage.
|
|
85
|
+
- **Layered memory** — working, episodic, semantic, procedural.
|
|
86
|
+
- **Human-in-the-loop approvals** — a first-class state, not an exception path.
|
|
87
|
+
- **Tamper-evident audit logs** — hash-chained and independently verifiable.
|
|
88
|
+
- **OpenTelemetry tracing** — GenAI semantic conventions, so your existing backend works.
|
|
89
|
+
- **Evals and red-teaming** — including an outcome-metric plugin system.
|
|
90
|
+
|
|
91
|
+
## Architecture
|
|
92
|
+
|
|
93
|
+
```mermaid
|
|
94
|
+
flowchart TB
|
|
95
|
+
App["Your application"] --> Loop
|
|
96
|
+
|
|
97
|
+
subgraph harness["Keelgate — deterministic control plane"]
|
|
98
|
+
direction TB
|
|
99
|
+
Loop["loop<br/>budgeted · durable · resumable"]
|
|
100
|
+
Ctx["context<br/>as-of-time assembly"]
|
|
101
|
+
Mem["memory<br/>working · episodic<br/>semantic · procedural"]
|
|
102
|
+
Reg["tools<br/>registry · SideEffect<br/>READ / PROPOSE / WRITE"]
|
|
103
|
+
Cap["capabilities<br/>scoped grants · deny by default"]
|
|
104
|
+
Pol["policy<br/>OPA/Rego or Cedar"]
|
|
105
|
+
Appr["approvals<br/>human in the loop"]
|
|
106
|
+
Audit["audit<br/>hash-chained · verify_chain()"]
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
Loop --> Ctx
|
|
110
|
+
Ctx --> Mem
|
|
111
|
+
Loop --> LLM["llm<br/>proposes an action"]
|
|
112
|
+
LLM -->|"proposal, untrusted"| Reg
|
|
113
|
+
Reg --> Cap
|
|
114
|
+
Cap --> Pol
|
|
115
|
+
Pol -->|ALLOW| Exec["Tool executes"]
|
|
116
|
+
Pol -->|REQUIRE_APPROVAL| Appr
|
|
117
|
+
Pol -->|DENY| Stop["Blocked"]
|
|
118
|
+
Appr -->|approved| Exec
|
|
119
|
+
Appr -->|rejected| Stop
|
|
120
|
+
Exec --> Audit
|
|
121
|
+
Stop --> Audit
|
|
122
|
+
Exec -->|"result, untrusted data"| Loop
|
|
123
|
+
Audit --> Tel["telemetry<br/>OpenTelemetry GenAI"]
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Read the diagram as a one-way valve: the model's output is a *proposal* that
|
|
127
|
+
enters from the left, and the only path to a side effect runs through capability
|
|
128
|
+
checks, a policy decision, and — when policy says so — a human. Every outcome,
|
|
129
|
+
allowed or blocked, is appended to the audit chain.
|
|
130
|
+
|
|
131
|
+
## Install
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
pip install keelgate
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Optional integrations, installed only if you adapt to them:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
pip install "keelgate[langgraph]" # LangGraph + checkpointers
|
|
141
|
+
pip install "keelgate[openai]" # OpenAI client + Agents SDK adapter (also vLLM)
|
|
142
|
+
pip install "keelgate[anthropic]" # Anthropic client + Claude Agent SDK adapter
|
|
143
|
+
pip install "keelgate[google]" # Gemini client
|
|
144
|
+
pip install "keelgate[mcp]" # serve governed tools over MCP; govern external MCP tools
|
|
145
|
+
pip install "keelgate[a2a]" # A2A agent card + task intake under policy
|
|
146
|
+
pip install "keelgate[temporal]" # Temporal durable-execution adapter
|
|
147
|
+
pip install "keelgate[cedar]" # Cedar policy engine
|
|
148
|
+
pip install "keelgate[server]" # FastAPI control surface, Postgres, Redis
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Quickstart (contributors)
|
|
152
|
+
|
|
153
|
+
Requires Python 3.11+, [`uv`](https://docs.astral.sh/uv/), GNU Make, and Docker.
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
git clone https://github.com/anilatambharii/keelgate.git
|
|
157
|
+
cd keelgate
|
|
158
|
+
make setup # create the venv, install dev deps, install git hooks
|
|
159
|
+
make check # ruff, ruff format --check, mypy --strict, pytest
|
|
160
|
+
python -c "import keelgate; print(keelgate.__version__)"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Bring up the local stack — Postgres 16 with pgvector, Redis, OPA, Jaeger:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
make up # starts and waits for health
|
|
167
|
+
make health # probe each endpoint
|
|
168
|
+
make down # stop and delete volumes
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
| Service | Endpoint |
|
|
172
|
+
|---|---|
|
|
173
|
+
| Postgres + pgvector | `localhost:5432` (`keelgate` / `keelgate`) |
|
|
174
|
+
| Redis | `localhost:6379` |
|
|
175
|
+
| OPA | `localhost:8181` (diagnostics `:8282`) |
|
|
176
|
+
| Jaeger UI | [localhost:16686](http://localhost:16686) |
|
|
177
|
+
| OTLP ingest | `localhost:4317` (gRPC), `localhost:4318` (HTTP) |
|
|
178
|
+
|
|
179
|
+
`make help` lists every target.
|
|
180
|
+
|
|
181
|
+
### See it work
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
make quickstart # or: python examples/quickstart.py --tamper
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
It registers a read tool and a paper-trading tool, issues a signed grant, and runs
|
|
188
|
+
four proposals through the gateway: one **allowed**, two **denied** (a restricted
|
|
189
|
+
symbol and an oversized order), and one that **requires a human** and then runs
|
|
190
|
+
after approval. It ends by printing the audit chain, verifying it, and (with
|
|
191
|
+
`--tamper`) showing an edited record and a truncated chain being caught.
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
make research-loop # or: python examples/research_loop.py
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
A 3-step agent loop driven by a scripted `FakeLLM` (no keys, no network). It hits a
|
|
198
|
+
**token budget** and stops, is "restarted" (every in-memory object rebuilt over the
|
|
199
|
+
same files), **resumes from its checkpoint** without re-planning, places its paper
|
|
200
|
+
order exactly once, and then **serves the same governed tools over MCP**, where a
|
|
201
|
+
restricted-symbol order is denied by policy.
|
|
202
|
+
|
|
203
|
+
Provider clients are contract-tested offline; `make test-live` runs opt-in smoke tests against the
|
|
204
|
+
real services when you supply keys.
|
|
205
|
+
|
|
206
|
+
Testing something built on Keelgate? `keelgate.testing` ships `FakeLLM`, a governed
|
|
207
|
+
test harness and pytest fixtures (`fake_llm`, `governed_harness`, `static_policy`,
|
|
208
|
+
`keelgate_clock`) that load automatically once Keelgate is installed.
|
|
209
|
+
|
|
210
|
+
## Safety posture
|
|
211
|
+
|
|
212
|
+
These are not defaults you can tune away; they are the point of the project.
|
|
213
|
+
|
|
214
|
+
1. **No live brokerage or real-money execution in v1.** Paper and simulation only.
|
|
215
|
+
2. **Every WRITE passes a deterministic policy gate.** Prompts are never a safety control.
|
|
216
|
+
3. **All external text is untrusted data** — tool output, web pages, documents, retrieved memory. Keelgate never follows instructions found inside it.
|
|
217
|
+
4. **Context and memory honour `as_of`.** Nothing published after the cutoff enters the context.
|
|
218
|
+
5. **Deny by default.** Explicit capability grants only, with tenant isolation everywhere.
|
|
219
|
+
|
|
220
|
+
Found a hole? See [SECURITY.md](SECURITY.md). Reports about prompt injection and
|
|
221
|
+
policy bypass are in scope and welcome.
|
|
222
|
+
|
|
223
|
+
## Project status
|
|
224
|
+
|
|
225
|
+
**Phase K2 — the long-running agent.** On top of the K1 safety core (signed
|
|
226
|
+
capability grants, a single policy-gated tool gateway, OPA/Rego with the
|
|
227
|
+
`finance_basic` pack, a hash-chained audit log, human approvals) there is now a
|
|
228
|
+
durable, budgeted loop that resumes after a crash without repeating a WRITE;
|
|
229
|
+
an `as_of` context firewall; four-tier bitemporal memory; a model-agnostic LLM
|
|
230
|
+
client (Anthropic, OpenAI, Google, Ollama, vLLM); adapters for LangGraph, the
|
|
231
|
+
OpenAI Agents SDK, the Claude Agent SDK, MCP, A2A and Temporal; and a testing kit.
|
|
232
|
+
Run `make quickstart` and `make research-loop` to see it.
|
|
233
|
+
|
|
234
|
+
Not built yet: telemetry and evals
|
|
235
|
+
([planned](docs/integration-contract.md#planned)). The provider clients are tested
|
|
236
|
+
through the real vendor SDKs over a mocked transport, not against live services.
|
|
237
|
+
Known limitations are listed in the [security model](docs/security-model.md#known-gaps).
|
|
238
|
+
|
|
239
|
+
Do not point a production workload at this.
|
|
240
|
+
|
|
241
|
+
## Open core
|
|
242
|
+
|
|
243
|
+
| | |
|
|
244
|
+
|---|---|
|
|
245
|
+
| Everything outside `ee/` | Apache-2.0 — [LICENSE](LICENSE) |
|
|
246
|
+
| `ee/` (Keelgate Cloud: control plane, dashboard) | Proprietary — [ee/LICENSE](ee/LICENSE) |
|
|
247
|
+
|
|
248
|
+
The reasoning and the boundary rules are recorded in
|
|
249
|
+
[ADR-0001](docs/adr/0001-licensing-and-open-core.md).
|
|
250
|
+
|
|
251
|
+
## Downstream projects
|
|
252
|
+
|
|
253
|
+
[Tycheon](https://github.com/anilatambharii/tycheon) (calibrated financial
|
|
254
|
+
forecasting and risk) consumes Keelgate as a library. The API it depends on is
|
|
255
|
+
frozen under semver and documented in
|
|
256
|
+
[docs/integration-contract.md](docs/integration-contract.md). Breaking it
|
|
257
|
+
requires a major version bump and a migration note.
|
|
258
|
+
|
|
259
|
+
## Contributing
|
|
260
|
+
|
|
261
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) covers the workflow; the short version is:
|
|
262
|
+
small PRs, Conventional Commits, tests alongside code, and `make check` green
|
|
263
|
+
before you push. By participating you agree to the
|
|
264
|
+
[Code of Conduct](CODE_OF_CONDUCT.md).
|