onceonly-sdk 2.0.1__py3-none-any.whl → 3.0.0__py3-none-any.whl
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.
- onceonly/__init__.py +26 -1
- onceonly/_http.py +26 -4
- onceonly/_util.py +3 -1
- onceonly/ai.py +378 -31
- onceonly/ai_models.py +27 -0
- onceonly/client.py +77 -4
- onceonly/decorators.py +87 -1
- onceonly/governance.py +471 -0
- onceonly/models.py +58 -7
- onceonly/version.py +1 -1
- onceonly_sdk-3.0.0.dist-info/METADATA +1031 -0
- onceonly_sdk-3.0.0.dist-info/RECORD +18 -0
- {onceonly_sdk-2.0.1.dist-info → onceonly_sdk-3.0.0.dist-info}/WHEEL +1 -1
- onceonly_sdk-2.0.1.dist-info/METADATA +0 -187
- onceonly_sdk-2.0.1.dist-info/RECORD +0 -17
- {onceonly_sdk-2.0.1.dist-info → onceonly_sdk-3.0.0.dist-info}/licenses/LICENSE +0 -0
- {onceonly_sdk-2.0.1.dist-info → onceonly_sdk-3.0.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
onceonly/__init__.py,sha256=plE3kBjpF0ssmwiiL1R2EmmlKqbyNhL2nCJHiHi6QSw,855
|
|
2
|
+
onceonly/_http.py,sha256=ijzYTtgz2jSN8j1wKJx6MPbeo8CAG9iWrKAdqnIVwsU,3937
|
|
3
|
+
onceonly/_util.py,sha256=-qVpRL7-IsAM-PgIACujY5WR_aDu9Yz10J_qQCmeYWI,1343
|
|
4
|
+
onceonly/ai.py,sha256=F5tIPvHvkbMyXFnWG0MUio867MpFky8HsZgbEV-cGi8,26101
|
|
5
|
+
onceonly/ai_models.py,sha256=H6nB5GaS-RTo2wRAOxZjS1_5eS-UttatuzbGtu9gJt0,3753
|
|
6
|
+
onceonly/client.py,sha256=veOARzvA3YxOsBEgBjlvVpqfSb1dEI1lAR1iTO_Zzn8,15733
|
|
7
|
+
onceonly/decorators.py,sha256=XTL3BITgVmCDRc4hrzyTNCpQyafvlFAQnjsN1EtEc7Y,8036
|
|
8
|
+
onceonly/exceptions.py,sha256=Issh08A4IHSDaysJhVZNRCU9W_9BfiGt65UHaMhDCs4,1156
|
|
9
|
+
onceonly/governance.py,sha256=-LRkX6kd8CfInlA3TQtLmWmOf5fCZmYQT0o_jQSq_58,19536
|
|
10
|
+
onceonly/models.py,sha256=rdZGQSYX-gzg0nRv2YUALGX5fv4iDw8gWleFABG9QQY,1990
|
|
11
|
+
onceonly/version.py,sha256=EPmgXOdWKks5S__ZMH7Nu6xpAeVrZpfxaFy4pykuyeI,22
|
|
12
|
+
onceonly/integrations/__init__.py,sha256=0tk-2HTTsmc42NhWuR_G_Afmz5-5WG8NvmlO7iIPkIY,34
|
|
13
|
+
onceonly/integrations/langchain.py,sha256=cdpHIluddX48uYeDeE1cxmn-arruVdE3k6gvZxYC9z4,5821
|
|
14
|
+
onceonly_sdk-3.0.0.dist-info/licenses/LICENSE,sha256=YQQ8IT_P7hcGmmLFFuOy3eKDZ90e1cqef_okg85oAiQ,129
|
|
15
|
+
onceonly_sdk-3.0.0.dist-info/METADATA,sha256=f3Ii_L5bFWccl20vzi3P2t58dz2r5ty2DKc8Do0yF1Q,28125
|
|
16
|
+
onceonly_sdk-3.0.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
17
|
+
onceonly_sdk-3.0.0.dist-info/top_level.txt,sha256=lvz-sHerZcTwlZW-uYoda_wgx62kY07GdtzIdw89hnU,9
|
|
18
|
+
onceonly_sdk-3.0.0.dist-info/RECORD,,
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: onceonly-sdk
|
|
3
|
-
Version: 2.0.1
|
|
4
|
-
Summary: Python SDK for OnceOnly idempotency API
|
|
5
|
-
Author-email: OnceOnly <support@onceonly.tech>
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://onceonly.tech/
|
|
8
|
-
Project-URL: Documentation, https://onceonly.tech/docs/
|
|
9
|
-
Project-URL: Repository, https://github.com/mykolademyanov/onceonly-python
|
|
10
|
-
Keywords: idempotency,automation,zapier,make,ai-agents
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
-
Classifier: Operating System :: OS Independent
|
|
14
|
-
Requires-Python: >=3.9
|
|
15
|
-
Description-Content-Type: text/markdown
|
|
16
|
-
License-File: LICENSE
|
|
17
|
-
Requires-Dist: httpx>=0.25
|
|
18
|
-
Provides-Extra: test
|
|
19
|
-
Requires-Dist: pytest>=7.0; extra == "test"
|
|
20
|
-
Requires-Dist: pytest-asyncio>=0.23; extra == "test"
|
|
21
|
-
Requires-Dist: anyio>=4.0; extra == "test"
|
|
22
|
-
Provides-Extra: langchain
|
|
23
|
-
Requires-Dist: langchain-core>=0.1.0; extra == "langchain"
|
|
24
|
-
Dynamic: license-file
|
|
25
|
-
|
|
26
|
-
# OnceOnly Python SDK
|
|
27
|
-
|
|
28
|
-
**The Idempotency Layer for AI Agents, Webhooks, and Distributed Systems.**
|
|
29
|
-
|
|
30
|
-
OnceOnly is a high-performance Python SDK that ensures **exactly-once execution**.
|
|
31
|
-
It prevents duplicate actions (payments, emails, tool calls) in unstable environments like
|
|
32
|
-
AI agents, webhooks, retries, or background workers.
|
|
33
|
-
|
|
34
|
-
Website: https://onceonly.tech/ai/
|
|
35
|
-
Documentation: https://onceonly.tech/docs/
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
## Features
|
|
40
|
-
|
|
41
|
-
- Sync + Async client (httpx-based)
|
|
42
|
-
- Fail-open mode for production safety
|
|
43
|
-
- Stable idempotency keys (supports Pydantic & dataclasses)
|
|
44
|
-
- Decorators for zero-boilerplate usage
|
|
45
|
-
- Native AI API (long-running jobs, local side-effects)
|
|
46
|
-
- Optional AI / LangChain integrations
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## Installation
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
pip install onceonly-sdk
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### With LangChain support included:
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
pip install "onceonly-sdk[langchain]"
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
## Quick Start (Webhooks / Automations)
|
|
65
|
-
|
|
66
|
-
```python
|
|
67
|
-
from onceonly import OnceOnly
|
|
68
|
-
|
|
69
|
-
client = OnceOnly(
|
|
70
|
-
api_key="once_live_...",
|
|
71
|
-
fail_open=True # default: continues if API is down
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
res = client.check_lock(key="order:123", ttl=300)
|
|
75
|
-
|
|
76
|
-
if res.duplicate:
|
|
77
|
-
print("Duplicate blocked")
|
|
78
|
-
else:
|
|
79
|
-
print("First execution")
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Use `check_lock()` for:
|
|
83
|
-
- Webhooks
|
|
84
|
-
- Make / Zapier scenarios
|
|
85
|
-
- Cron jobs
|
|
86
|
-
- Distributed workers
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
## AI Jobs (Server-side)
|
|
91
|
-
|
|
92
|
-
Use the AI API for long-running or asynchronous jobs.
|
|
93
|
-
|
|
94
|
-
```python
|
|
95
|
-
result = client.ai.run_and_wait(
|
|
96
|
-
key="ai:job:daily_summary:2026-01-09",
|
|
97
|
-
metadata={"task": "daily_summary", "model": "gpt-4.1"},
|
|
98
|
-
timeout=60,
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
print(result.status)
|
|
102
|
-
print(result.result)
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
- Charged **once per key**
|
|
106
|
-
- Polling is free
|
|
107
|
-
- Safe across retries and restarts
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
## AI Agents / Local Side-Effects
|
|
112
|
-
|
|
113
|
-
Use the AI Lease API when your code performs the side-effect locally
|
|
114
|
-
(payments, emails, webhooks) but still needs exactly-once guarantees.
|
|
115
|
-
|
|
116
|
-
```python
|
|
117
|
-
lease = client.ai.lease(key="ai:agent:charge:user_42:invoice_100", ttl=300)
|
|
118
|
-
|
|
119
|
-
if lease["status"] == "acquired":
|
|
120
|
-
try:
|
|
121
|
-
do_side_effect()
|
|
122
|
-
client.ai.complete(key=KEY, lease_id=lease["lease_id"], result={"ok": True})
|
|
123
|
-
except Exception:
|
|
124
|
-
client.ai.fail(key=KEY, lease_id=lease["lease_id"], error_code="failed")
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
## LangChain Integration 🤖
|
|
130
|
-
|
|
131
|
-
```python
|
|
132
|
-
from onceonly.integrations.langchain import make_idempotent_tool
|
|
133
|
-
|
|
134
|
-
tool = make_idempotent_tool(
|
|
135
|
-
original_tool,
|
|
136
|
-
client=client,
|
|
137
|
-
key_prefix="agent:tool"
|
|
138
|
-
)
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Repeated tool calls with the same inputs will execute **exactly once**,
|
|
142
|
-
even across retries or agent restarts.
|
|
143
|
-
|
|
144
|
-
See `examples/ai/` for canonical patterns.
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
## Decorators
|
|
149
|
-
|
|
150
|
-
```python
|
|
151
|
-
from onceonly.decorators import idempotent
|
|
152
|
-
|
|
153
|
-
@idempotent(client, ttl=3600)
|
|
154
|
-
def process_order(order_id):
|
|
155
|
-
...
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
Idempotency keys are generated automatically and remain stable across restarts.
|
|
159
|
-
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
## Fail-Open Mode
|
|
163
|
-
|
|
164
|
-
Fail-open is enabled by default.
|
|
165
|
-
|
|
166
|
-
Network errors, timeouts, or server errors (5xx) will **not break your application**.
|
|
167
|
-
The SDK will allow execution to continue safely.
|
|
168
|
-
|
|
169
|
-
Fail-open never applies to:
|
|
170
|
-
- Auth errors (401 / 403)
|
|
171
|
-
- Plan limits (402)
|
|
172
|
-
- Validation errors (422)
|
|
173
|
-
- Rate limits (429)
|
|
174
|
-
|
|
175
|
-
---
|
|
176
|
-
|
|
177
|
-
## Support
|
|
178
|
-
|
|
179
|
-
Need help?
|
|
180
|
-
Email: support@onceonly.tech
|
|
181
|
-
Or open an issue on GitHub.
|
|
182
|
-
|
|
183
|
-
---
|
|
184
|
-
|
|
185
|
-
## License
|
|
186
|
-
|
|
187
|
-
MIT
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
onceonly/__init__.py,sha256=KMS6F4DejM5nI5-gw3UC8SvETnK90oUE9V5pskh--Uw,481
|
|
2
|
-
onceonly/_http.py,sha256=bFAgrLv0T7cGFq3LqaQCwEiqx-VfKEiT8jUommmhRws,3240
|
|
3
|
-
onceonly/_util.py,sha256=YVdEWn1bvipAzR3g3oXpHmgLiaODwGRB1IGA3gHZ2PM,1273
|
|
4
|
-
onceonly/ai.py,sha256=-yaO1ZRlEO-Qqou4P_Q0cemZYwFSIRDM1Lu_AwfF5PY,14578
|
|
5
|
-
onceonly/ai_models.py,sha256=7bHYnAavdb3c-4nlh9HgRY18949TgmU9XfXfv3PXQEE,2910
|
|
6
|
-
onceonly/client.py,sha256=6DtLdWc-7_bAXsaaewUQUTHVnCkRZGsc-PByMVPRhYY,12838
|
|
7
|
-
onceonly/decorators.py,sha256=nP7Wu-RAQQNaTwyOnibzClEgcBJvYheMrG3_KztdlG8,5171
|
|
8
|
-
onceonly/exceptions.py,sha256=Issh08A4IHSDaysJhVZNRCU9W_9BfiGt65UHaMhDCs4,1156
|
|
9
|
-
onceonly/models.py,sha256=hVEBPgIVZP3ELjWYIFSFCKPzI38t5DA0gio9FvrmHJg,678
|
|
10
|
-
onceonly/version.py,sha256=wAxkK8w13vqoF47A8iqWdSlIgRRXmZiQ0R4wePZfzhs,22
|
|
11
|
-
onceonly/integrations/__init__.py,sha256=0tk-2HTTsmc42NhWuR_G_Afmz5-5WG8NvmlO7iIPkIY,34
|
|
12
|
-
onceonly/integrations/langchain.py,sha256=cdpHIluddX48uYeDeE1cxmn-arruVdE3k6gvZxYC9z4,5821
|
|
13
|
-
onceonly_sdk-2.0.1.dist-info/licenses/LICENSE,sha256=YQQ8IT_P7hcGmmLFFuOy3eKDZ90e1cqef_okg85oAiQ,129
|
|
14
|
-
onceonly_sdk-2.0.1.dist-info/METADATA,sha256=j1xhLIcpLYW6x4qmLKJp8qoKbDHrOhueu6beqF6DVmI,4131
|
|
15
|
-
onceonly_sdk-2.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
16
|
-
onceonly_sdk-2.0.1.dist-info/top_level.txt,sha256=lvz-sHerZcTwlZW-uYoda_wgx62kY07GdtzIdw89hnU,9
|
|
17
|
-
onceonly_sdk-2.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|