veto 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.
Files changed (64) hide show
  1. veto-0.1.0/.gitignore +64 -0
  2. veto-0.1.0/PKG-INFO +192 -0
  3. veto-0.1.0/README.md +165 -0
  4. veto-0.1.0/examples/devops-pipeline/.env.example +2 -0
  5. veto-0.1.0/examples/devops-pipeline/.gitignore +30 -0
  6. veto-0.1.0/examples/devops-pipeline/README.md +49 -0
  7. veto-0.1.0/examples/devops-pipeline/devops_pipeline_agent.py +288 -0
  8. veto-0.1.0/examples/devops-pipeline/requirements.txt +4 -0
  9. veto-0.1.0/examples/devops-pipeline/veto/rules/deployments.yaml +95 -0
  10. veto-0.1.0/examples/devops-pipeline/veto/veto.config.yaml +19 -0
  11. veto-0.1.0/examples/sales-dispute/.env.example +2 -0
  12. veto-0.1.0/examples/sales-dispute/.gitignore +30 -0
  13. veto-0.1.0/examples/sales-dispute/README.md +49 -0
  14. veto-0.1.0/examples/sales-dispute/requirements.txt +4 -0
  15. veto-0.1.0/examples/sales-dispute/sales_dispute_agent.py +302 -0
  16. veto-0.1.0/examples/sales-dispute/veto/rules/refunds.yaml +86 -0
  17. veto-0.1.0/examples/sales-dispute/veto/veto.config.yaml +19 -0
  18. veto-0.1.0/examples/treasury-management/.env.example +2 -0
  19. veto-0.1.0/examples/treasury-management/.gitignore +30 -0
  20. veto-0.1.0/examples/treasury-management/README.md +35 -0
  21. veto-0.1.0/examples/treasury-management/requirements.txt +4 -0
  22. veto-0.1.0/examples/treasury-management/treasury_agent.py +254 -0
  23. veto-0.1.0/examples/treasury-management/veto/rules/treasury.yaml +82 -0
  24. veto-0.1.0/examples/treasury-management/veto/veto.config.yaml +19 -0
  25. veto-0.1.0/examples/vendor-payment/.env.example +2 -0
  26. veto-0.1.0/examples/vendor-payment/.gitignore +30 -0
  27. veto-0.1.0/examples/vendor-payment/README.md +35 -0
  28. veto-0.1.0/examples/vendor-payment/requirements.txt +4 -0
  29. veto-0.1.0/examples/vendor-payment/vendor_payment_agent.py +232 -0
  30. veto-0.1.0/examples/vendor-payment/veto/rules/vendors.yaml +78 -0
  31. veto-0.1.0/examples/vendor-payment/veto/veto.config.yaml +19 -0
  32. veto-0.1.0/pyproject.toml +53 -0
  33. veto-0.1.0/pytest.ini +7 -0
  34. veto-0.1.0/tests/__init__.py +1 -0
  35. veto-0.1.0/tests/test_history.py +141 -0
  36. veto-0.1.0/tests/test_logger.py +163 -0
  37. veto-0.1.0/tests/test_validator.py +177 -0
  38. veto-0.1.0/tests/test_veto.py +210 -0
  39. veto-0.1.0/veto/__init__.py +163 -0
  40. veto-0.1.0/veto/cli/__init__.py +80 -0
  41. veto-0.1.0/veto/cli/init.py +201 -0
  42. veto-0.1.0/veto/cli/templates.py +146 -0
  43. veto-0.1.0/veto/core/__init__.py +60 -0
  44. veto-0.1.0/veto/core/history.py +196 -0
  45. veto-0.1.0/veto/core/interceptor.py +334 -0
  46. veto-0.1.0/veto/core/validator.py +364 -0
  47. veto-0.1.0/veto/core/veto.py +1065 -0
  48. veto-0.1.0/veto/custom/__init__.py +56 -0
  49. veto-0.1.0/veto/custom/client.py +362 -0
  50. veto-0.1.0/veto/custom/prompt.py +95 -0
  51. veto-0.1.0/veto/custom/providers/__init__.py +3 -0
  52. veto-0.1.0/veto/custom/types.py +144 -0
  53. veto-0.1.0/veto/providers/__init__.py +70 -0
  54. veto-0.1.0/veto/providers/adapters.py +252 -0
  55. veto-0.1.0/veto/providers/types.py +129 -0
  56. veto-0.1.0/veto/rules/__init__.py +35 -0
  57. veto-0.1.0/veto/rules/prompt.py +120 -0
  58. veto-0.1.0/veto/rules/types.py +139 -0
  59. veto-0.1.0/veto/types/__init__.py +58 -0
  60. veto-0.1.0/veto/types/config.py +153 -0
  61. veto-0.1.0/veto/types/tool.py +149 -0
  62. veto-0.1.0/veto/utils/__init__.py +30 -0
  63. veto-0.1.0/veto/utils/id.py +44 -0
  64. veto-0.1.0/veto/utils/logger.py +306 -0
veto-0.1.0/.gitignore ADDED
@@ -0,0 +1,64 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ *.egg-info/
24
+ *.egg
25
+ MANIFEST
26
+
27
+ # Virtual environments
28
+ venv/
29
+ .venv/
30
+ ENV/
31
+ env/
32
+
33
+ # IDE
34
+ .idea/
35
+ .vscode/
36
+ *.swp
37
+ *.swo
38
+ *~
39
+
40
+ # OS
41
+ .DS_Store
42
+ Thumbs.db
43
+
44
+ # Environment files
45
+ .env
46
+ .env.local
47
+ .env.*.local
48
+
49
+ # Testing
50
+ .pytest_cache/
51
+ .coverage
52
+ htmlcov/
53
+ .tox/
54
+ .nox/
55
+
56
+ # Type checking
57
+ .mypy_cache/
58
+ .pytype/
59
+
60
+ # Logs
61
+ *.log
62
+
63
+ # Demo specific
64
+ demo/.env
veto-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,192 @@
1
+ Metadata-Version: 2.4
2
+ Name: veto
3
+ Version: 0.1.0
4
+ Summary: A guardrail system that intercepts and validates AI agent tool calls
5
+ License-Expression: MIT
6
+ Keywords: agent,ai,anthropic,gemini,guardrail,llm,openai,safety,tool-calls
7
+ Requires-Python: >=3.10
8
+ Requires-Dist: aiohttp>=3.8.0
9
+ Requires-Dist: pyyaml>=6.0
10
+ Provides-Extra: all
11
+ Requires-Dist: anthropic>=0.20.0; extra == 'all'
12
+ Requires-Dist: google-genai>=1.0.0; extra == 'all'
13
+ Requires-Dist: openai>=1.0.0; extra == 'all'
14
+ Provides-Extra: anthropic
15
+ Requires-Dist: anthropic>=0.20.0; extra == 'anthropic'
16
+ Provides-Extra: dev
17
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
18
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
19
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
20
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
21
+ Requires-Dist: types-pyyaml>=6.0.0; extra == 'dev'
22
+ Provides-Extra: gemini
23
+ Requires-Dist: google-genai>=1.0.0; extra == 'gemini'
24
+ Provides-Extra: openai
25
+ Requires-Dist: openai>=1.0.0; extra == 'openai'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # Veto
29
+
30
+ A guardrail system for AI agent tool calls. Veto intercepts and validates tool calls made by AI models before execution.
31
+
32
+ ## How It Works
33
+
34
+ 1. **Initialize** Veto.
35
+ 2. **Wrap** your tools using `veto.wrap()`.
36
+ 3. **Pass** the wrapped tools to your AI agent/model.
37
+
38
+ When the AI model calls a tool, Veto automatically:
39
+ 1. Intercepts the call.
40
+ 2. Validates arguments against your rules (via YAML & LLM).
41
+ 3. Blocks or Allows execution based on the result.
42
+
43
+ The AI model remains unaware of the guardrail - the tool interface is preserved.
44
+
45
+ ## Installation
46
+
47
+ ```bash
48
+ pip install veto
49
+ ```
50
+
51
+ For LLM provider support:
52
+ ```bash
53
+ pip install veto[openai] # OpenAI support
54
+ pip install veto[anthropic] # Anthropic support
55
+ pip install veto[gemini] # Google Gemini support
56
+ pip install veto[all] # All providers
57
+ ```
58
+
59
+ ## Quick Start
60
+
61
+ ### 1. Initialize Veto
62
+
63
+ Run the CLI to create configuration:
64
+ ```bash
65
+ veto init
66
+ ```
67
+ This creates a `veto/` directory with `veto.config.yaml` and default rules.
68
+
69
+ ### 2. Wrap Your Tools
70
+
71
+ ```python
72
+ from veto import Veto
73
+
74
+ # 1. Define your tools normally
75
+ my_tools = [
76
+ {"name": "my_tool", "handler": my_handler, ...},
77
+ # ...
78
+ ]
79
+
80
+ # 2. Initialize Veto
81
+ veto = await Veto.init()
82
+
83
+ # 3. Wrap tools (Validation logic is injected)
84
+ wrapped_tools = veto.wrap(my_tools)
85
+
86
+ # 4. Pass to your Agent/LLM
87
+ agent = create_agent(
88
+ tools=wrapped_tools,
89
+ # ...
90
+ )
91
+ ```
92
+
93
+ ### 3. Configure Rules
94
+
95
+ Edit `veto/rules/financial.yaml` (example):
96
+
97
+ ```yaml
98
+ rules:
99
+ - id: limit-transfers
100
+ name: Limit large transfers
101
+ action: block
102
+ tools:
103
+ - transfer_funds
104
+ conditions:
105
+ - field: arguments.amount
106
+ operator: greater_than
107
+ value: 1000
108
+ ```
109
+
110
+ ## Configuration
111
+
112
+ ### veto.config.yaml
113
+
114
+ ```yaml
115
+ version: "1.0"
116
+
117
+ # Operating mode
118
+ mode: "strict" # "strict" blocks calls, "log" only logs them
119
+
120
+ # Validation Backend
121
+ validation:
122
+ mode: "custom" # "api" or "custom"
123
+
124
+ # Custom Provider (if mode is custom)
125
+ custom:
126
+ provider: "gemini" # or openai, anthropic
127
+ model: "gemini-3-flash-preview"
128
+
129
+ # Logging
130
+ logging:
131
+ level: "info"
132
+
133
+ # Rules
134
+ rules:
135
+ directory: "./rules"
136
+ recursive: true
137
+ ```
138
+
139
+ ## API Reference
140
+
141
+ ### `Veto.init(options?)`
142
+
143
+ Initialize Veto. Loads configuration from `./veto` by default.
144
+
145
+ ```python
146
+ veto = await Veto.init()
147
+ ```
148
+
149
+ ### `veto.wrap(tools)`
150
+
151
+ Wraps an array of tools. The returned tools have Veto validation injected into their execution handler.
152
+
153
+ ```python
154
+ wrapped_tools = veto.wrap(my_tools)
155
+ ```
156
+
157
+ ### `veto.wrap_tool(tool)`
158
+
159
+ Wraps a single tool instance.
160
+
161
+ ```python
162
+ safe_tool = veto.wrap_tool(my_tool)
163
+ ```
164
+
165
+ ### `veto.get_history_stats()`
166
+
167
+ Returns statistics about allowed vs blocked calls.
168
+
169
+ ```python
170
+ stats = veto.get_history_stats()
171
+ print(stats)
172
+ # {"total_calls": 5, "allowed_calls": 4, "denied_calls": 1, ...}
173
+ ```
174
+
175
+ ### `veto.clear_history()`
176
+
177
+ Resets the history statistics.
178
+
179
+ ```python
180
+ veto.clear_history()
181
+ ```
182
+
183
+ ## CLI Commands
184
+
185
+ | Command | Description |
186
+ |---------|-------------|
187
+ | `veto init` | Initialize Veto in current directory |
188
+ | `veto version` | Show version |
189
+
190
+ ## License
191
+
192
+ MIT
veto-0.1.0/README.md ADDED
@@ -0,0 +1,165 @@
1
+ # Veto
2
+
3
+ A guardrail system for AI agent tool calls. Veto intercepts and validates tool calls made by AI models before execution.
4
+
5
+ ## How It Works
6
+
7
+ 1. **Initialize** Veto.
8
+ 2. **Wrap** your tools using `veto.wrap()`.
9
+ 3. **Pass** the wrapped tools to your AI agent/model.
10
+
11
+ When the AI model calls a tool, Veto automatically:
12
+ 1. Intercepts the call.
13
+ 2. Validates arguments against your rules (via YAML & LLM).
14
+ 3. Blocks or Allows execution based on the result.
15
+
16
+ The AI model remains unaware of the guardrail - the tool interface is preserved.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install veto
22
+ ```
23
+
24
+ For LLM provider support:
25
+ ```bash
26
+ pip install veto[openai] # OpenAI support
27
+ pip install veto[anthropic] # Anthropic support
28
+ pip install veto[gemini] # Google Gemini support
29
+ pip install veto[all] # All providers
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ ### 1. Initialize Veto
35
+
36
+ Run the CLI to create configuration:
37
+ ```bash
38
+ veto init
39
+ ```
40
+ This creates a `veto/` directory with `veto.config.yaml` and default rules.
41
+
42
+ ### 2. Wrap Your Tools
43
+
44
+ ```python
45
+ from veto import Veto
46
+
47
+ # 1. Define your tools normally
48
+ my_tools = [
49
+ {"name": "my_tool", "handler": my_handler, ...},
50
+ # ...
51
+ ]
52
+
53
+ # 2. Initialize Veto
54
+ veto = await Veto.init()
55
+
56
+ # 3. Wrap tools (Validation logic is injected)
57
+ wrapped_tools = veto.wrap(my_tools)
58
+
59
+ # 4. Pass to your Agent/LLM
60
+ agent = create_agent(
61
+ tools=wrapped_tools,
62
+ # ...
63
+ )
64
+ ```
65
+
66
+ ### 3. Configure Rules
67
+
68
+ Edit `veto/rules/financial.yaml` (example):
69
+
70
+ ```yaml
71
+ rules:
72
+ - id: limit-transfers
73
+ name: Limit large transfers
74
+ action: block
75
+ tools:
76
+ - transfer_funds
77
+ conditions:
78
+ - field: arguments.amount
79
+ operator: greater_than
80
+ value: 1000
81
+ ```
82
+
83
+ ## Configuration
84
+
85
+ ### veto.config.yaml
86
+
87
+ ```yaml
88
+ version: "1.0"
89
+
90
+ # Operating mode
91
+ mode: "strict" # "strict" blocks calls, "log" only logs them
92
+
93
+ # Validation Backend
94
+ validation:
95
+ mode: "custom" # "api" or "custom"
96
+
97
+ # Custom Provider (if mode is custom)
98
+ custom:
99
+ provider: "gemini" # or openai, anthropic
100
+ model: "gemini-3-flash-preview"
101
+
102
+ # Logging
103
+ logging:
104
+ level: "info"
105
+
106
+ # Rules
107
+ rules:
108
+ directory: "./rules"
109
+ recursive: true
110
+ ```
111
+
112
+ ## API Reference
113
+
114
+ ### `Veto.init(options?)`
115
+
116
+ Initialize Veto. Loads configuration from `./veto` by default.
117
+
118
+ ```python
119
+ veto = await Veto.init()
120
+ ```
121
+
122
+ ### `veto.wrap(tools)`
123
+
124
+ Wraps an array of tools. The returned tools have Veto validation injected into their execution handler.
125
+
126
+ ```python
127
+ wrapped_tools = veto.wrap(my_tools)
128
+ ```
129
+
130
+ ### `veto.wrap_tool(tool)`
131
+
132
+ Wraps a single tool instance.
133
+
134
+ ```python
135
+ safe_tool = veto.wrap_tool(my_tool)
136
+ ```
137
+
138
+ ### `veto.get_history_stats()`
139
+
140
+ Returns statistics about allowed vs blocked calls.
141
+
142
+ ```python
143
+ stats = veto.get_history_stats()
144
+ print(stats)
145
+ # {"total_calls": 5, "allowed_calls": 4, "denied_calls": 1, ...}
146
+ ```
147
+
148
+ ### `veto.clear_history()`
149
+
150
+ Resets the history statistics.
151
+
152
+ ```python
153
+ veto.clear_history()
154
+ ```
155
+
156
+ ## CLI Commands
157
+
158
+ | Command | Description |
159
+ |---------|-------------|
160
+ | `veto init` | Initialize Veto in current directory |
161
+ | `veto version` | Show version |
162
+
163
+ ## License
164
+
165
+ MIT
@@ -0,0 +1,2 @@
1
+ # Required: Gemini API key for LLM validation
2
+ GEMINI_API_KEY=your-gemini-api-key-here
@@ -0,0 +1,30 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Virtual environments
7
+ venv/
8
+ .venv/
9
+ ENV/
10
+
11
+ # Environment files
12
+ .env
13
+ .env.local
14
+
15
+ # IDE
16
+ .idea/
17
+ .vscode/
18
+ *.swp
19
+ *.swo
20
+
21
+ # OS
22
+ .DS_Store
23
+ Thumbs.db
24
+
25
+ # Testing
26
+ .pytest_cache/
27
+ .coverage
28
+
29
+ # Logs
30
+ *.log
@@ -0,0 +1,49 @@
1
+ # DevOps Pipeline Agent Example
2
+
3
+ CI/CD pipeline automation agent with Veto guardrails protecting production deployments.
4
+
5
+ ## Use Case
6
+
7
+ DevOps teams use AI agents to automate infrastructure operations. Without guardrails, agents could:
8
+ - Deploy to production without approval
9
+ - Run destructive commands on servers
10
+ - Access sensitive credentials
11
+
12
+ Veto validates every operation against security policies.
13
+
14
+ ## Features Demonstrated
15
+
16
+ - **Strict mode** — Blocks production deployments
17
+ - **Environment protection** — Staging allowed, production blocked
18
+ - **Safe rollbacks** — Always permitted for incident response
19
+
20
+ ## Setup
21
+
22
+ 1. Create virtual environment:
23
+ ```bash
24
+ python -m venv venv
25
+ source venv/bin/activate # On Windows: venv\Scripts\activate
26
+ ```
27
+
28
+ 2. Install dependencies:
29
+ ```bash
30
+ pip install -r requirements.txt
31
+ ```
32
+
33
+ 3. Configure environment:
34
+ ```bash
35
+ cp .env.example .env
36
+ # Edit .env with your GEMINI_API_KEY
37
+ ```
38
+
39
+ 4. Run the agent:
40
+ ```bash
41
+ python devops_pipeline_agent.py
42
+ ```
43
+
44
+ ## Veto Rules
45
+
46
+ See `veto/rules/deployments.yaml`:
47
+ - Blocks production deployments
48
+ - Allows staging deployments
49
+ - Always allows rollback and monitoring operations