actionrail 0.1.0b7__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 (77) hide show
  1. actionrail-0.1.0b7/LICENSE +201 -0
  2. actionrail-0.1.0b7/NOTICE +6 -0
  3. actionrail-0.1.0b7/PKG-INFO +483 -0
  4. actionrail-0.1.0b7/README.md +434 -0
  5. actionrail-0.1.0b7/actionrail/__init__.py +29 -0
  6. actionrail-0.1.0b7/actionrail/cli.py +82 -0
  7. actionrail-0.1.0b7/actionrail/mcp_quickstart.py +193 -0
  8. actionrail-0.1.0b7/actionrail/quickstart.py +207 -0
  9. actionrail-0.1.0b7/actionrail/sdk/__init__.py +47 -0
  10. actionrail-0.1.0b7/actionrail/sdk/action_tests.py +276 -0
  11. actionrail-0.1.0b7/actionrail/sdk/actions.py +86 -0
  12. actionrail-0.1.0b7/actionrail/sdk/config.py +123 -0
  13. actionrail-0.1.0b7/actionrail/sdk/config_cache.py +92 -0
  14. actionrail-0.1.0b7/actionrail/sdk/context.py +66 -0
  15. actionrail-0.1.0b7/actionrail/sdk/enforce.py +310 -0
  16. actionrail-0.1.0b7/actionrail/sdk/grounding/__init__.py +18 -0
  17. actionrail-0.1.0b7/actionrail/sdk/grounding/base.py +23 -0
  18. actionrail-0.1.0b7/actionrail/sdk/grounding/http.py +88 -0
  19. actionrail-0.1.0b7/actionrail/sdk/grounding/match.py +164 -0
  20. actionrail-0.1.0b7/actionrail/sdk/grounding/mcp.py +222 -0
  21. actionrail-0.1.0b7/actionrail/sdk/grounding/mysql.py +139 -0
  22. actionrail-0.1.0b7/actionrail/sdk/grounding/postgres.py +123 -0
  23. actionrail-0.1.0b7/actionrail/sdk/grounding/sqlite.py +39 -0
  24. actionrail-0.1.0b7/actionrail/sdk/instrument.py +59 -0
  25. actionrail-0.1.0b7/actionrail/sdk/lifecycle.py +83 -0
  26. actionrail-0.1.0b7/actionrail/sdk/numeric.py +24 -0
  27. actionrail-0.1.0b7/actionrail/sdk/outbox.py +81 -0
  28. actionrail-0.1.0b7/actionrail/sdk/pipeline.py +230 -0
  29. actionrail-0.1.0b7/actionrail/sdk/policy.py +52 -0
  30. actionrail-0.1.0b7/actionrail/sdk/privacy.py +30 -0
  31. actionrail-0.1.0b7/actionrail/sdk/report.py +332 -0
  32. actionrail-0.1.0b7/actionrail/sdk/review.py +107 -0
  33. actionrail-0.1.0b7/actionrail/sdk/rule_validation.py +406 -0
  34. actionrail-0.1.0b7/actionrail/sdk/runtime.py +428 -0
  35. actionrail-0.1.0b7/actionrail/sdk/runtime_config.py +172 -0
  36. actionrail-0.1.0b7/actionrail/sdk/safewrite.py +36 -0
  37. actionrail-0.1.0b7/actionrail/sdk/scanner.py +212 -0
  38. actionrail-0.1.0b7/actionrail/sdk/state.py +28 -0
  39. actionrail-0.1.0b7/actionrail/sdk/telemetry.py +131 -0
  40. actionrail-0.1.0b7/actionrail.egg-info/PKG-INFO +483 -0
  41. actionrail-0.1.0b7/actionrail.egg-info/SOURCES.txt +75 -0
  42. actionrail-0.1.0b7/actionrail.egg-info/dependency_links.txt +1 -0
  43. actionrail-0.1.0b7/actionrail.egg-info/entry_points.txt +4 -0
  44. actionrail-0.1.0b7/actionrail.egg-info/requires.txt +26 -0
  45. actionrail-0.1.0b7/actionrail.egg-info/top_level.txt +1 -0
  46. actionrail-0.1.0b7/pyproject.toml +99 -0
  47. actionrail-0.1.0b7/setup.cfg +4 -0
  48. actionrail-0.1.0b7/tests/test_action_tests.py +393 -0
  49. actionrail-0.1.0b7/tests/test_build_beta_wheels.py +124 -0
  50. actionrail-0.1.0b7/tests/test_control_plane.py +1097 -0
  51. actionrail-0.1.0b7/tests/test_domains.py +18 -0
  52. actionrail-0.1.0b7/tests/test_enforce.py +452 -0
  53. actionrail-0.1.0b7/tests/test_framework_neutral_example.py +9 -0
  54. actionrail-0.1.0b7/tests/test_http_source.py +107 -0
  55. actionrail-0.1.0b7/tests/test_langgraph_quickstart.py +87 -0
  56. actionrail-0.1.0b7/tests/test_mcp_quickstart.py +17 -0
  57. actionrail-0.1.0b7/tests/test_mcp_source.py +228 -0
  58. actionrail-0.1.0b7/tests/test_mysql_source.py +229 -0
  59. actionrail-0.1.0b7/tests/test_operators.py +114 -0
  60. actionrail-0.1.0b7/tests/test_pipeline.py +444 -0
  61. actionrail-0.1.0b7/tests/test_policy.py +73 -0
  62. actionrail-0.1.0b7/tests/test_policy_validation.py +31 -0
  63. actionrail-0.1.0b7/tests/test_postgres_source.py +207 -0
  64. actionrail-0.1.0b7/tests/test_public_branding.py +90 -0
  65. actionrail-0.1.0b7/tests/test_real_agent_graphs.py +243 -0
  66. actionrail-0.1.0b7/tests/test_release_version.py +12 -0
  67. actionrail-0.1.0b7/tests/test_reporter.py +187 -0
  68. actionrail-0.1.0b7/tests/test_reporting_privacy.py +120 -0
  69. actionrail-0.1.0b7/tests/test_review.py +170 -0
  70. actionrail-0.1.0b7/tests/test_review_integration.py +138 -0
  71. actionrail-0.1.0b7/tests/test_rule_validation.py +281 -0
  72. actionrail-0.1.0b7/tests/test_runtime.py +612 -0
  73. actionrail-0.1.0b7/tests/test_safety_properties.py +322 -0
  74. actionrail-0.1.0b7/tests/test_sdk_support.py +273 -0
  75. actionrail-0.1.0b7/tests/test_source.py +100 -0
  76. actionrail-0.1.0b7/tests/test_telemetry.py +285 -0
  77. actionrail-0.1.0b7/tests/test_trusted_context.py +123 -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,6 @@
1
+ ActionRail
2
+ Copyright 2026 ToolJet Solutions, Inc.
3
+
4
+ This product includes software developed by ToolJet Solutions, Inc.
5
+
6
+ ActionRail and the ActionRail logo are trademarks of ToolJet Solutions, Inc.
@@ -0,0 +1,483 @@
1
+ Metadata-Version: 2.4
2
+ Name: actionrail
3
+ Version: 0.1.0b7
4
+ Summary: Action control for AI agents — verify what an agent is about to do before it does it.
5
+ Author: ToolJet
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://actionrail.ai
8
+ Project-URL: Documentation, https://actionrail.ai/docs/intro
9
+ Project-URL: Repository, https://github.com/ToolJet/ActionRail
10
+ Project-URL: Issues, https://github.com/ToolJet/ActionRail/issues
11
+ Project-URL: Changelog, https://github.com/ToolJet/ActionRail/blob/master/CHANGELOG.md
12
+ Keywords: ai-agents,langgraph,llm,guardrails,tool-calling,authorization
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Topic :: Security
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ License-File: NOTICE
26
+ Requires-Dist: httpx>=0.27
27
+ Requires-Dist: pyyaml>=6
28
+ Requires-Dist: mcp<2,>=1.24
29
+ Requires-Dist: psycopg<4,>=3.2
30
+ Requires-Dist: PyMySQL<2,>=1.1
31
+ Provides-Extra: agents
32
+ Requires-Dist: langchain-core>=0.3; extra == "agents"
33
+ Requires-Dist: langgraph>=0.2; extra == "agents"
34
+ Requires-Dist: langchain-anthropic>=0.2; extra == "agents"
35
+ Requires-Dist: python-dotenv>=1.0; extra == "agents"
36
+ Provides-Extra: control-plane
37
+ Requires-Dist: django>=5.0; extra == "control-plane"
38
+ Requires-Dist: djangorestframework>=3.15; extra == "control-plane"
39
+ Requires-Dist: django-cors-headers>=4.4; extra == "control-plane"
40
+ Provides-Extra: dev
41
+ Requires-Dist: hypothesis<7,>=6.100; extra == "dev"
42
+ Requires-Dist: mutmut<4,>=3.6; extra == "dev"
43
+ Requires-Dist: pytest>=8; extra == "dev"
44
+ Requires-Dist: pytest-cov<8,>=7; extra == "dev"
45
+ Requires-Dist: pytest-django>=4.9; extra == "dev"
46
+ Provides-Extra: postgres-binary
47
+ Requires-Dist: psycopg-binary<4,>=3.2; extra == "postgres-binary"
48
+ Dynamic: license-file
49
+
50
+ # ActionRail
51
+
52
+ **Verify what an AI agent is about to _do_ — before it does it.**
53
+
54
+ ActionRail is an open-source project by [ToolJet](https://www.tooljet.com).
55
+
56
+ > **Release status:** ActionRail is currently in public beta. Interfaces may
57
+ > evolve before ActionRail v1, which is planned for August 2026.
58
+
59
+ > **Integration support:** Any Python application can use the framework-neutral
60
+ > `ActionRuntime`. LangGraph also has automatic tool discovery and wrapping;
61
+ > additional automatic framework adapters are planned.
62
+
63
+ An agent's tool call can be perfectly *permitted* and perfectly *well-formed* and
64
+ still be *wrong*: a refund on an order that was already refunded, a transfer to a
65
+ real account that belongs to the wrong customer, a withdrawal larger than the
66
+ balance. Allowlists and schema checks pass all of these, because the *shape* is
67
+ fine — it's the *value* that's wrong.
68
+
69
+ ActionRail intercepts an agent's consequential tool calls and, before execution,
70
+ grounds each argument **against your live system of record** — then returns
71
+ **allow / hold-for-human / block**. It's the last-mile correctness gate: not "is
72
+ the agent allowed to do this?" but "is this specific value actually right, right
73
+ now, against your real data?"
74
+
75
+ ![ActionRail verifies an agent tool call against live systems of record before allowing execution](docs/static/img/actionrail-runtime-gate.svg)
76
+
77
+ *ActionRail runs at the execution boundary. Source lookups and credentials stay
78
+ in the customer environment, and the tool runs only after an `allow` decision.*
79
+
80
+ ## Choose an integration path
81
+
82
+ The ActionRail runtime is framework-neutral. LangGraph is the first adapter
83
+ that adds automatic tool discovery and wrapping.
84
+
85
+ | Your application | Integration | Start here |
86
+ | --- | --- | --- |
87
+ | Any Python agent, worker, API, or application | Explicit `ActionRuntime` boundary | [Direct Python guide](https://actionrail.ai/docs/sdk/framework-neutral/) |
88
+ | LangGraph | Automatic discovery and tool wrapping | [LangGraph quickstart](https://actionrail.ai/docs/getting-started/quickstart/) |
89
+
90
+ ### Any Python application
91
+
92
+ Install the base SDK, create an agent and its actions in the Console, then put
93
+ `ActionRuntime` around the real operation:
94
+
95
+ ```bash
96
+ python -m pip install actionrail actionrail-console
97
+ ```
98
+
99
+ ```python
100
+ from actionrail import ActionRuntime
101
+
102
+ runtime = ActionRuntime(
103
+ agent_id="…",
104
+ api_key="ark_…",
105
+ )
106
+
107
+ result = runtime.execute(
108
+ "issue_refund",
109
+ {"order_id": order_id, "amount": amount},
110
+ issue_refund,
111
+ context={"customer_id": authenticated_customer_id},
112
+ )
113
+ ```
114
+
115
+ `execute()` invokes `issue_refund(**arguments)` only after authorization. Use
116
+ the same API in custom agent loops, workers, API handlers, or frameworks without
117
+ a dedicated adapter. See the [direct Python integration](https://actionrail.ai/docs/sdk/framework-neutral/).
118
+
119
+ ### LangGraph automatic adapter
120
+
121
+ Use `enforce()` when you want ActionRail to discover and wrap a compiled
122
+ LangGraph agent's tools:
123
+
124
+ ```python
125
+ from actionrail import enforce, trusted_context
126
+ from actionrail.sdk.grounding import SQLiteSource
127
+
128
+ agent = enforce(
129
+ agent,
130
+ agent_id="…",
131
+ api_key="ark_…",
132
+ sources={"billing": SQLiteSource("billing.db")},
133
+ )
134
+ with trusted_context(customer_id="C-1007"):
135
+ agent.invoke(inputs)
136
+ # wire_money(account="1234567") -> blocked before the underlying tool runs
137
+ ```
138
+
139
+ Detailed reasons remain available to local application code through the
140
+ `on_decision` callback. The model-facing tool result, outbound Activity, and
141
+ review records use separate value-free representations.
142
+
143
+ ### Run the packaged LangGraph demo
144
+
145
+ The complete deterministic demo needs no model API key:
146
+
147
+ ```bash
148
+ python3 -m venv .venv
149
+ source .venv/bin/activate
150
+ python -m pip install "actionrail[agents]" actionrail-console
151
+ actionrail-console --no-open
152
+ ```
153
+
154
+ In a second terminal:
155
+
156
+ ```bash
157
+ source .venv/bin/activate
158
+ actionrail-quickstart
159
+ ```
160
+
161
+ The demo creates a local SQLite Source, installs a grounding rule, attempts a
162
+ cross-customer refund, proves the real tool did not execute, and verifies the
163
+ redacted block in Activity. Open `http://127.0.0.1:8020/activity` to inspect it.
164
+
165
+ ## Why it's different
166
+
167
+ Policy engines and authz (OPA, Cedar, ReBAC) decide whether an action is
168
+ *permitted* given facts you've pre-loaded. By design they don't reach out to a
169
+ live system and check a value at call time — Cedar, for instance, is a
170
+ side-effect-free language with no I/O. ActionRail fills exactly that gap: it
171
+ queries your real data at the moment of the call and verifies the argument.
172
+
173
+ | Check | Answers | ActionRail |
174
+ |---|---|---|
175
+ | Allowlist / schema | is the call *well-formed*? | — |
176
+ | Policy / authz | is the agent *permitted*? | — |
177
+ | **Grounding** | is the *value* correct vs. live data? | ✅ |
178
+
179
+ ## The decision pipeline
180
+
181
+ `decide()` runs cheapest-check-first and returns `allow` / `hold` / `block`
182
+ (block outranks hold outranks allow):
183
+
184
+ | Tier | Check | Example |
185
+ |---|---|---|
186
+ | **Policy** | deterministic expression | `amount <= 200` → over limit *holds* for a human |
187
+ | **Grounding** | value vs. system of record | account must exist, belong to the caller, and be in a refundable state → mismatch *blocks* |
188
+
189
+ Grounding is expressive: multiple checks ANDed across different Sources, each
190
+ comparing a returned field with an operator (`= ≠ > ≥ < ≤ contains, is one of, is
191
+ set, is empty`) against a caller-context value, a literal, **another argument**
192
+ (`balance ≥ amount`), or the **current time** (`delivered_at ≥ now-30d`). Checks
193
+ can require a row (`expect: row`) or its *absence* (`expect: absent`, for
194
+ blocklists / idempotency), bind query params by name (`:customer_id` in SQLite,
195
+ `%(customer_id)s` in PostgreSQL/MySQL), and carry a retry + fail-open/closed policy.
196
+
197
+ ## Action Tests: rules as executable contracts
198
+
199
+ Commit expected action behavior alongside your rules and run it through the
200
+ same decision pipeline used in production:
201
+
202
+ ```yaml
203
+ # actionrail.cases.yaml
204
+ schema_version: 1
205
+ cases:
206
+ - name: cross-customer refund is blocked
207
+ tool: issue_refund
208
+ args: {order_id: order-100, amount: 75}
209
+ context: {customer_id: customer-2}
210
+ expect: block
211
+ fixtures:
212
+ billing-production:
213
+ by_value:
214
+ order-100: {customer_id: customer-1, status: delivered}
215
+ ```
216
+
217
+ ```bash
218
+ actionrail test
219
+ # PASS cross-customer refund is blocked
220
+ # 1 passed · 0 failed
221
+ ```
222
+
223
+ **Action Tests** make `allow`, `hold`, and `block` a reviewable CI contract.
224
+ Deterministic Source fixtures exercise the real policy evaluator and grounding
225
+ matcher without a model, Console, credentials, or network access. Production
226
+ Sources remain off unless a separate integration stage explicitly passes
227
+ `--live-sources`. See the [Action Tests guide](docs/docs/testing/action-tests.mdx)
228
+ or run the complete contract in [`examples/action_tests/`](examples/action_tests/).
229
+
230
+ ## Sources
231
+
232
+ Grounding runs against sources that stay in your environment (the data plane
233
+ never leaves your VPC). Today: **SQLite**, **PostgreSQL**, **MySQL/MariaDB**,
234
+ **HTTP/REST**, and **MCP gateway** adapters. MCP Sources call a configured verification tool over
235
+ Streamable HTTP, require its `readOnlyHint`, and prefer structured tool output. Secrets are
236
+ written as `${env:VAR}` references and resolve locally, so credentials never
237
+ reach the control plane. Use a gateway identity that can invoke only read tools;
238
+ MCP annotations are hints, not an authorization boundary.
239
+
240
+ ```yaml
241
+ sources:
242
+ stripe-production:
243
+ adapter: mcp
244
+ endpoint: https://gateway.internal/mcp
245
+ headers:
246
+ Authorization: Bearer ${env:MCP_GATEWAY_TOKEN}
247
+ tool: stripe.get_charge
248
+ arguments:
249
+ charge_id: "{value}"
250
+ select: data.charge
251
+ timeout: 10
252
+ require_read_only: true
253
+ ```
254
+
255
+ This keeps MCP connection details on the Source. Rules reference the Source and
256
+ only describe how to evaluate the returned record; they do not duplicate the
257
+ gateway endpoint, tool name, or argument mapping.
258
+
259
+ PostgreSQL Sources keep connection details on the Source and queries on rules.
260
+ Use a dedicated role with `SELECT`-only permissions. ActionRail also forces each
261
+ verification transaction into PostgreSQL read-only mode and applies connection
262
+ and statement timeouts. Queries use Psycopg named parameters such as
263
+ `%(value)s`, `%(amount)s`, and `%(customer_id)s`:
264
+
265
+ ```yaml
266
+ sources:
267
+ billing-production:
268
+ adapter: postgres
269
+ host: postgres.internal
270
+ port: 5432
271
+ dbname: billing
272
+ user: actionrail_reader
273
+ password: ${env:POSTGRES_PASSWORD}
274
+ sslmode: verify-full
275
+ sslrootcert: /etc/ssl/certs/postgres-ca.pem
276
+ connect_timeout: 5
277
+ statement_timeout_ms: 5000
278
+ require_read_only: true
279
+ ```
280
+
281
+ The SDK depends on the Psycopg interface, leaving the libpq implementation to
282
+ the host application. For a self-contained local install, add
283
+ `psycopg[binary]>=3.2,<4`; production environments can use the system-linked
284
+ `psycopg[c]` build instead.
285
+
286
+ MySQL and MariaDB Sources use the same named query parameters and enforce
287
+ `START TRANSACTION READ ONLY` for every check. PyMySQL is included with the SDK:
288
+
289
+ ```yaml
290
+ sources:
291
+ billing-mysql:
292
+ adapter: mysql
293
+ host: mysql.internal
294
+ port: 3306
295
+ database: billing
296
+ user: actionrail_reader
297
+ password: ${env:MYSQL_PASSWORD}
298
+ ssl_mode: verify-identity
299
+ ssl_ca: /etc/ssl/certs/mysql-ca.pem
300
+ connect_timeout: 5
301
+ query_timeout: 5
302
+ require_read_only: true
303
+ ```
304
+
305
+ ## Control plane + Console
306
+
307
+ An optional Django + DRF control plane and React Console let you register
308
+ sources, author grounding rules per argument, and watch a live **Activity
309
+ feed** of every allow / hold / block the runtime made. The SDK reports metadata
310
+ only — tool names, outcomes, value-free reasons, and redacted previews. Detailed
311
+ grounding results and rendered previews are exposed only on the local `Decision`;
312
+ model-facing tool results receive their own fully redacted representation. Preview
313
+ placeholders in control-plane reports become `[redacted]` unless a rule explicitly
314
+ allowlists a field with `write.report_args`; source-record values are never exported. Runtime reports use
315
+ a bounded, local SQLite outbox with batching, retry backoff, saturation
316
+ backpressure, and a normal-shutdown flush. Events are committed before the SDK
317
+ accepts them, stable IDs make retries idempotent, and delivery resumes after a
318
+ process restart. The outbox contains metadata but never the agent key and is
319
+ stored under `~/.actionrail/sdk/` by default; set `ACTIONRAIL_SDK_STATE_DIR` or
320
+ pass `state_dir=` to choose another location. Call `close_reporting(agent)` from
321
+ your application shutdown hook. A `False` result means rows remain durably
322
+ pending for the next process rather than being discarded.
323
+
324
+ Argument reporting is explicit and field-level; everything else remains
325
+ redacted:
326
+
327
+ ```yaml
328
+ write:
329
+ preview: "Refund order {order_id} for {amount}"
330
+ report_args: [amount] # explicit opt-in; order_id remains [redacted]
331
+ ```
332
+
333
+ Expose `get_runtime_health(agent)` from your application health endpoint to see
334
+ whether the SDK is using cached configuration, how stale its last validated
335
+ snapshot is, and whether audit rows are pending after a delivery failure.
336
+
337
+ Human-review actions always fail closed when the Console cannot be reached. The
338
+ model-facing result uses `ACTIONRAIL_REVIEW_UNAVAILABLE`, distinct from a normal
339
+ pending review or human rejection, and the underlying tool is never executed.
340
+
341
+ Remote enforcement accepts cached configuration for up to 24 hours by default.
342
+ After `max_config_staleness` is exceeded, enforcing-mode tool calls fail closed with
343
+ `ACTIONRAIL_CONFIG_STALE` until a refresh succeeds. Set the limit in seconds on
344
+ `enforce(...)`; pass `None` only when your deployment explicitly accepts
345
+ unbounded configuration staleness.
346
+
347
+ ## Anonymous usage telemetry
348
+
349
+ The OSS Console and SDK send three allowlisted events to
350
+ `https://hub.actionrail.ai/v1/events`: `console_started`, `sdk_initialized`, and
351
+ one `usage_summary` snapshot per UTC day. The summary contains exact totals
352
+ for configured and active agents, observed and evaluated actions, and actions
353
+ monitored, allowed, blocked, or held. Events also contain a locally generated
354
+ anonymous installation UUID, package version, Python major/minor version, and
355
+ operating-system family. They never contain agent or tool identities, rules,
356
+ arguments, individual decisions, Source configuration, endpoints, credentials,
357
+ audit records, paths, or errors.
358
+
359
+ Disable telemetry before starting the Console or agent process:
360
+
361
+ ```bash
362
+ export ACTIONRAIL_TELEMETRY_DISABLED=1
363
+ ```
364
+
365
+ `DO_NOT_TRACK=1` and `CI=1` are also honored. Delivery has a one-second timeout
366
+ and cannot affect enforcement or startup. Lifecycle events are best-effort. The
367
+ Console persists at most one aggregate-only usage summary for an hourly retry;
368
+ it never queues individual activity. See [Anonymous telemetry](docs/docs/security/telemetry.mdx)
369
+ for the complete event schema, counter definitions, and identifier lifecycle.
370
+
371
+ See [Runtime availability and failure behavior](docs/docs/operations/runtime-availability.mdx)
372
+ for the complete startup, outage, recovery, review, and shutdown contract.
373
+
374
+ ## Development
375
+
376
+ Contributors using an editable repository checkout can run the packaged
377
+ quickstart implementation through `python examples/langgraph_quickstart.py`.
378
+
379
+ For development and the full test suite:
380
+
381
+ ```bash
382
+ uv pip install -e ".[dev,control-plane]" # SDK + tests + control plane
383
+ pytest # run the suite
384
+ ```
385
+
386
+ To run the development Console:
387
+
388
+ ```bash
389
+ python control-plane/manage.py migrate && python control-plane/manage.py runserver 8020
390
+ cd frontend && npm install && npm run dev # http://localhost:5173
391
+ ```
392
+
393
+ To build the two beta wheels for manual distribution:
394
+
395
+ ```bash
396
+ python scripts/build_beta_wheels.py
397
+ # dist/actionrail-0.1.0b7-py3-none-any.whl
398
+ # dist/actionrail_console-0.1.0b7-py3-none-any.whl
399
+ # dist/SHA256SUMS
400
+ ```
401
+
402
+ Install both wheels, then start the self-contained local Console:
403
+
404
+ ```bash
405
+ python -m pip install dist/actionrail-*.whl dist/actionrail_console-*.whl
406
+ actionrail-console
407
+ ```
408
+
409
+ ### Documentation site
410
+
411
+ The Docusaurus site lives in `docs/`:
412
+
413
+ ```bash
414
+ cd docs
415
+ npm ci
416
+ npm start
417
+ ```
418
+
419
+ Run the production build and broken-link checks with:
420
+
421
+ ```bash
422
+ npm run build
423
+ ```
424
+
425
+ See [`docs/README.md`](docs/README.md) for deployment variables, optional Algolia
426
+ search, site structure, and contribution conventions.
427
+
428
+ ## Repository layout
429
+
430
+ ```
431
+ actionrail/sdk/
432
+ runtime.py # framework-neutral evaluate / execute boundary
433
+ actions.py # explicit, privacy-safe action definitions
434
+ action_tests.py # versioned allow / hold / block regression contracts
435
+ scanner.py # zero-config action-surface discovery on a LangGraph agent
436
+ instrument.py # report the surface + observed calls to the control plane
437
+ enforce.py # the runtime gate: wrap consequential tools, decide before they run
438
+ pipeline.py # policy -> grounding -> allow / hold / block
439
+ policy.py # tier-1 deterministic policy
440
+ config.py # rule config + Source adapter build (with ${env:VAR} resolution)
441
+ report.py # metadata-only client to the control plane
442
+ safewrite.py # dry-run preview + transactional rollback (reversible sinks)
443
+ grounding/
444
+ base.py # Source protocol + GroundVerdict
445
+ match.py # shared condition matcher (operators, ctx/arg/now targets)
446
+ sqlite.py # SQLite source adapter
447
+ http.py # HTTP/REST source adapter
448
+ mcp.py # MCP gateway source adapter (read-only tools)
449
+ postgres.py # PostgreSQL source adapter (read-only transactions)
450
+ mysql.py # MySQL/MariaDB source adapter (read-only transactions)
451
+ actionrail/cli.py # `actionrail test` framework CLI
452
+ control-plane/ # Django + DRF: agents, rules, sources, decision feed
453
+ frontend/ # React console
454
+ tests/ # pytest suite (grounding, pipeline, domains, SDK, control plane)
455
+ examples/ # runnable deterministic integrations
456
+ ```
457
+
458
+ ## Project status
459
+
460
+ **Public beta:** the framework-neutral `ActionRuntime`, LangGraph discovery and
461
+ `enforce()` adapter, policy + grounding pipeline, deterministic Action Tests,
462
+ SQLite + PostgreSQL + MySQL + HTTP + MCP Sources, control plane, and Console are
463
+ implemented and covered by the test suite.
464
+
465
+ **Roadmap:** provenance and taint tracking for values from untrusted memory,
466
+ additional agent-framework integrations, and more vendor-specific Source
467
+ adapters. ActionRail v1 is planned for August 2026.
468
+
469
+ ## Contributing and support
470
+
471
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, safety-critical
472
+ change requirements, and pull-request guidance. Usage questions and bug-report
473
+ routing are documented in [SUPPORT.md](SUPPORT.md). Security reports must follow
474
+ [SECURITY.md](SECURITY.md).
475
+
476
+ Release changes are tracked in [CHANGELOG.md](CHANGELOG.md). Participation in
477
+ the project is governed by the [Code of Conduct](CODE_OF_CONDUCT.md).
478
+
479
+ ## License
480
+
481
+ ActionRail is licensed under the [Apache License 2.0](LICENSE).
482
+
483
+ Copyright 2026 ToolJet Solutions, Inc.