Tag

#python

23 posts

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
4 min readResonate HQJust published

Recursive durable factorial in Python on Resonate

How a self-calling function stays durable and content-addressed when every invocation is its own durable promise.

A Resonate Python worker computes factorial recursively across a worker pool. Each invocation is a durable promise keyed by the input, so prior results are returned from the store on replay without re-execution.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
5 min readResonate HQJust published

Per-message Kafka worker with crash recovery in Python

How a Redpanda-fed Python worker collapses head-of-line blocking and crash-resume into straight-line generator code by treating each message id as a durable promise id.

A Redpanda consumer kicks off one durable workflow per message and returns immediately. Each step is a checkpoint; a worker crash mid-deletion resumes from the last completed batch, and the record id deduplicates retries.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
4 min readResonate HQJust published

AWS Lambda as a stateless trigger for durable Python workflows

How a Lambda handler hands a multi-step Python workflow to a long-running Resonate worker that survives Lambda's 15-minute timeout.

AWS Lambda has a hard 15-minute execution ceiling. Split the work: Lambda accepts the request and dispatches a durable RPC, and a long-running Resonate worker runs the multi-step workflow with each step checkpointed.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
5 min readResonate HQJust published

Recursive distributed calculator in Python on Resonate

How a self-calling calculator function distributes its sub-tasks across task groups while keeping each step a durable checkpoint.

Parse an arithmetic expression into a tree, then recursively dispatch each sub-expression to a worker pool and the operator to a separate pool. Every sub-expression is its own durable promise, so partial results survive crashes and the recursion is plain Python.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
5 min readResonate HQJust published

Async RPC across services in Python on Resonate

Three remote-invocation shapes — rfc, detached, rfi — across a Flask gateway and nine Python service groups, with crash recovery.

Cross-process function calls survive node crashes when the call graph is a durable promise. The example shows await-chain, detached-chain, and fan-out flows in Python using rpc, rfc, rfi, and detached.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
5 min readResonate HQJust published

Durable MCP tools that coordinate by promise id in Python

Three MCP tools coordinate on one durable promise keyed by job name — work survives MCP-server restarts and deduplicates by id.

Three MCP tools — start_gathering, probe_status, await_result — coordinate on one Resonate durable promise keyed by job name; after a crash the worker reclaims the promise and re-runs the function from the top.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
5 min readResonate HQJust published

Load balancing across a worker group in Python on Resonate

How tagging a Python process with `group="worker-group"` and addressing an RPC to `poll://any@worker-group` handles service discovery, load balancing, and crash recovery.

Spread work across N identical Python workers and recover in-flight executions when one of them crashes, by tagging each worker with a group name and addressing the call to any member of that group.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
4 min readResonate HQJust published

Saga with compensating action in Python on Resonate

How a two-step money transfer with compensating reversal is written as straight-line Python when each step is a Resonate durable checkpoint.

Move funds between two accounts with debit + credit + compensating reversal against a SQLite ledger. Each step is a durable checkpoint and replays are idempotent on a deterministic op_id.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
5 min readResonate HQJust published

Durable Hacker News research agent in Python on Resonate

How a long-running keyword-monitoring agent collapses to a generator workflow when every yield is a durable checkpoint and the promise store IS the state store.

Continuously scan Hacker News, score each story with an LLM, and notify on hits — without re-analyzing stories after a crash. Every step is a Resonate checkpoint and the dedup set rebuilds on replay, so no external database is needed.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
4 min readResonate HQJust published

Durable webhook deduplication keyed by event_id in Python

How a Stripe-style payment webhook becomes exactly-once when the event_id is the durable promise id and each step is a checkpoint.

Process Stripe-style payment webhooks exactly once by using the event_id as the Resonate promise id. Retries from the provider reattach to the existing durable execution instead of triggering a second charge.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
6 min readResonate HQJust published

Worker-group routing for an on-premise FaaS in Python on Resonate

How RPC, RFI, and ctx.detached split a FaaS submission into one durable orchestration on a router process and a pool of replaceable executors in a named worker group.

Submit function executions to a named worker group via durable RPC, RFI, and detached invocations; the orchestration survives worker crashes because the durable promise lives on the Resonate server, not in the router process.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
3 min readResonate HQJust published

Async MCP tool backed by a durable background job in Python

How an MCP server returns a promise id instead of blocking, and lets the agent ask back later — backed by a Resonate-registered function and a durable sleep.

Expose a long-running job to an LLM as an MCP tool that returns a promise id immediately, then let the agent poll for completion against a durable promise on the Resonate server.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
4 min readResonate HQJust published

Async HTTP API with durable workers in Python on Resonate

How a FastAPI gateway dispatches durable work to a worker group and lets clients poll a non-blocking status endpoint.

Accept an HTTP request, dispatch durable work to a separate worker process, and let the client poll for completion. The FastAPI gateway holds no state; Resonate keeps the promise alive across worker crashes and restarts.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
5 min readResonate HQJust published

Coordinating a Databricks job from a backend in Python with Resonate

How a single generator orchestrator triggers a long-running Databricks job and blocks on a durable promise that the notebook resolves out-of-band.

Trigger a Databricks job from a FastAPI service and resume a workflow when the job calls back, without splitting business logic across event handlers. The orchestrator yields a durable promise that the notebook resolves over HTTP.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
4 min readResonate HQJust published

Durable sleep across process crashes in Python on Resonate

How `ctx.sleep` collapses long-lived waits into one yield by suspending the workflow against a durable timer promise.

Suspend a workflow for seconds, days, or years without holding a Python process open. The sleep is a server-backed timer promise; another worker resumes the workflow when the timer fires, even if the original worker is gone.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
6 min readResonate HQJust published

Schedule-and-act reminder agent in Python on Resonate

How an autonomous agent loop with a long-lived sleep step collapses to straight-line generator code when each yield is a durable checkpoint.

An LLM-driven reminder assistant that parses a natural-language request, picks a target timestamp, and sleeps until then before sending the reminder. The sleep is a durable timer, so no cron, queue, or database is needed.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
4 min readResonate HQJust published

Hello World quickstart in Python on Resonate

How a three-function greeting program demonstrates the Resonate Python SDK's local-mode workflow, registration, and ctx.run primitive.

The minimum Resonate Python workflow: one generator function calls two ordinary functions through ctx.run, and the SDK turns each call into a durable checkpoint with zero server setup.

Resonate brand card on a dark background with a plum spectrum wave at the bottom and the post headline in white Sansation.
6 min readResonate HQJust published

Durable LLM tool-call loop for a travel assistant in Python on Resonate

A multi-turn tool-using LLM agent expressed as one generator function with three branches, where every LLM call, web call, and user prompt is a Resonate durable checkpoint.

An LLM agent that searches the web, scrapes pages, and converses with a user across many turns must not lose context to a crash. Each LLM call, tool call, and user input becomes a durable checkpoint via `ctx.lfc`.