abintegro 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 (58) hide show
  1. abintegro-0.1.0/LICENSE +202 -0
  2. abintegro-0.1.0/MANIFEST.in +2 -0
  3. abintegro-0.1.0/PKG-INFO +112 -0
  4. abintegro-0.1.0/README.md +77 -0
  5. abintegro-0.1.0/abintegro/__init__.py +156 -0
  6. abintegro-0.1.0/abintegro/__main__.py +16 -0
  7. abintegro-0.1.0/abintegro/ai.py +543 -0
  8. abintegro-0.1.0/abintegro/audit.py +227 -0
  9. abintegro-0.1.0/abintegro/bi.py +667 -0
  10. abintegro-0.1.0/abintegro/catalog.py +231 -0
  11. abintegro-0.1.0/abintegro/cli.py +1122 -0
  12. abintegro-0.1.0/abintegro/config.py +653 -0
  13. abintegro-0.1.0/abintegro/connector.py +2527 -0
  14. abintegro-0.1.0/abintegro/credentials.py +724 -0
  15. abintegro-0.1.0/abintegro/ctx.py +818 -0
  16. abintegro-0.1.0/abintegro/errors.py +391 -0
  17. abintegro-0.1.0/abintegro/guardrails.py +200 -0
  18. abintegro-0.1.0/abintegro/lookup.py +164 -0
  19. abintegro-0.1.0/abintegro/manifest.py +474 -0
  20. abintegro-0.1.0/abintegro/notifications.py +641 -0
  21. abintegro-0.1.0/abintegro/policy.py +169 -0
  22. abintegro-0.1.0/abintegro/probe.py +183 -0
  23. abintegro-0.1.0/abintegro/py.typed +0 -0
  24. abintegro-0.1.0/abintegro/queue.py +216 -0
  25. abintegro-0.1.0/abintegro/runner.py +1580 -0
  26. abintegro-0.1.0/abintegro/service.py +474 -0
  27. abintegro-0.1.0/abintegro/state.py +124 -0
  28. abintegro-0.1.0/abintegro/store.py +330 -0
  29. abintegro-0.1.0/abintegro/suggestion.py +687 -0
  30. abintegro-0.1.0/abintegro/task.py +118 -0
  31. abintegro-0.1.0/abintegro/tenant_secret.py +781 -0
  32. abintegro-0.1.0/abintegro/testing.py +112 -0
  33. abintegro-0.1.0/abintegro/warehouse.py +573 -0
  34. abintegro-0.1.0/abintegro/webhooks.py +338 -0
  35. abintegro-0.1.0/abintegro.egg-info/PKG-INFO +112 -0
  36. abintegro-0.1.0/abintegro.egg-info/SOURCES.txt +56 -0
  37. abintegro-0.1.0/abintegro.egg-info/dependency_links.txt +1 -0
  38. abintegro-0.1.0/abintegro.egg-info/entry_points.txt +2 -0
  39. abintegro-0.1.0/abintegro.egg-info/requires.txt +19 -0
  40. abintegro-0.1.0/abintegro.egg-info/top_level.txt +2 -0
  41. abintegro-0.1.0/abintegro_ai/__init__.py +108 -0
  42. abintegro-0.1.0/abintegro_ai/decisions.py +605 -0
  43. abintegro-0.1.0/abintegro_ai/errors.py +38 -0
  44. abintegro-0.1.0/abintegro_ai/loop.py +125 -0
  45. abintegro-0.1.0/abintegro_ai/metric.py +100 -0
  46. abintegro-0.1.0/abintegro_ai/providers/__init__.py +237 -0
  47. abintegro-0.1.0/abintegro_ai/providers/_http.py +70 -0
  48. abintegro-0.1.0/abintegro_ai/providers/anthropic.py +247 -0
  49. abintegro-0.1.0/abintegro_ai/providers/openai.py +237 -0
  50. abintegro-0.1.0/abintegro_ai/providers/vertex.py +420 -0
  51. abintegro-0.1.0/abintegro_ai/py.typed +0 -0
  52. abintegro-0.1.0/abintegro_ai/report.py +272 -0
  53. abintegro-0.1.0/abintegro_ai/retry.py +43 -0
  54. abintegro-0.1.0/abintegro_ai/schema.py +229 -0
  55. abintegro-0.1.0/abintegro_ai/thinking.py +142 -0
  56. abintegro-0.1.0/abintegro_ai/types.py +130 -0
  57. abintegro-0.1.0/pyproject.toml +65 -0
  58. abintegro-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,2 @@
1
+ # The sdist carries the package, its licence and README; the tests stay in the repository.
2
+ prune tests
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.4
2
+ Name: abintegro
3
+ Version: 0.1.0
4
+ Summary: The ABIntegro runner SDK: connectors, tasks, policies and embedded AI for deterministic business automation.
5
+ Author: AB Software LTD
6
+ License-Expression: Apache-2.0
7
+ Keywords: automation,integration,workflow,connectors,sdk
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Framework :: AsyncIO
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Typing :: Typed
15
+ Requires-Python: >=3.13
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: fastapi>=0.141
19
+ Requires-Dist: google-auth>=2.53
20
+ Requires-Dist: google-cloud-bigquery>=3.40
21
+ Requires-Dist: google-cloud-firestore>=2.19
22
+ Requires-Dist: google-cloud-secret-manager>=2.20
23
+ Requires-Dist: google-genai<3,>=2.7
24
+ Requires-Dist: httpx>=0.28
25
+ Requires-Dist: mcp<3,>=2.2
26
+ Requires-Dist: pydantic>=2.12
27
+ Requires-Dist: PyYAML>=6.0
28
+ Requires-Dist: tzdata>=2024.1; sys_platform == "win32"
29
+ Requires-Dist: uvicorn>=0.53
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=8.3; extra == "dev"
32
+ Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
33
+ Requires-Dist: ruff>=0.7; extra == "dev"
34
+ Dynamic: license-file
35
+
36
+ # abintegro
37
+
38
+ The runner SDK of ABIntegro: deterministic business
39
+ automation, built with AI and secured by code.
40
+
41
+ A runner is a small repository of **connectors** (typed clients for the systems a business uses)
42
+ and **tasks** (plain async Python that reads from one system and writes to another). This
43
+ package is everything else: the task model, policies and guardrails enforced outside the task's
44
+ code, credentials the task never sees, proposals for a person to approve, state, a durable
45
+ queue, an append-only audit log, embedded AI calls with a fixed output shape, and the HTTP
46
+ service a runner deploys as.
47
+
48
+ ```
49
+ pip install abintegro
50
+ ```
51
+
52
+ Python 3.13 or later.
53
+
54
+ ## A task
55
+
56
+ ```python
57
+ from abintegro import ctx, parameter, permit, task
58
+ from connectors import school, zoom
59
+ from connectors.zoom.client import UserCreate
60
+
61
+
62
+ @task(id="enrollment_to_zoom", title="Zoom Licences for New Enrolments")
63
+ async def enrollment_to_zoom() -> None:
64
+ """Give every new student a licensed Zoom account."""
65
+ for e in await school.enrollments.since(ctx.state.get("cursor")):
66
+ spec = UserCreate(email=e.email, licences=[parameter("zoom_licence")])
67
+ if permit("users.create_with_licences"):
68
+ await zoom.users.create_with_licences(spec)
69
+ else:
70
+ ctx.suggest("zoom.users.create_with_licences", spec, key=str(e.id))
71
+ ctx.state["cursor"] = e.created_at
72
+ ```
73
+
74
+ - **No credentials in code.** A connector call is authenticated by the SDK from the tenant's
75
+ secret; the task holds a client, never a key.
76
+ - **Writes are permitted or proposed.** `permit` asks the policy the business set; anything not
77
+ permitted becomes a suggestion in the Inbox, with a before/after preview, for one person to
78
+ accept or reject.
79
+ - **Deterministic and convergent.** One connector call is one business action that is safe to
80
+ repeat; re-running a task repairs a partial failure. There are no steps to resume.
81
+ - **Guardrails outside the code.** Write, operation and token caps, execution windows,
82
+ allowed domains and accounts, and "never delete" are checked by the SDK on every call, whatever the task does.
83
+ - **Every action is audited.** Reads, writes, proposals, decisions and AI calls are recorded in
84
+ an append-only log.
85
+
86
+ `ctx.ai`, `ctx.decide`, `ctx.report`, `ctx.metric` and `ctx.lookup` add embedded AI with a fixed
87
+ output schema, yes/no and multiple-choice decisions, reports, dashboard figures and shared lookup
88
+ tables. The `abintegro_ai` package beside it holds the AI providers (Vertex AI, Gemini,
89
+ Anthropic, OpenAI and Langdock) behind one interface.
90
+
91
+ ## The command line
92
+
93
+ Run from a runner repository, next to its `connectors/` and `tasks/`:
94
+
95
+ ```
96
+ abintegro tasks # what is registered, and its trigger
97
+ abintegro run <task_id> # execute one task now
98
+ abintegro tick # one drain: schedules, webhook events, the queue
99
+ abintegro suggestions # proposed writes waiting on a person
100
+ abintegro accept <suggestion_id> # or reject
101
+ abintegro manifest build # derive each task's declared operations
102
+ abintegro serve # the runner's HTTP service
103
+ ```
104
+
105
+ A runner reads `ABINTEGRO_TENANT` and `ABINTEGRO_GCP_PROJECT` (or `GOOGLE_CLOUD_PROJECT`) to know
106
+ which tenant it is; it has no default. `--fixtures replay` runs every connector against its
107
+ recorded fixtures, with no network.
108
+
109
+ ## Licence
110
+
111
+ Apache-2.0. A runner built on this SDK, its connectors and its tasks belong to whoever wrote them
112
+ and carry no copyleft obligation.
@@ -0,0 +1,77 @@
1
+ # abintegro
2
+
3
+ The runner SDK of ABIntegro: deterministic business
4
+ automation, built with AI and secured by code.
5
+
6
+ A runner is a small repository of **connectors** (typed clients for the systems a business uses)
7
+ and **tasks** (plain async Python that reads from one system and writes to another). This
8
+ package is everything else: the task model, policies and guardrails enforced outside the task's
9
+ code, credentials the task never sees, proposals for a person to approve, state, a durable
10
+ queue, an append-only audit log, embedded AI calls with a fixed output shape, and the HTTP
11
+ service a runner deploys as.
12
+
13
+ ```
14
+ pip install abintegro
15
+ ```
16
+
17
+ Python 3.13 or later.
18
+
19
+ ## A task
20
+
21
+ ```python
22
+ from abintegro import ctx, parameter, permit, task
23
+ from connectors import school, zoom
24
+ from connectors.zoom.client import UserCreate
25
+
26
+
27
+ @task(id="enrollment_to_zoom", title="Zoom Licences for New Enrolments")
28
+ async def enrollment_to_zoom() -> None:
29
+ """Give every new student a licensed Zoom account."""
30
+ for e in await school.enrollments.since(ctx.state.get("cursor")):
31
+ spec = UserCreate(email=e.email, licences=[parameter("zoom_licence")])
32
+ if permit("users.create_with_licences"):
33
+ await zoom.users.create_with_licences(spec)
34
+ else:
35
+ ctx.suggest("zoom.users.create_with_licences", spec, key=str(e.id))
36
+ ctx.state["cursor"] = e.created_at
37
+ ```
38
+
39
+ - **No credentials in code.** A connector call is authenticated by the SDK from the tenant's
40
+ secret; the task holds a client, never a key.
41
+ - **Writes are permitted or proposed.** `permit` asks the policy the business set; anything not
42
+ permitted becomes a suggestion in the Inbox, with a before/after preview, for one person to
43
+ accept or reject.
44
+ - **Deterministic and convergent.** One connector call is one business action that is safe to
45
+ repeat; re-running a task repairs a partial failure. There are no steps to resume.
46
+ - **Guardrails outside the code.** Write, operation and token caps, execution windows,
47
+ allowed domains and accounts, and "never delete" are checked by the SDK on every call, whatever the task does.
48
+ - **Every action is audited.** Reads, writes, proposals, decisions and AI calls are recorded in
49
+ an append-only log.
50
+
51
+ `ctx.ai`, `ctx.decide`, `ctx.report`, `ctx.metric` and `ctx.lookup` add embedded AI with a fixed
52
+ output schema, yes/no and multiple-choice decisions, reports, dashboard figures and shared lookup
53
+ tables. The `abintegro_ai` package beside it holds the AI providers (Vertex AI, Gemini,
54
+ Anthropic, OpenAI and Langdock) behind one interface.
55
+
56
+ ## The command line
57
+
58
+ Run from a runner repository, next to its `connectors/` and `tasks/`:
59
+
60
+ ```
61
+ abintegro tasks # what is registered, and its trigger
62
+ abintegro run <task_id> # execute one task now
63
+ abintegro tick # one drain: schedules, webhook events, the queue
64
+ abintegro suggestions # proposed writes waiting on a person
65
+ abintegro accept <suggestion_id> # or reject
66
+ abintegro manifest build # derive each task's declared operations
67
+ abintegro serve # the runner's HTTP service
68
+ ```
69
+
70
+ A runner reads `ABINTEGRO_TENANT` and `ABINTEGRO_GCP_PROJECT` (or `GOOGLE_CLOUD_PROJECT`) to know
71
+ which tenant it is; it has no default. `--fixtures replay` runs every connector against its
72
+ recorded fixtures, with no network.
73
+
74
+ ## Licence
75
+
76
+ Apache-2.0. A runner built on this SDK, its connectors and its tasks belong to whoever wrote them
77
+ and carry no copyleft obligation.
@@ -0,0 +1,156 @@
1
+ """ABIntegro runner SDK.
2
+
3
+ Apache-2.0, AB Software LTD. A runner's own ``connectors/`` and ``tasks/`` use it
4
+ as a dependency and carry no copyleft obligation.
5
+
6
+ Task modules import these names and nothing else (``require_chain`` only when
7
+ one write needs another's result; ``YesNo``, ``Choice`` and ``Score`` only for
8
+ ``ctx.decide``)::
9
+
10
+ from abintegro import ctx, parameter, permit, require_chain, task
11
+ from connectors import school, zoom
12
+
13
+
14
+ @task(id="enrollment_to_zoom", title="Zoom Licences for New Enrolments")
15
+ async def enrollment_to_zoom() -> None:
16
+ # The docstring's first paragraph is the description the app shows.
17
+ for e in await school.enrollments.since(ctx.state.get("cursor")):
18
+ spec = ZoomUserCreate(
19
+ email=e.email,
20
+ first_name=e.first,
21
+ last_name=e.last,
22
+ licences=[parameter("zoom_licence")],
23
+ )
24
+ if permit("users.create_with_licences"):
25
+ await zoom.users.create_with_licences(spec)
26
+ else:
27
+ ctx.suggest("zoom.users.create_with_licences", spec, key=str(e.id))
28
+ ctx.state["cursor"] = e.created_at
29
+
30
+ ``ctx.suggest`` takes a business ``key``: the suggestion's identity is derived
31
+ from it.
32
+
33
+ **There is no ``step``.** One connector call is one convergent business action;
34
+ re-running the task repairs a partial failure. A multi-stage process is several
35
+ tasks, handed on by ``ctx.run`` or, through a human, ``ctx.suggest``.
36
+ """
37
+
38
+ from __future__ import annotations
39
+
40
+ from abintegro_ai.decisions import Choice, Score, YesNo
41
+ from abintegro_ai.report import ChartDataset, KpiMetric, ReportSection, TimelineEvent
42
+
43
+ from .ai import AiResult, AiTurn, Decision
44
+ from .audit import AuditEvent, AuditLog, audit_log
45
+ from .config import (
46
+ ConnectorConfig,
47
+ RunnerConfig,
48
+ TaskConfig,
49
+ TenantConfig,
50
+ TriggerConfig,
51
+ )
52
+ from .ctx import Execution, Handoff, Notice, Proposal, Read, ctx
53
+ from .errors import (
54
+ AbintegroError,
55
+ AiNoAnswer,
56
+ AiNoDecision,
57
+ ChainNotPermitted,
58
+ ConfigurationError,
59
+ ConnectorAuthError,
60
+ ConnectorConflict,
61
+ ConnectorError,
62
+ ConnectorNotFound,
63
+ ConnectorRateLimit,
64
+ ConnectorSchemaDrift,
65
+ ConnectorServerError,
66
+ GuardrailExceeded,
67
+ ManifestViolation,
68
+ OperationDisabled,
69
+ ParameterMissing,
70
+ PolicyDenied,
71
+ ReportRefused,
72
+ SuggestionNotApplicable,
73
+ SuggestionNotDeferrable,
74
+ WriteNotPermitted,
75
+ )
76
+ from .guardrails import ExecutionWindow, Guardrails
77
+ from .lookup import LookupTable
78
+ from .notifications import Notification
79
+ from .policy import parameter, permit, require_chain
80
+ from .queue import Queue, QueueItem
81
+ from .runner import Run, Runner, TickReport
82
+ from .state import TaskState
83
+ from .store import FirestoreStore, MemoryStore, Store
84
+ from .suggestion import Suggestion, SuggestionMessages, Suggestions
85
+ from .task import TaskDefinition, task
86
+ from .webhooks import ReceivedEvent
87
+
88
+ __all__ = [
89
+ "AbintegroError",
90
+ "AiNoAnswer",
91
+ "AiNoDecision",
92
+ "AiResult",
93
+ "AiTurn",
94
+ "AuditEvent",
95
+ "AuditLog",
96
+ "ChainNotPermitted",
97
+ "ChartDataset",
98
+ "Choice",
99
+ "ConfigurationError",
100
+ "ConnectorAuthError",
101
+ "ConnectorConfig",
102
+ "ConnectorConflict",
103
+ "ConnectorError",
104
+ "ConnectorNotFound",
105
+ "ConnectorRateLimit",
106
+ "ConnectorSchemaDrift",
107
+ "ConnectorServerError",
108
+ "Decision",
109
+ "Execution",
110
+ "ExecutionWindow",
111
+ "FirestoreStore",
112
+ "GuardrailExceeded",
113
+ "Guardrails",
114
+ "Handoff",
115
+ "KpiMetric",
116
+ "LookupTable",
117
+ "ManifestViolation",
118
+ "MemoryStore",
119
+ "Notice",
120
+ "Notification",
121
+ "OperationDisabled",
122
+ "ParameterMissing",
123
+ "PolicyDenied",
124
+ "Proposal",
125
+ "Queue",
126
+ "QueueItem",
127
+ "Read",
128
+ "ReceivedEvent",
129
+ "ReportRefused",
130
+ "ReportSection",
131
+ "Run",
132
+ "Runner",
133
+ "RunnerConfig",
134
+ "Score",
135
+ "Store",
136
+ "Suggestion",
137
+ "SuggestionMessages",
138
+ "SuggestionNotApplicable",
139
+ "SuggestionNotDeferrable",
140
+ "Suggestions",
141
+ "TaskConfig",
142
+ "TaskDefinition",
143
+ "TaskState",
144
+ "TenantConfig",
145
+ "TickReport",
146
+ "TimelineEvent",
147
+ "TriggerConfig",
148
+ "WriteNotPermitted",
149
+ "YesNo",
150
+ "audit_log",
151
+ "ctx",
152
+ "parameter",
153
+ "permit",
154
+ "require_chain",
155
+ "task",
156
+ ]
@@ -0,0 +1,16 @@
1
+ """``python -m abintegro`` — the form that always works.
2
+
3
+ The console script installed by ``pip install -e .`` lands outside ``PATH`` on
4
+ the Microsoft Store build of Python, which is what this machine runs (phase 0's
5
+ third surprise). Both READMEs document the module form for ``ruff`` and
6
+ ``pytest`` for the same reason; this makes the runner CLI behave the same way.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import sys
12
+
13
+ from .cli import main
14
+
15
+ if __name__ == "__main__":
16
+ sys.exit(main())