agent-action-guard 1.0.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.
@@ -0,0 +1,401 @@
1
+ © 2025 Praneeth Vadlapati.
2
+ <!-- Copyright (c) 2025 Praneeth Vadlapati -->
3
+
4
+ # License: CC-BY 4.0
5
+ https://creativecommons.org/licenses/by/4.0/
6
+
7
+ Attribution 4.0 International
8
+
9
+ =======================================================================
10
+
11
+ Creative Commons Corporation ("Creative Commons") is not a law firm and
12
+ does not provide legal services or legal advice. Distribution of
13
+ Creative Commons public licenses does not create a lawyer-client or
14
+ other relationship. Creative Commons makes its licenses and related
15
+ information available on an "as-is" basis. Creative Commons gives no
16
+ warranties regarding its licenses, any material licensed under their
17
+ terms and conditions, or any related information. Creative Commons
18
+ disclaims all liability for damages resulting from their use to the
19
+ fullest extent possible.
20
+
21
+ Using Creative Commons Public Licenses
22
+
23
+ Creative Commons public licenses provide a standard set of terms and
24
+ conditions that creators and other rights holders may use to share
25
+ original works of authorship and other material subject to copyright
26
+ and certain other rights specified in the public license below. The
27
+ following considerations are for informational purposes only, are not
28
+ exhaustive, and do not form part of our licenses.
29
+
30
+ Considerations for licensors: Our public licenses are
31
+ intended for use by those authorized to give the public
32
+ permission to use material in ways otherwise restricted by
33
+ copyright and certain other rights. Our licenses are
34
+ irrevocable. Licensors should read and understand the terms
35
+ and conditions of the license they choose before applying it.
36
+ Licensors should also secure all rights necessary before
37
+ applying our licenses so that the public can reuse the
38
+ material as expected. Licensors should clearly mark any
39
+ material not subject to the license. This includes other CC-
40
+ licensed material, or material used under an exception or
41
+ limitation to copyright. More considerations for licensors:
42
+ wiki.creativecommons.org/Considerations_for_licensors
43
+
44
+ Considerations for the public: By using one of our public
45
+ licenses, a licensor grants the public permission to use the
46
+ licensed material under specified terms and conditions. If
47
+ the licensor's permission is not necessary for any reason--for
48
+ example, because of any applicable exception or limitation to
49
+ copyright--then that use is not regulated by the license. Our
50
+ licenses grant only permissions under copyright and certain
51
+ other rights that a licensor has authority to grant. Use of
52
+ the licensed material may still be restricted for other
53
+ reasons, including because others have copyright or other
54
+ rights in the material. A licensor may make special requests,
55
+ such as asking that all changes be marked or described.
56
+ Although not required by our licenses, you are encouraged to
57
+ respect those requests where reasonable. More_considerations
58
+ for the public:
59
+ wiki.creativecommons.org/Considerations_for_licensees
60
+
61
+ =======================================================================
62
+
63
+ Creative Commons Attribution 4.0 International Public License
64
+
65
+ By exercising the Licensed Rights (defined below), You accept and agree
66
+ to be bound by the terms and conditions of this Creative Commons
67
+ Attribution 4.0 International Public License ("Public License"). To the
68
+ extent this Public License may be interpreted as a contract, You are
69
+ granted the Licensed Rights in consideration of Your acceptance of
70
+ these terms and conditions, and the Licensor grants You such rights in
71
+ consideration of benefits the Licensor receives from making the
72
+ Licensed Material available under these terms and conditions.
73
+
74
+
75
+ Section 1 -- Definitions.
76
+
77
+ a. Adapted Material means material subject to Copyright and Similar
78
+ Rights that is derived from or based upon the Licensed Material
79
+ and in which the Licensed Material is translated, altered,
80
+ arranged, transformed, or otherwise modified in a manner requiring
81
+ permission under the Copyright and Similar Rights held by the
82
+ Licensor. For purposes of this Public License, where the Licensed
83
+ Material is a musical work, performance, or sound recording,
84
+ Adapted Material is always produced where the Licensed Material is
85
+ synched in timed relation with a moving image.
86
+
87
+ b. Adapter's License means the license You apply to Your Copyright
88
+ and Similar Rights in Your contributions to Adapted Material in
89
+ accordance with the terms and conditions of this Public License.
90
+
91
+ c. Copyright and Similar Rights means copyright and/or similar rights
92
+ closely related to copyright including, without limitation,
93
+ performance, broadcast, sound recording, and Sui Generis Database
94
+ Rights, without regard to how the rights are labeled or
95
+ categorized. For purposes of this Public License, the rights
96
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
97
+ Rights.
98
+
99
+ d. Effective Technological Measures means those measures that, in the
100
+ absence of proper authority, may not be circumvented under laws
101
+ fulfilling obligations under Article 11 of the WIPO Copyright
102
+ Treaty adopted on December 20, 1996, and/or similar international
103
+ agreements.
104
+
105
+ e. Exceptions and Limitations means fair use, fair dealing, and/or
106
+ any other exception or limitation to Copyright and Similar Rights
107
+ that applies to Your use of the Licensed Material.
108
+
109
+ f. Licensed Material means the artistic or literary work, database,
110
+ or other material to which the Licensor applied this Public
111
+ License.
112
+
113
+ g. Licensed Rights means the rights granted to You subject to the
114
+ terms and conditions of this Public License, which are limited to
115
+ all Copyright and Similar Rights that apply to Your use of the
116
+ Licensed Material and that the Licensor has authority to license.
117
+
118
+ h. Licensor means the individual(s) or entity(ies) granting rights
119
+ under this Public License.
120
+
121
+ i. Share means to provide material to the public by any means or
122
+ process that requires permission under the Licensed Rights, such
123
+ as reproduction, public display, public performance, distribution,
124
+ dissemination, communication, or importation, and to make material
125
+ available to the public including in ways that members of the
126
+ public may access the material from a place and at a time
127
+ individually chosen by them.
128
+
129
+ j. Sui Generis Database Rights means rights other than copyright
130
+ resulting from Directive 96/9/EC of the European Parliament and of
131
+ the Council of 11 March 1996 on the legal protection of databases,
132
+ as amended and/or succeeded, as well as other essentially
133
+ equivalent rights anywhere in the world.
134
+
135
+ k. You means the individual or entity exercising the Licensed Rights
136
+ under this Public License. Your has a corresponding meaning.
137
+
138
+
139
+ Section 2 -- Scope.
140
+
141
+ a. License grant.
142
+
143
+ 1. Subject to the terms and conditions of this Public License,
144
+ the Licensor hereby grants You a worldwide, royalty-free,
145
+ non-sublicensable, non-exclusive, irrevocable license to
146
+ exercise the Licensed Rights in the Licensed Material to:
147
+
148
+ a. reproduce and Share the Licensed Material, in whole or
149
+ in part; and
150
+
151
+ b. produce, reproduce, and Share Adapted Material.
152
+
153
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
154
+ Exceptions and Limitations apply to Your use, this Public
155
+ License does not apply, and You do not need to comply with
156
+ its terms and conditions.
157
+
158
+ 3. Term. The term of this Public License is specified in Section
159
+ 6(a).
160
+
161
+ 4. Media and formats; technical modifications allowed. The
162
+ Licensor authorizes You to exercise the Licensed Rights in
163
+ all media and formats whether now known or hereafter created,
164
+ and to make technical modifications necessary to do so. The
165
+ Licensor waives and/or agrees not to assert any right or
166
+ authority to forbid You from making technical modifications
167
+ necessary to exercise the Licensed Rights, including
168
+ technical modifications necessary to circumvent Effective
169
+ Technological Measures. For purposes of this Public License,
170
+ simply making modifications authorized by this Section 2(a)
171
+ (4) never produces Adapted Material.
172
+
173
+ 5. Downstream recipients.
174
+
175
+ a. Offer from the Licensor -- Licensed Material. Every
176
+ recipient of the Licensed Material automatically
177
+ receives an offer from the Licensor to exercise the
178
+ Licensed Rights under the terms and conditions of this
179
+ Public License.
180
+
181
+ b. No downstream restrictions. You may not offer or impose
182
+ any additional or different terms or conditions on, or
183
+ apply any Effective Technological Measures to, the
184
+ Licensed Material if doing so restricts exercise of the
185
+ Licensed Rights by any recipient of the Licensed
186
+ Material.
187
+
188
+ 6. No endorsement. Nothing in this Public License constitutes or
189
+ may be construed as permission to assert or imply that You
190
+ are, or that Your use of the Licensed Material is, connected
191
+ with, or sponsored, endorsed, or granted official status by,
192
+ the Licensor or others designated to receive attribution as
193
+ provided in Section 3(a)(1)(A)(i).
194
+
195
+ b. Other rights.
196
+
197
+ 1. Moral rights, such as the right of integrity, are not
198
+ licensed under this Public License, nor are publicity,
199
+ privacy, and/or other similar personality rights; however, to
200
+ the extent possible, the Licensor waives and/or agrees not to
201
+ assert any such rights held by the Licensor to the limited
202
+ extent necessary to allow You to exercise the Licensed
203
+ Rights, but not otherwise.
204
+
205
+ 2. Patent and trademark rights are not licensed under this
206
+ Public License.
207
+
208
+ 3. To the extent possible, the Licensor waives any right to
209
+ collect royalties from You for the exercise of the Licensed
210
+ Rights, whether directly or through a collecting society
211
+ under any voluntary or waivable statutory or compulsory
212
+ licensing scheme. In all other cases the Licensor expressly
213
+ reserves any right to collect such royalties.
214
+
215
+
216
+ Section 3 -- License Conditions.
217
+
218
+ Your exercise of the Licensed Rights is expressly made subject to the
219
+ following conditions.
220
+
221
+ a. Attribution.
222
+
223
+ 1. If You Share the Licensed Material (including in modified
224
+ form), You must:
225
+
226
+ a. retain the following if it is supplied by the Licensor
227
+ with the Licensed Material:
228
+
229
+ i. identification of the creator(s) of the Licensed
230
+ Material and any others designated to receive
231
+ attribution, in any reasonable manner requested by
232
+ the Licensor (including by pseudonym if
233
+ designated);
234
+
235
+ ii. a copyright notice;
236
+
237
+ iii. a notice that refers to this Public License;
238
+
239
+ iv. a notice that refers to the disclaimer of
240
+ warranties;
241
+
242
+ v. a URI or hyperlink to the Licensed Material to the
243
+ extent reasonably practicable;
244
+
245
+ b. indicate if You modified the Licensed Material and
246
+ retain an indication of any previous modifications; and
247
+
248
+ c. indicate the Licensed Material is licensed under this
249
+ Public License, and include the text of, or the URI or
250
+ hyperlink to, this Public License.
251
+
252
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
253
+ reasonable manner based on the medium, means, and context in
254
+ which You Share the Licensed Material. For example, it may be
255
+ reasonable to satisfy the conditions by providing a URI or
256
+ hyperlink to a resource that includes the required
257
+ information.
258
+
259
+ 3. If requested by the Licensor, You must remove any of the
260
+ information required by Section 3(a)(1)(A) to the extent
261
+ reasonably practicable.
262
+
263
+ 4. If You Share Adapted Material You produce, the Adapter's
264
+ License You apply must not prevent recipients of the Adapted
265
+ Material from complying with this Public License.
266
+
267
+
268
+ Section 4 -- Sui Generis Database Rights.
269
+
270
+ Where the Licensed Rights include Sui Generis Database Rights that
271
+ apply to Your use of the Licensed Material:
272
+
273
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
274
+ to extract, reuse, reproduce, and Share all or a substantial
275
+ portion of the contents of the database;
276
+
277
+ b. if You include all or a substantial portion of the database
278
+ contents in a database in which You have Sui Generis Database
279
+ Rights, then the database in which You have Sui Generis Database
280
+ Rights (but not its individual contents) is Adapted Material; and
281
+
282
+ c. You must comply with the conditions in Section 3(a) if You Share
283
+ all or a substantial portion of the contents of the database.
284
+
285
+ For the avoidance of doubt, this Section 4 supplements and does not
286
+ replace Your obligations under this Public License where the Licensed
287
+ Rights include other Copyright and Similar Rights.
288
+
289
+
290
+ Section 5 -- Disclaimer of Warranties and Limitation of Liability.
291
+
292
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
293
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
294
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
295
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
296
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
297
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
298
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
299
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
300
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
301
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
302
+
303
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
304
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
305
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
306
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
307
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
308
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
309
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
310
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
311
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
312
+
313
+ c. The disclaimer of warranties and limitation of liability provided
314
+ above shall be interpreted in a manner that, to the extent
315
+ possible, most closely approximates an absolute disclaimer and
316
+ waiver of all liability.
317
+
318
+
319
+ Section 6 -- Term and Termination.
320
+
321
+ a. This Public License applies for the term of the Copyright and
322
+ Similar Rights licensed here. However, if You fail to comply with
323
+ this Public License, then Your rights under this Public License
324
+ terminate automatically.
325
+
326
+ b. Where Your right to use the Licensed Material has terminated under
327
+ Section 6(a), it reinstates:
328
+
329
+ 1. automatically as of the date the violation is cured, provided
330
+ it is cured within 30 days of Your discovery of the
331
+ violation; or
332
+
333
+ 2. upon express reinstatement by the Licensor.
334
+
335
+ For the avoidance of doubt, this Section 6(b) does not affect any
336
+ right the Licensor may have to seek remedies for Your violations
337
+ of this Public License.
338
+
339
+ c. For the avoidance of doubt, the Licensor may also offer the
340
+ Licensed Material under separate terms or conditions or stop
341
+ distributing the Licensed Material at any time; however, doing so
342
+ will not terminate this Public License.
343
+
344
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
345
+ License.
346
+
347
+
348
+ Section 7 -- Other Terms and Conditions.
349
+
350
+ a. The Licensor shall not be bound by any additional or different
351
+ terms or conditions communicated by You unless expressly agreed.
352
+
353
+ b. Any arrangements, understandings, or agreements regarding the
354
+ Licensed Material not stated herein are separate from and
355
+ independent of the terms and conditions of this Public License.
356
+
357
+
358
+ Section 8 -- Interpretation.
359
+
360
+ a. For the avoidance of doubt, this Public License does not, and
361
+ shall not be interpreted to, reduce, limit, restrict, or impose
362
+ conditions on any use of the Licensed Material that could lawfully
363
+ be made without permission under this Public License.
364
+
365
+ b. To the extent possible, if any provision of this Public License is
366
+ deemed unenforceable, it shall be automatically reformed to the
367
+ minimum extent necessary to make it enforceable. If the provision
368
+ cannot be reformed, it shall be severed from this Public License
369
+ without affecting the enforceability of the remaining terms and
370
+ conditions.
371
+
372
+ c. No term or condition of this Public License will be waived and no
373
+ failure to comply consented to unless expressly agreed to by the
374
+ Licensor.
375
+
376
+ d. Nothing in this Public License constitutes or may be interpreted
377
+ as a limitation upon, or waiver of, any privileges and immunities
378
+ that apply to the Licensor or You, including from the legal
379
+ processes of any jurisdiction or authority.
380
+
381
+
382
+ =======================================================================
383
+
384
+ Creative Commons is not a party to its public
385
+ licenses. Notwithstanding, Creative Commons may elect to apply one of
386
+ its public licenses to material it publishes and in those instances
387
+ will be considered the “Licensor.” The text of the Creative Commons
388
+ public licenses is dedicated to the public domain under the CC0 Public
389
+ Domain Dedication. Except for the limited purpose of indicating that
390
+ material is shared under a Creative Commons public license or as
391
+ otherwise permitted by the Creative Commons policies published at
392
+ creativecommons.org/policies, Creative Commons does not authorize the
393
+ use of the trademark "Creative Commons" or any other trademark or logo
394
+ of Creative Commons without its prior written consent including,
395
+ without limitation, in connection with any unauthorized modifications
396
+ to any of its public licenses or any other arrangements,
397
+ understandings, or agreements concerning use of licensed material. For
398
+ the avoidance of doubt, this paragraph does not form part of the
399
+ public licenses.
400
+
401
+ Creative Commons may be contacted at creativecommons.org.
@@ -0,0 +1 @@
1
+ prune tests
@@ -0,0 +1,199 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-action-guard
3
+ Version: 1.0.0
4
+ Summary: Runtime classifier for screening AI agent actions as safe, harmful, or unethical.
5
+ Author-email: Praneeth Vadlapati <praneeth.vad@gmail.com>
6
+ License-Expression: CC-BY-4.0
7
+ Project-URL: Homepage, https://github.com/Pro-GenAI/Agent-Action-Guard
8
+ Project-URL: Issues, https://github.com/Pro-GenAI/Agent-Action-Guard/issues
9
+ Project-URL: Repository, https://github.com/Pro-GenAI/Agent-Action-Guard
10
+ Keywords: ai-agents,ai-safety,classification,llm,mcp,tool-calling
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Classifier: Topic :: Security
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Requires-Python: >=3.8
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE.md
29
+ Requires-Dist: numpy
30
+ Requires-Dist: torch
31
+ Requires-Dist: openai
32
+ Provides-Extra: dev
33
+ Requires-Dist: ruff; extra == "dev"
34
+ Requires-Dist: black; extra == "dev"
35
+ Requires-Dist: isort; extra == "dev"
36
+ Requires-Dist: flake8; extra == "dev"
37
+ Requires-Dist: pylint; extra == "dev"
38
+ Requires-Dist: mypy; extra == "dev"
39
+ Requires-Dist: pandas; extra == "dev"
40
+ Requires-Dist: python-dotenv; extra == "dev"
41
+ Requires-Dist: requests; extra == "dev"
42
+ Requires-Dist: scikit-learn; extra == "dev"
43
+ Requires-Dist: sentence-transformers; extra == "dev"
44
+ Requires-Dist: psutil; extra == "dev"
45
+ Requires-Dist: pytz; extra == "dev"
46
+ Requires-Dist: agentor; extra == "dev"
47
+ Requires-Dist: fastapi; extra == "dev"
48
+ Requires-Dist: uvicorn[standard]; extra == "dev"
49
+ Requires-Dist: pydantic; extra == "dev"
50
+ Requires-Dist: gradio>=6.0.0; extra == "dev"
51
+ Dynamic: license-file
52
+
53
+ <p align="center">
54
+ <img src="./assets/project_banner.gif" alt="Project banner" height="250"/>
55
+ <!--
56
+ $ ffmpeg -i unused/banner_video.mp4 -vframes 1 project_banner.jpg
57
+ # $ ffmpeg -i unused/banner_video.mp4 -vf "fps=10,scale=600:-1:flags=lanczos" -loop 0 project_banner.gif
58
+ -->
59
+ <!-- <img src="./assets/project_banner.jpg" alt="Project banner" height="360px"/> -->
60
+ <!-- $ convert project_banner.png -resize 600x319 project_banner.jpg -->
61
+ <!-- <img src="./assets/project_logo.jpg" alt="Project logo" width="270px"/> -->
62
+ <!-- $ convert logo_large.png -resize 270x270 project_logo.jpg -->
63
+ <!-- <h1 align="center">MCP Agent Action Guard</h1>
64
+ <h4 align="center"><em>Safe actions for safe AI</em></h4> -->
65
+ <img src="./assets/Workflow.gif" alt="Workflow Diagram" height="510"/>
66
+ </p>
67
+
68
+ AI is perceived as a threat. Increasing usage of LLM Agents and MCP leads to the usage of harmful tools and harmful usage of tools as proven using __HarmActEval__. Classifying AI agent actions ensures safety and reliability. Action Guard uses a neural network model trained on __HarmActions__ dataset to classify actions proposed by autonomous AI agents as harmful or safe. The model has been based on a small dataset of labeled examples. The work aims to enhance the safety and reliability of AI agents by preventing them from executing actions that are potentially harmful, unethical, or violate predefined guidelines. Safe AI Agents are made possible by Action Classifier.
69
+
70
+ [![Preprint](https://img.shields.io/badge/Paper-PDF-FFF7CC?style=for-the-badge&logo=files)](https://www.researchgate.net/publication/396525269_MCP_Agent_Action_Guard_Safe_AI_Agents_through_Action_Classifier)
71
+ [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/watch?v=7pNYXv3x7MA)
72
+ [![Blog](https://img.shields.io/badge/Blog-FFFFFF?style=for-the-badge&logo=huggingface&logoColor=black)](https://huggingface.co/blog/prane-eth/agent-action-guard)
73
+ <!-- [![Medium](https://img.shields.io/badge/Medium-12100E?style=for-the-badge&logo=medium&logoColor=white)](https://medium.com/@praneeth.v/the-agent-action-classifier-a-step-toward-safer-autonomous-ai-agents-1ec57a601449) -->
74
+ [![AI](https://img.shields.io/badge/AI-C21B00?style=for-the-badge&logo=openaigym&logoColor=white)]()
75
+ [![LLMs](https://img.shields.io/badge/LLMs-1A535C?style=for-the-badge&logo=openai&logoColor=white)]()
76
+ [![Python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=ffdd54)]()
77
+ [![License: CC BY 4.0](https://img.shields.io/badge/License-CC_BY_4.0-darkgreen.svg?style=for-the-badge&logo=github&logoColor=white)](./LICENSE.md)
78
+ [![HuggingFace Dataset](https://img.shields.io/badge/HuggingFace_Dataset-FF6F00?style=for-the-badge&logo=huggingface&logoColor=white)](https://huggingface.co/datasets/prane-eth/HarmActions)
79
+ <!-- [![DOI](https://img.shields.io/badge/DOI-10.20944/preprints202510.1415.v1-yellow?style=for-the-badge)](https://www.preprints.org/manuscript/202510.1415) -->
80
+
81
+ ### Demo
82
+ <img src="./assets/demo.gif" alt="Demo GIF" height="330"/>
83
+
84
+ > [!TIP]
85
+ > Please star ⭐ the repository if you find Action Guard is useful!
86
+
87
+ <img src="assets/star.gif" alt="star" height="70" />
88
+
89
+
90
+ ## Common causes of harmful actions by AI agents:
91
+ - User attempting to jailbreak the model.
92
+ - Model hallucinating or misunderstanding the context.
93
+ - Model being overconfident in its incorrect knowledge.
94
+ - Lack of proper constraints or guidelines for the agent.
95
+ - Inadequate training data for specific scenarios.
96
+ - MCP server providing incorrect tool descriptions that mislead the agent.
97
+ - Harmful MCP servers returning manipulative text to mislead the model.
98
+ - The experiments proved that the model performs a harmful action and still responds "Sorry, I can't help with that."
99
+
100
+
101
+ ## New contributions of Agent-Action-Guard framework:
102
+ 1. **HarmActions**, an structured dataset of safety-labeled agent actions complemented with manipulated prompts that trigger harmful or unethical actions.
103
+ 2. **HarmActEval** benchmark leveraging a new metric “Harm@k.”
104
+ 3. **Action Classifier**, a neural classifier trained on HarmActions dataset, designed to label proposed agent actions as potentially harmful or safe, and optimized for real-time deployment in agent loops.
105
+ 4. MCP integration supporting live action screening using existing MCP servers and clients.
106
+
107
+
108
+ ## Special features:
109
+ - This project introduces "HarmActEval" dataset and benchmark to evaluate an AI agent's probability of generating harmful actions.
110
+ - The dataset has been used to train a lightweight neural network model that classifies actions as safe, harmful, or unethical.
111
+ - The model is lightweight and can be easily integrated into existing AI agent frameworks like MCP.
112
+ - This project is about classifying actions and not related to Guardrails.
113
+ - Supports MCP (Model Context Protocol) to allow real-time action classification.
114
+ - Unlike OpenAI's `"require_approval": "always"` flag, this blocks harmful actions without human intervention.
115
+ - A2A-compatible version: https://github.com/Pro-GenAI/A2A-Agent-Action-Guard.
116
+ <!-- - Integration to MCP server - fixes if client sends a bad action irrespective of server's tool descriptions.
117
+ - Integration to MCP client - fixes if the server made the model take bad actions. -->
118
+
119
+ **Safety Features:**
120
+ - Automatically classifies MCP tool calls before execution.
121
+ - Blocks harmful actions based on the outputs of the trained model
122
+ - Provides detailed classification results
123
+ - Allows safe actions to proceed normally
124
+
125
+
126
+ Waiting with excitement for feedback and discussions on how this helps you or the AI community.
127
+
128
+ Want to use this in your commercial projects or want customization for your use case?
129
+ I can do it for you or guide you. Please contact me at praneeth.vad@gmail.com.
130
+
131
+
132
+ ### Usage
133
+ For usage instructions, kindly refer [USAGE.md](USAGE.md).
134
+
135
+ PyPI package scope:
136
+ - `pip install agent-action-guard` installs only the runtime classifier modules and model file needed for action classification.
137
+ - Training, evaluation, MCP demo servers, and UI scripts remain in this repository and require the `dev` extras.
138
+
139
+ Quick install:
140
+
141
+ Using `uv`:
142
+ ```bash
143
+ uv venv
144
+ source .venv/bin/activate
145
+ uv sync
146
+ ```
147
+
148
+ Using `python` + `pip`:
149
+ ```bash
150
+ python3 -m venv .venv
151
+ source .venv/bin/activate
152
+ pip install -e .
153
+ ```
154
+
155
+ For training, evaluation, and demo tooling, install the `dev` extra:
156
+
157
+ Using `uv`: `uv sync --extra dev`
158
+
159
+ Using `pip`: `pip install -e ".[dev]"`
160
+
161
+
162
+ ### A2A version:
163
+ While this repository focuses on standard tool calls and MCP, an Agent-to-Agent (A2A) compatible version is available at:
164
+ https://github.com/Pro-GenAI/A2A-Agent-Action-Guard
165
+
166
+
167
+ ### Citation
168
+ If you find this repository useful in your research, please consider citing:
169
+ ```bibtex
170
+ @article{202510.1415,
171
+ title = {Agent Action Guard: Classifying AI Agent Actions to Ensure Safety and Reliability},
172
+ year = 2025,
173
+ month = {October},
174
+ publisher = {Preprints},
175
+ author = {Praneeth Vadlapati},
176
+ doi = {10.20944/preprints202510.1415.v1},
177
+ url = {https://doi.org/10.20944/preprints202510.1415.v1},
178
+ journal = {Preprints}
179
+ }
180
+ ```
181
+
182
+ ### Limitation
183
+ Personally Identifiable Information (PII) detection is not performed by this project as it can be performed accurately using other existing systems.
184
+
185
+ ### Created based on my past work
186
+ Agent-Supervisor: Supervising Actions of Autonomous AI Agents for Ethical Compliance: [GitHub](https://github.com/Pro-GenAI/Agent-Supervisor)
187
+ <!--
188
+ ## Acknowledgements
189
+ - Thanks to [Hugging Face](https://huggingface.co/) for the [Gradio](https://gradio.app/) framework for the interface of the chatbot app.
190
+ - Thanks to [Anthropic](https://www.anthropic.com/news/model-context-protocol) for the Model Context Protocol (MCP) framework.
191
+ - Thanks to [OpenAI](https://openai.com/) for providing a Python package to interact with LLMs.
192
+ - Thanks to [Google](https://google.com/) for the Agent-to-Agent (A2A) protocol.
193
+
194
+ [![HuggingFace](https://img.shields.io/badge/Huggingface-FFD21E?style=for-the-badge&logo=Huggingface&logoColor=black "HuggingFace")](https://huggingface.co/)
195
+ [![Gradio](https://img.shields.io/badge/Gradio-FF7C00?style=for-the-badge&logo=gradio&logoColor=white "Gradio")](https://gradio.app/)
196
+ [![Anthropic](https://img.shields.io/badge/Anthropic-000000?style=for-the-badge&logo=anthropic&logoColor=white "MCP")](https://www.anthropic.com/news/model-context-protocol)
197
+ [![OpenAI](https://img.shields.io/badge/OpenAI-74AA9C?style=for-the-badge&logo=openai&logoColor=white "OpenAI")](https://openai.com/)
198
+ [![Google](https://img.shields.io/badge/Google-4285F4?style=for-the-badge&logo=google&logoColor=white "Google")](https://google.com/)
199
+ -->