airlock-llm 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. airlock_llm-0.1.1/LICENSE +201 -0
  2. airlock_llm-0.1.1/PKG-INFO +348 -0
  3. airlock_llm-0.1.1/README.md +291 -0
  4. airlock_llm-0.1.1/airlock/__init__.py +3 -0
  5. airlock_llm-0.1.1/airlock/callbacks/__init__.py +0 -0
  6. airlock_llm-0.1.1/airlock/callbacks/enterprise_logger.py +494 -0
  7. airlock_llm-0.1.1/airlock/callbacks/metrics.py +165 -0
  8. airlock_llm-0.1.1/airlock/callbacks/model_override_headers.py +58 -0
  9. airlock_llm-0.1.1/airlock/callbacks/s3_logger.py +210 -0
  10. airlock_llm-0.1.1/airlock/callbacks/sql_logger.py +184 -0
  11. airlock_llm-0.1.1/airlock/callbacks/tracing.py +134 -0
  12. airlock_llm-0.1.1/airlock/cli/__init__.py +0 -0
  13. airlock_llm-0.1.1/airlock/cli/dogfood_cmd.py +51 -0
  14. airlock_llm-0.1.1/airlock/cli/hooks_cmd.py +134 -0
  15. airlock_llm-0.1.1/airlock/cli/init_cmd.py +63 -0
  16. airlock_llm-0.1.1/airlock/cli/install_service_cmd.py +97 -0
  17. airlock_llm-0.1.1/airlock/cli/main.py +393 -0
  18. airlock_llm-0.1.1/airlock/cli/post_cmd.py +1154 -0
  19. airlock_llm-0.1.1/airlock/cli/status_cmd.py +36 -0
  20. airlock_llm-0.1.1/airlock/cli/templates/__init__.py +0 -0
  21. airlock_llm-0.1.1/airlock/cli/templates/config.yaml +320 -0
  22. airlock_llm-0.1.1/airlock/cli/templates/dot_env +50 -0
  23. airlock_llm-0.1.1/airlock/client_identity.py +80 -0
  24. airlock_llm-0.1.1/airlock/docs.py +486 -0
  25. airlock_llm-0.1.1/airlock/fast/__init__.py +1 -0
  26. airlock_llm-0.1.1/airlock/fast/circuit_breaker.py +141 -0
  27. airlock_llm-0.1.1/airlock/fast/guardian.py +383 -0
  28. airlock_llm-0.1.1/airlock/fast/model_alias.py +350 -0
  29. airlock_llm-0.1.1/airlock/fast/monitor.py +281 -0
  30. airlock_llm-0.1.1/airlock/fast/priority.py +95 -0
  31. airlock_llm-0.1.1/airlock/fast/router.py +555 -0
  32. airlock_llm-0.1.1/airlock/fast/state.py +930 -0
  33. airlock_llm-0.1.1/airlock/fast/threat_detector.py +147 -0
  34. airlock_llm-0.1.1/airlock/gemini_interface.py +183 -0
  35. airlock_llm-0.1.1/airlock/guardrails/__init__.py +16 -0
  36. airlock_llm-0.1.1/airlock/guardrails/enforcer.py +87 -0
  37. airlock_llm-0.1.1/airlock/guardrails/extract.py +97 -0
  38. airlock_llm-0.1.1/airlock/guardrails/keyword_guard.py +96 -0
  39. airlock_llm-0.1.1/airlock/guardrails/mcp_tool_guard.py +112 -0
  40. airlock_llm-0.1.1/airlock/guardrails/observer.py +212 -0
  41. airlock_llm-0.1.1/airlock/guardrails/orchestrator.py +133 -0
  42. airlock_llm-0.1.1/airlock/guardrails/pii_guard.py +361 -0
  43. airlock_llm-0.1.1/airlock/guardrails/response_scanner.py +360 -0
  44. airlock_llm-0.1.1/airlock/guardrails/schemas.py +61 -0
  45. airlock_llm-0.1.1/airlock/guardrails/semantic.py +287 -0
  46. airlock_llm-0.1.1/airlock/health.py +84 -0
  47. airlock_llm-0.1.1/airlock/hooks/__init__.py +1 -0
  48. airlock_llm-0.1.1/airlock/hooks/_common.py +67 -0
  49. airlock_llm-0.1.1/airlock/hooks/post_tool.py +48 -0
  50. airlock_llm-0.1.1/airlock/hooks/pre_submit.py +28 -0
  51. airlock_llm-0.1.1/airlock/hooks/pre_tool.py +48 -0
  52. airlock_llm-0.1.1/airlock/hooks/session_start.py +28 -0
  53. airlock_llm-0.1.1/airlock/mcp_servers/__init__.py +0 -0
  54. airlock_llm-0.1.1/airlock/mcp_servers/newscatcher_server.py +214 -0
  55. airlock_llm-0.1.1/airlock/models_catalog.py +230 -0
  56. airlock_llm-0.1.1/airlock/providers/__init__.py +0 -0
  57. airlock_llm-0.1.1/airlock/providers/tavily_provider.py +163 -0
  58. airlock_llm-0.1.1/airlock/proxy.py +276 -0
  59. airlock_llm-0.1.1/airlock/slow/__init__.py +1 -0
  60. airlock_llm-0.1.1/airlock/slow/analyzer.py +889 -0
  61. airlock_llm-0.1.1/airlock/slow/cli.py +187 -0
  62. airlock_llm-0.1.1/airlock/slow/tuner.py +240 -0
  63. airlock_llm-0.1.1/airlock/tui/__init__.py +1 -0
  64. airlock_llm-0.1.1/airlock/tui/alert_engine.py +359 -0
  65. airlock_llm-0.1.1/airlock/tui/app.py +194 -0
  66. airlock_llm-0.1.1/airlock/tui/mcp_manager.py +417 -0
  67. airlock_llm-0.1.1/airlock/tui/param_schemas.py +179 -0
  68. airlock_llm-0.1.1/airlock/tui/proxy_manager.py +291 -0
  69. airlock_llm-0.1.1/airlock/tui/screens/__init__.py +0 -0
  70. airlock_llm-0.1.1/airlock/tui/screens/config.py +675 -0
  71. airlock_llm-0.1.1/airlock/tui/screens/guards.py +637 -0
  72. airlock_llm-0.1.1/airlock/tui/screens/logs.py +389 -0
  73. airlock_llm-0.1.1/airlock/tui/screens/overview.py +758 -0
  74. airlock_llm-0.1.1/airlock/tui/screens/test.py +696 -0
  75. airlock_llm-0.1.1/airlock/tui/widgets/__init__.py +0 -0
  76. airlock_llm-0.1.1/airlock/tui/widgets/metric_card.py +30 -0
  77. airlock_llm-0.1.1/airlock/tui/widgets/safe_data_table.py +29 -0
  78. airlock_llm-0.1.1/airlock/tui/widgets/status_indicator.py +30 -0
  79. airlock_llm-0.1.1/airlock/tui/widgets/tab_bar.py +63 -0
  80. airlock_llm-0.1.1/airlock_llm.egg-info/PKG-INFO +348 -0
  81. airlock_llm-0.1.1/airlock_llm.egg-info/SOURCES.txt +133 -0
  82. airlock_llm-0.1.1/airlock_llm.egg-info/dependency_links.txt +1 -0
  83. airlock_llm-0.1.1/airlock_llm.egg-info/entry_points.txt +3 -0
  84. airlock_llm-0.1.1/airlock_llm.egg-info/requires.txt +33 -0
  85. airlock_llm-0.1.1/airlock_llm.egg-info/top_level.txt +1 -0
  86. airlock_llm-0.1.1/pyproject.toml +100 -0
  87. airlock_llm-0.1.1/setup.cfg +4 -0
  88. airlock_llm-0.1.1/tests/test_circuit_breaker.py +48 -0
  89. airlock_llm-0.1.1/tests/test_cli_hooks.py +206 -0
  90. airlock_llm-0.1.1/tests/test_cli_init.py +162 -0
  91. airlock_llm-0.1.1/tests/test_cli_main.py +141 -0
  92. airlock_llm-0.1.1/tests/test_cli_post.py +1502 -0
  93. airlock_llm-0.1.1/tests/test_cli_status.py +106 -0
  94. airlock_llm-0.1.1/tests/test_client_identity.py +121 -0
  95. airlock_llm-0.1.1/tests/test_config_consistency.py +445 -0
  96. airlock_llm-0.1.1/tests/test_docs.py +107 -0
  97. airlock_llm-0.1.1/tests/test_dogfood.py +66 -0
  98. airlock_llm-0.1.1/tests/test_enforcer.py +333 -0
  99. airlock_llm-0.1.1/tests/test_enterprise_logger.py +845 -0
  100. airlock_llm-0.1.1/tests/test_extract.py +230 -0
  101. airlock_llm-0.1.1/tests/test_fast_circuit_breaker.py +100 -0
  102. airlock_llm-0.1.1/tests/test_fast_guardian.py +374 -0
  103. airlock_llm-0.1.1/tests/test_fast_monitor.py +398 -0
  104. airlock_llm-0.1.1/tests/test_fast_priority.py +119 -0
  105. airlock_llm-0.1.1/tests/test_fast_router.py +669 -0
  106. airlock_llm-0.1.1/tests/test_fast_state.py +763 -0
  107. airlock_llm-0.1.1/tests/test_fast_threat_detector.py +168 -0
  108. airlock_llm-0.1.1/tests/test_gemini_interface.py +68 -0
  109. airlock_llm-0.1.1/tests/test_guardrails_schemas.py +84 -0
  110. airlock_llm-0.1.1/tests/test_hooks.py +440 -0
  111. airlock_llm-0.1.1/tests/test_integration.py +520 -0
  112. airlock_llm-0.1.1/tests/test_keyword_guard.py +405 -0
  113. airlock_llm-0.1.1/tests/test_mcp_manager.py +540 -0
  114. airlock_llm-0.1.1/tests/test_mcp_server_state.py +144 -0
  115. airlock_llm-0.1.1/tests/test_mcp_tool_guard.py +194 -0
  116. airlock_llm-0.1.1/tests/test_metrics.py +185 -0
  117. airlock_llm-0.1.1/tests/test_model_alias.py +508 -0
  118. airlock_llm-0.1.1/tests/test_model_override_headers.py +74 -0
  119. airlock_llm-0.1.1/tests/test_models_catalog.py +172 -0
  120. airlock_llm-0.1.1/tests/test_observer.py +335 -0
  121. airlock_llm-0.1.1/tests/test_orchestrator.py +303 -0
  122. airlock_llm-0.1.1/tests/test_pii_guard.py +1259 -0
  123. airlock_llm-0.1.1/tests/test_proxy.py +455 -0
  124. airlock_llm-0.1.1/tests/test_proxy_manager.py +438 -0
  125. airlock_llm-0.1.1/tests/test_response_scanner.py +404 -0
  126. airlock_llm-0.1.1/tests/test_s3_logger.py +211 -0
  127. airlock_llm-0.1.1/tests/test_semantic_guard.py +551 -0
  128. airlock_llm-0.1.1/tests/test_slow_analyzer.py +955 -0
  129. airlock_llm-0.1.1/tests/test_slow_cli.py +255 -0
  130. airlock_llm-0.1.1/tests/test_sql_logger.py +134 -0
  131. airlock_llm-0.1.1/tests/test_state_stress.py +154 -0
  132. airlock_llm-0.1.1/tests/test_tracing.py +108 -0
  133. airlock_llm-0.1.1/tests/test_tui.py +1151 -0
  134. airlock_llm-0.1.1/tests/test_tui_thread_safety.py +255 -0
  135. airlock_llm-0.1.1/tests/test_tuner.py +168 -0
@@ -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 [yyyy] [name of copyright owner]
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.
@@ -0,0 +1,348 @@
1
+ Metadata-Version: 2.4
2
+ Name: airlock-llm
3
+ Version: 0.1.1
4
+ Summary: Enterprise LLM proxy built on LiteLLM — logging, guardrails, and unified access for AI coding tools.
5
+ Author: Corey Thompson
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/coreyt/airlock
8
+ Project-URL: Repository, https://github.com/coreyt/airlock
9
+ Project-URL: Issues, https://github.com/coreyt/airlock/issues
10
+ Project-URL: Changelog, https://github.com/coreyt/airlock/blob/main/CHANGELOG.md
11
+ Keywords: llm,proxy,litellm,guardrails,pii,observability,ai,openai,anthropic,mcp
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: System Administrators
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Operating System :: MacOS
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Internet :: Proxy Servers
24
+ Classifier: Topic :: Security
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Classifier: Topic :: System :: Logging
27
+ Requires-Python: >=3.10
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: litellm[proxy]!=1.82.7,!=1.82.8,>=1.55.0
31
+ Requires-Dist: presidio-analyzer>=2.2.0
32
+ Requires-Dist: presidio-anonymizer>=2.2.0
33
+ Requires-Dist: python-dotenv>=1.0.0
34
+ Requires-Dist: pyyaml>=6.0.0
35
+ Requires-Dist: textual>=6.2.1
36
+ Provides-Extra: s3
37
+ Requires-Dist: boto3>=1.34.0; extra == "s3"
38
+ Provides-Extra: sql
39
+ Requires-Dist: sqlalchemy>=2.0.0; extra == "sql"
40
+ Provides-Extra: metrics
41
+ Requires-Dist: prometheus-client>=0.20.0; extra == "metrics"
42
+ Provides-Extra: tui
43
+ Requires-Dist: textual>=0.40.0; extra == "tui"
44
+ Provides-Extra: search
45
+ Requires-Dist: tavily-python>=0.5.0; extra == "search"
46
+ Requires-Dist: newscatcher-catchall-sdk>=1.0.0; extra == "search"
47
+ Provides-Extra: tracing
48
+ Requires-Dist: opentelemetry-api>=1.20.0; extra == "tracing"
49
+ Requires-Dist: opentelemetry-sdk>=1.20.0; extra == "tracing"
50
+ Provides-Extra: test
51
+ Requires-Dist: pytest>=8.0; extra == "test"
52
+ Requires-Dist: pytest-asyncio>=0.23; extra == "test"
53
+ Requires-Dist: pytest-cov>=5.0; extra == "test"
54
+ Requires-Dist: fastapi>=0.100.0; extra == "test"
55
+ Requires-Dist: prometheus-client>=0.20.0; extra == "test"
56
+ Dynamic: license-file
57
+
58
+ # Airlock
59
+
60
+ Enterprise LLM proxy built on [LiteLLM](https://github.com/BerriAI/litellm) — unified access, logging, and guardrails for AI coding tools.
61
+
62
+ Airlock sits between your developers and LLM providers, giving you visibility and control without slowing anyone down.
63
+
64
+ ```
65
+ ┌──────────┐ ┌──────────┐ ┌──────────┐
66
+ │ Cursor │ │ Claude │ │ Copilot │
67
+ │ │ │ Code │ │ │
68
+ └─────┬─────┘ └─────┬────┘ └─────┬─────┘
69
+ │ │ │
70
+ └───────────┬───┘──────────────┘
71
+
72
+ ┌─────▼──────┐
73
+ │ AIRLOCK │ ← logging, PII guard, keyword guard
74
+ │ (LiteLLM) │
75
+ └──────┬──────┘
76
+
77
+ ┌─────────┼──────────┐
78
+ │ │ │
79
+ ┌────▼───┐ ┌───▼────┐ ┌──▼──────┐
80
+ │Anthropic│ │ OpenAI │ │ Internal│
81
+ │ API │ │ API │ │ RAG │
82
+ └────────┘ └────────┘ └─────────┘
83
+ ```
84
+
85
+ ## What it does
86
+
87
+ | Concern | How Airlock handles it |
88
+ |---|---|
89
+ | **Unified access** | Single OpenAI-compatible endpoint for all providers |
90
+ | **Logging** | Every request/response logged as structured JSONL |
91
+ | **PII stripping** | Microsoft Presidio scrubs credit cards, SSNs, emails, etc. before they leave the network |
92
+ | **Keyword blocking** | Custom blocklist prevents restricted project names or terms from leaking |
93
+ | **Budget control** | Per-user/per-team spend limits via LiteLLM virtual keys |
94
+ | **Multi-tool support** | Works with Cursor, Claude Code, GitHub Copilot, and any OpenAI-compatible client |
95
+ | **Self-hosted models** | Route to local vLLM, Ollama, or any OpenAI-compatible endpoint alongside cloud providers |
96
+ | **Interactive testing** | Built-in Basic Chat screen to test LLM connectivity and inspect full request/response cycles |
97
+
98
+ ## Getting started
99
+
100
+ ### Install from PyPI
101
+
102
+ ```bash
103
+ pip install airlock-llm
104
+ python -m spacy download en_core_web_lg # required for PII redaction
105
+ airlock init
106
+ ```
107
+
108
+ `airlock init` generates `config.yaml`, `.env`, and a `logs/` directory in the
109
+ current working directory.
110
+
111
+ ### Install from source (quick setup)
112
+
113
+ ```bash
114
+ git clone https://github.com/coreyt/airlock && cd airlock
115
+ ./scripts/setup.sh
116
+ ```
117
+
118
+ This installs Airlock and its dependencies, downloads the spaCy model for PII
119
+ redaction, and runs `airlock init`. Pass `--pip` to use pip instead of uv.
120
+
121
+ ### Developer setup
122
+
123
+ ```bash
124
+ git clone https://github.com/coreyt/airlock && cd airlock
125
+ ./scripts/setup-dev.sh
126
+ ```
127
+
128
+ Everything in the standard setup, plus all optional extras (test, metrics,
129
+ tracing, search, s3, sql), install verification, and a test suite run. Pass
130
+ `--pip` to use pip instead of uv.
131
+
132
+ ### Add your API keys
133
+
134
+ Edit the generated `.env` file and fill in your provider keys:
135
+
136
+ ```bash
137
+ # .env
138
+ ANTHROPIC_API_KEY=sk-ant-...
139
+ OPENAI_API_KEY=sk-...
140
+ ```
141
+
142
+ You only need keys for the providers you plan to use. If you only use Anthropic models, you can leave `OPENAI_API_KEY` blank.
143
+
144
+ ### Start the proxy
145
+
146
+ ```bash
147
+ # Option A: TUI dashboard with built-in proxy (recommended)
148
+ uv run airlock tui --start
149
+
150
+ # Option B: proxy only (headless)
151
+ uv run airlock start
152
+ ```
153
+
154
+ Airlock listens on `http://localhost:4000` by default. Change the port with `AIRLOCK_PORT` in `.env`.
155
+
156
+ ### Test it
157
+
158
+ ```bash
159
+ curl http://localhost:4000/v1/chat/completions \
160
+ -H "Content-Type: application/json" \
161
+ -H "Authorization: Bearer sk-airlock-change-me" \
162
+ -d '{
163
+ "model": "claude-sonnet",
164
+ "messages": [{"role": "user", "content": "Hello!"}]
165
+ }'
166
+ ```
167
+
168
+ Or use the TUI's **Basic Chat** screen (press `0`) to interactively test any configured model and inspect the full request/response headers and body.
169
+
170
+ ### Alternative: Docker
171
+
172
+ ```bash
173
+ docker compose up --build
174
+ ```
175
+
176
+ ## Connecting AI tools
177
+
178
+ Point any OpenAI-compatible client at `http://localhost:4000` (or your deployed Airlock URL).
179
+
180
+ ### Claude Code
181
+
182
+ ```bash
183
+ # Install client-side hooks and route traffic through the proxy
184
+ airlock hooks install
185
+ eval $(airlock dogfood)
186
+ claude
187
+ ```
188
+
189
+ Every request now flows through PII redaction, keyword blocking, and JSONL logging. Open `airlock tui` in another terminal to watch traffic in real time.
190
+
191
+ See [dev/dogfooding.md](dev/dogfooding.md) for the full setup guide.
192
+
193
+ ### Cursor / Windsurf
194
+
195
+ In settings, set:
196
+ - **OpenAI Base URL**: `http://localhost:4000/v1`
197
+ - **API Key**: your Airlock master key (from `.env`)
198
+
199
+ ### GitHub Copilot
200
+
201
+ In VS Code `settings.json`:
202
+ ```json
203
+ {
204
+ "github.copilot.advanced": {
205
+ "debug.overrideProxyUrl": "http://localhost:4000/v1"
206
+ }
207
+ }
208
+ ```
209
+
210
+ ## Configuration
211
+
212
+ ### config.yaml
213
+
214
+ The main configuration file defines models, callbacks, and guardrails. See the inline comments in `config.yaml` for details.
215
+
216
+ Key sections:
217
+ - **`model_list`** — which LLM providers/models to expose
218
+ - **`litellm_settings`** — callbacks, timeouts, budgets
219
+ - **`router_settings`** — routing strategy, fallbacks, provider budgets
220
+ - **`guardrails`** — PII and keyword guards
221
+ - **`mcp_servers`** — MCP tool servers (Armada, ADO, etc.) accessible via the proxy
222
+ - **`general_settings`** — master key, host/port
223
+
224
+ ### Self-hosted / local models
225
+
226
+ Airlock supports any OpenAI-compatible endpoint (vLLM, Ollama, LocalAI, etc.) using the `openai/` prefix with a custom `api_base`:
227
+
228
+ ```yaml
229
+ # config.yaml — add to model_list
230
+ - model_name: gemma-4
231
+ litellm_params:
232
+ model: openai/gemma4-31b # model ID as reported by the server
233
+ api_base: http://your-host:8000/v1
234
+ api_key: os.environ/VLLM_API_KEY # use "dummy-key" if server has no auth
235
+ ```
236
+
237
+ ```bash
238
+ # .env
239
+ VLLM_API_KEY=dummy-key
240
+ ```
241
+
242
+ The model will appear in the TUI Basic Chat screen for interactive testing and can be used by any connected client via `model: "gemma-4"`.
243
+
244
+ ### Environment variables
245
+
246
+ | Variable | Description | Default |
247
+ |---|---|---|
248
+ | `ANTHROPIC_API_KEY` | Anthropic API key | — |
249
+ | `OPENAI_API_KEY` | OpenAI API key | — |
250
+ | `AIRLOCK_MASTER_KEY` | Master key for admin endpoints | — |
251
+ | `AIRLOCK_HOST` | Bind address (set to `0.0.0.0` to expose externally) | `127.0.0.1` |
252
+ | `AIRLOCK_PORT` | Listen port | `4000` |
253
+ | `AIRLOCK_LOG_DIR` | Directory for JSONL log files | `./logs` |
254
+ | `AIRLOCK_MAX_LOG_DAYS` | Days to retain log files before cleanup | `30` |
255
+ | `AIRLOCK_MAX_LOG_SIZE_MB` | Max log file size before rotation | `500` |
256
+ | `AIRLOCK_BLOCKED_KEYWORDS` | Comma-separated restricted phrases | — |
257
+ | `AIRLOCK_PII_ENTITIES` | Presidio entity types to redact | `CREDIT_CARD,US_SSN,EMAIL_ADDRESS,PHONE_NUMBER` |
258
+
259
+ ## Adding MCP servers
260
+
261
+ Airlock can proxy MCP tool servers alongside LLM providers. Add entries to `mcp_servers` in `config.yaml`. LiteLLM spawns stdio servers from the proxy's working directory, so command resolution matters.
262
+
263
+ ### Command resolution patterns
264
+
265
+ **Module via `python -m`** — cwd-independent, requires package installed in the proxy's venv:
266
+ ```yaml
267
+ mcp_servers:
268
+ ado_mcp:
269
+ command: uv
270
+ args: ["run", "python", "-m", "ado_mcp.mcp.server"]
271
+ env:
272
+ ADO_ORG_URL: os.environ/ADO_ORG_URL
273
+ ADO_PAT: os.environ/ADO_PAT
274
+ ```
275
+
276
+ **Installed script via `uv run`** — cwd-independent, resolves from PATH/venv:
277
+ ```yaml
278
+ armada:
279
+ command: uv
280
+ args: ["run", "armada-mcp"]
281
+ env:
282
+ ARMADA_PROFILE: essential
283
+ ```
284
+
285
+ **Script file** — must use an absolute path (relative paths resolve against the proxy's cwd, not the server's project directory):
286
+ ```yaml
287
+ mono_tui:
288
+ command: python3
289
+ args: ["/home/user/projects/my-mcp-server/server.py"]
290
+ ```
291
+
292
+ **Other runtimes:**
293
+ ```yaml
294
+ # Node.js
295
+ my_node_server:
296
+ command: node
297
+ args: ["/path/to/server.js"]
298
+
299
+ # npx (installed package)
300
+ my_npx_server:
301
+ command: npx
302
+ args: ["my-mcp-server"]
303
+
304
+ # Bun
305
+ my_bun_server:
306
+ command: bun
307
+ args: ["run", "/path/to/server.ts"]
308
+
309
+ # Poetry
310
+ my_poetry_server:
311
+ command: poetry
312
+ args: ["run", "python", "-m", "my_server"]
313
+ ```
314
+
315
+ ### Environment variables
316
+
317
+ Use `os.environ/VAR_NAME` to pass environment variables from Airlock's `.env` to the MCP server. Airlock validates these references at startup and gives clear error messages for missing values.
318
+
319
+ ### Guardrail coverage
320
+
321
+ All MCP tool calls flow through the same guardrail pipeline as LLM requests (PII redaction, keyword blocking, threat detection). MCP-specific guards add tool allowlist/blocklist and argument sanitization. No extra configuration needed — guardrails apply automatically.
322
+
323
+ ## Project structure
324
+
325
+ ```
326
+ airlock/
327
+ ├── proxy.py # Entry point — launches LiteLLM subprocess
328
+ ├── callbacks/ # JSONL logger, S3, SQL, Prometheus, OpenTelemetry
329
+ ├── guardrails/ # PII redaction, keyword blocking, semantic, adaptive
330
+ ├── fast/ # Real-time: threat detection, circuit breaker, priority
331
+ ├── slow/ # Offline: log analysis, trend detection, tuning
332
+ ├── hooks/ # Claude Code client-side hooks (session, prompt, audit)
333
+ ├── cli/ # Unified CLI: init, start, status, tui, analyze, hooks
334
+ └── tui/ # Textual terminal dashboard (10 screens, proxy control)
335
+ scripts/
336
+ ├── setup.sh # Standard setup (install + init + spaCy model)
337
+ └── setup-dev.sh # Developer setup (all extras + tests)
338
+ ```
339
+
340
+ ## Production deployment
341
+
342
+ See [docs/operations.md](docs/operations.md) for deployment guides (Docker, Kubernetes, bare metal), monitoring, security checklist, and upgrade procedures.
343
+
344
+ See [docs/troubleshooting.md](docs/troubleshooting.md) for common issues and debugging.
345
+
346
+ ## License
347
+
348
+ Apache 2.0