Python SDK for OnceOnly idempotency API
Project description
OnceOnly Python SDK
The Idempotency Layer for AI Agents, Webhooks, and Distributed Systems.
OnceOnly is a high-performance Python SDK that ensures exactly-once execution. It prevents duplicate actions (payments, emails, tool calls) in unstable environments like AI agents, webhooks, retries, or background workers.
Website: https://onceonly.tech/ai/
Documentation: https://onceonly.tech/docs/
Features
- Sync + Async client (httpx-based)
- Fail-open mode for production safety
- Stable idempotency keys (supports Pydantic & dataclasses)
- Decorator for zero-boilerplate usage
- Optional AI / LangChain integrations
Installation
pip install onceonly-sdk
With LangChain support included:
pip install "onceonly-sdk[langchain]"
Quick Start
from onceonly import OnceOnly
client = OnceOnly(
api_key="once_live_...",
fail_open=True # default: continues if API is down
)
res = client.check_lock(key="order:123", ttl=300)
if res.duplicate:
print("Duplicate blocked")
else:
print("First execution")
AI Agents / LangChain Integration 🤖
OnceOnly integrates cleanly with AI-agent frameworks like LangChain.
from onceonly.integrations.langchain import make_idempotent_tool
tool = make_idempotent_tool(
original_tool,
client=client,
key_prefix="agent:tool"
)
Repeated tool calls with the same inputs will execute exactly once, even across retries or agent restarts.
Decorator
from onceonly.decorators import idempotent
@idempotent(client, ttl=3600)
def process_order(order_id):
...
Idempotency keys are generated automatically and are stable across restarts.
Fail-Open Mode
Fail-open is enabled by default.
Network errors, timeouts, or server errors (5xx) will not break your application. The SDK will allow execution to continue safely.
Fail-open never applies to:
- Auth errors (401 / 403)
- Plan limits (402)
- Validation errors (422)
- Rate limits (429)
Support
Need help?
Email: support@onceonly.tech
Or open an issue on GitHub.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file onceonly_sdk-2.0.0.tar.gz.
File metadata
- Download URL: onceonly_sdk-2.0.0.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e026fa4d7ecfb4595d15d55ff94d1a20b0dd3ed482b231b5c67443e74834ebd6
|
|
| MD5 |
409544c355458bcc028f75fdb1b09a41
|
|
| BLAKE2b-256 |
d6f2f20f8ecbc2e16dd29248ab4c5c39be9ffee0a51e55726fa27dea632deac9
|
Provenance
The following attestation bundles were made for onceonly_sdk-2.0.0.tar.gz:
Publisher:
release.yml on mykolademyanov/onceonly-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
onceonly_sdk-2.0.0.tar.gz -
Subject digest:
e026fa4d7ecfb4595d15d55ff94d1a20b0dd3ed482b231b5c67443e74834ebd6 - Sigstore transparency entry: 808786444
- Sigstore integration time:
-
Permalink:
mykolademyanov/onceonly-python@93259667d05e938fac9bb8c5f362d0877b370346 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/mykolademyanov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@93259667d05e938fac9bb8c5f362d0877b370346 -
Trigger Event:
release
-
Statement type:
File details
Details for the file onceonly_sdk-2.0.0-py3-none-any.whl.
File metadata
- Download URL: onceonly_sdk-2.0.0-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38b500712c163a0d1200479baaaeee20b449fcdd8ce3b2ce9d7541dc0787109e
|
|
| MD5 |
787b9d0debfcae0a7f7f1d12055d5aea
|
|
| BLAKE2b-256 |
ebf9fe791387a31cc4df6373c3440e9170ff5d0dc509f1ceb40aa13a51998719
|
Provenance
The following attestation bundles were made for onceonly_sdk-2.0.0-py3-none-any.whl:
Publisher:
release.yml on mykolademyanov/onceonly-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
onceonly_sdk-2.0.0-py3-none-any.whl -
Subject digest:
38b500712c163a0d1200479baaaeee20b449fcdd8ce3b2ce9d7541dc0787109e - Sigstore transparency entry: 808786445
- Sigstore integration time:
-
Permalink:
mykolademyanov/onceonly-python@93259667d05e938fac9bb8c5f362d0877b370346 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/mykolademyanov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@93259667d05e938fac9bb8c5f362d0877b370346 -
Trigger Event:
release
-
Statement type: