The Resonate Python SDK enables developers to build reliable and scalable cloud applications across a wide variety of use cases.
- How to contribute to this SDK
- Evaluate Resonate for your next project
- Example application library
- The concepts that power Resonate
- Join the Discord
- Subscribe to the Blog
- Follow on X
- Follow on LinkedIn
- Subscribe on YouTube
- Install the Resonate Server & CLI
brew install resonatehq/tap/resonate- Install the Resonate SDK
pip install resonate-sdk- Write your first Resonate Function
A countdown as a loop. Simple, but the function can run for minutes, hours, or days, despite restarts.
from resonate import Resonate, Context
from threading import Event
# Instantiate Resonate
resonate = Resonate.remote()
@resonate.register
def countdown(ctx: Context, count: int, delay: int):
for i in range(count, 0, -1):
# Run a function, persist its result
yield ctx.run(ntfy, i)
# Sleep
yield ctx.sleep(delay)
print("Done!")
def ntfy(_: Context, i: int):
print(f"Countdown: {i}")
resonate.start() # Start Resonate threads
Event().wait() # Keep the main thread alive- Start the server
resonate dev- Start the worker
python countdown.py- Run the function
Run the function with execution ID countdown.1:
resonate invoke countdown.1 --func countdown --arg 5 --arg 60Result
You will see the countdown in the terminal
python countdown.py
Countdown: 5
Countdown: 4
Countdown: 3
Countdown: 2
Countdown: 1
Done!What to try
After starting the function, inspect the current state of the execution using the resonate tree command. The tree command visualizes the call graph of the function execution as a graph of durable promises.
resonate tree countdown.1Now try killing the worker mid-countdown and restarting. The countdown picks up right where it left off without missing a beat.

