Prevent a payment tool from being charged twice when an agent retries after a timeout
Stop an agent from hammering a failing API using a circuit breaker
Automatically roll back a multi step booking flow if a later step fails
| sangaraju1988/latch | 0xustaz/streamgate | a-bissell/unleash-lite | |
|---|---|---|---|
| Stars | 1 | 1 | 1 |
| Language | Python | Python | Python |
| Setup difficulty | easy | hard | hard |
| Complexity | 3/5 | 4/5 | 4/5 |
| Audience | developer | developer | researcher |
Figures from each repo's GitHub metadata at analysis time.
Installs via pip with zero required dependencies in the core.
latch is a Python library that adds reliability protections around the tool calls an AI agent makes, the kind of actions where an agent calls an external function to do something like charge a payment or send an email. When an agent's tool call times out, the agent often cannot tell whether the underlying action actually completed, so retrying is the natural response, but a retry can cause the same charge or email to happen twice if the tool is not designed to handle repeated calls safely. The library offers five small, independent building blocks that can be combined as needed. An idempotency decorator caches the result of a tool call under a unique key, so a repeated call with the same key returns the cached result instead of running the action again. A circuit breaker decorator stops calling a dependency after it fails several times in a row, rejecting further calls immediately until a recovery period has passed. A timeout decorator bounds how long a single tool call is allowed to block the agent, cancelling async calls cooperatively and unblocking sync calls from a background thread. A budget guardrail decorator limits how many calls or how much cost can occur within a time window, which helps prevent a runaway agent loop from spending too much money. A saga class handles multi step operations, such as charging a card, then booking a flight, then booking a hotel, automatically undoing already completed steps in reverse order if a later step fails. The library has no required dependencies in its core, works with both regular and async functions, and is meant to be dropped into any agent framework, including OpenAI style tool calling and LangChain, without forcing that framework to become a dependency of latch itself. It also includes an optional tracing feature for observing cache hits, circuit trips, timeouts, and rollbacks, plus a chaos testing feature that deliberately injects failures so you can confirm the protections actually work. It is installed with pip and licensed under MIT.
A Python library adding idempotency, timeouts, circuit breaking, budget limits, and rollback sagas to AI agent tool calls.
Mainly Python. The stack also includes Python.
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.