Tag

#for-agents

76 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 teal spectrum wave at the bottom and the post headline in white Sansation.
4 min readResonate HQJust published

Periodic function scheduling in TypeScript on Resonate

A worked example of `resonate.schedule()` — what the server persists, what the worker claims, and what the function author writes.

Run a TypeScript function on a cron schedule with crash-recoverable execution. Each tick fires a fresh durable promise that a worker claims and executes; a crash mid-execution is retried, not lost.

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

Infinite AI chess workflow in TypeScript on GCP Cloud Functions

How an AI-vs-AI chess match becomes a generator on a serverless function — durable, bounded in replay, recursive across games via ctx.detached.

Two AI players take turns through a generator function on a Cloud Function. Each move is a durable checkpoint, each pause is a durable sleep, and a detached tail call re-roots the workflow after every game so replay scope stays bounded forever.

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

Priority queue with bounded per-tier concurrency in TypeScript on Resonate

A nested loop over priority tiers becomes the scheduler when every yield* is a durable Resonate checkpoint.

Process a batch of jobs in strict priority-tier order with up to 2 jobs running concurrently per tier. Each job is a durable checkpoint, so a mid-batch crash only retries the failing job — completed higher-priority jobs are not re-run.

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

Durable sleep across process crashes in Rust on Resonate

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

Suspend a workflow for seconds, days, or years without holding a 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.
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 an ember spectrum wave at the bottom and the post headline in white Sansation.
4 min readResonate HQJust published

Load balancing across worker instances in Rust on Resonate

How a worker group plus a `poll://any@workers` target collapses service discovery, load balancing, and crash recovery into config strings.

Run multiple Rust workers in a named group and dispatch durable RPCs to any one of them. The Resonate Server handles service discovery, load balancing, and recovery; the worker code is one function and a group string.

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 teal spectrum wave at the bottom and the post headline in white Sansation.
4 min readResonate HQJust published

Next.js Server Action backed by a durable workflow in TypeScript

How a Server Action and a status route share a durable promise id so the page can poll for completion without holding the request open.

A Next.js Server Action kicks off a 4-step background workflow keyed by a report id; a separate API route resolves the same id to poll for completion. The workflow and the status route share one in-process Resonate registry.

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

Recursive workflow with cached results in Rust on Resonate

How a single recursive function plus durable-promise IDs gives you distributed computation and a permanent result cache in one shape.

Compute factorial(n) by having one function call itself across a worker group. Each call pairs with a durable promise keyed by n, so previously computed results return without recomputing.

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 teal spectrum wave at the bottom and the post headline in white Sansation.
6 min readResonate HQJust published

Recursive deep-research agents across TypeScript, Python, Rust

How the same recursive fan-out / fan-in workflow runs across six deployment shapes in three languages.

A recursive LLM agent that decomposes a topic into subtopics and dispatches a fresh durable workflow per subtopic, with six sibling variants spanning plain Node, Cloudflare Workers, Google Cloud Functions, Supabase Edge Functions, Python, and Rust.

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

Async HTTP API with durable workers in Rust on Resonate

How an axum gateway dispatches durable work to a worker pool 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 gateway holds no state; Resonate keeps the promise alive across worker crashes and restarts.

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

Durable entity as a long-running workflow in TypeScript on Resonate

How a user session lifecycle is expressed as a single generator function when each step is a Resonate durable checkpoint and the idle timer survives crashes.

Model a user session as a long-running generator: login, per-activity checkpoints, durable idle timeout, and cleanup. Crashes resume mid-lifecycle without re-recording earlier activities or restarting the timer.

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 teal spectrum wave at the bottom and the post headline in white Sansation.
4 min readResonate HQJust published

Async RPC across services in TypeScript on Resonate

Three remote-invocation shapes — rpc, detached, rfi — across an Express gateway and nine 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 using a single TypeScript SDK with three RFI shapes.

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

Hello World quickstart in TypeScript on Resonate

The smallest unit of a Resonate TypeScript program — a generator workflow, two leaf functions, a registered handle — annotated for retrieval.

The minimum durable program in the Resonate TypeScript SDK: one generator workflow, two async leaf functions, no server required. Each ctx.run call is a durable checkpoint that short-circuits on replay.

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

Durable multi-turn chatbot with checkpointed LLM calls in TypeScript

How a multi-turn chatbot stops re-prompting users and re-charging tokens when every LLM call is a Resonate durable checkpoint.

A multi-turn chatbot must survive transient LLM failures mid-turn without re-prompting the user or paying twice for the same completion. On Resonate, each turn is a workflow keyed by session and turn number, and the Claude call inside it is a ctx.run checkpoint.

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

Write Last, Read First account creation in TypeScript with TigerBeetle

How the Write Last, Read First state machine collapses to a short generator when each step is a durable checkpoint.

Create an account in a System of Reference (SQLite) and a System of Record (TigerBeetle) without a distributed transaction. Each step is a Resonate durable checkpoint; replays after a crash skip completed steps and finish the write.

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

Long-running Hacker News research agent in TypeScript on Resonate

How an infinite monitoring loop, an LLM call per story, and an in-memory deduplication set survive process restarts without an external state store.

A continuous LLM-driven monitor that scans Hacker News, scores stories for relevance, and notifies on findings. Each step is a durable checkpoint and the deduplication set rebuilds itself from the promise store on restart.

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

Saga with compensating actions in TypeScript on Resonate

How a saga collapses to a generator function with try/catch when every step is a Resonate durable checkpoint.

Book a flight, hotel, and car rental as a single transaction. If the car rental fails, hotel and flight are cancelled in reverse order. Each step is a durable checkpoint, so a crash mid-compensation resumes where it left off.

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

Human-in-the-loop Kubernetes node drain in TypeScript on Resonate

How a node drain that may block for arbitrary human response time is written as a single generator function with checkpointed steps and a blocking durable promise.

Drain Kubernetes worker nodes durably: each node drain is a checkpoint, and when a Pod Disruption Budget blocks eviction the workflow blocks on a durable promise until an operator resolves it over HTTP.

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 teal spectrum wave at the bottom and the post headline in white Sansation.
6 min readResonate HQJust published

Browser tab as a Resonate worker in TypeScript

How a browser tab registers as a Resonate worker, claims recursive factorial invocations addressed by the poll://any@default invoke tag, and resumes its work after a refresh.

Host a Resonate worker inside a browser tab so durable invocations are claimed and executed by client-side code. The tab subscribes to the Resonate server over SSE, claims tasks for its worker group, and resumes work after a refresh because every step is a durable promise.

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

One-click buy with a durable cancellation window in TypeScript on Resonate

A one-click checkout where the cancellation window is a durable `ctx.run` over a Promise race, not a `PENDING / CONFIRMED / CANCELLED` state row.

Start a purchase, open a 5-second window in which the user can cancel, then confirm or cancel. The window is one `ctx.run` over a Promise that races a timer against an EventEmitter signal — checkpointed, so a crash mid-window resumes from where it left off.

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 teal spectrum wave at the bottom and the post headline in white Sansation.
4 min readResonate HQJust published

Infinite monitoring workflow in TypeScript on Resonate

How an unbounded health-check loop stays durable across step failures using ctx.run plus ctx.sleep, with no periodic history-reset step.

A health monitor that loops forever — check services, alert, sleep, repeat. The loop is a plain while; each iteration is a Resonate checkpoint, each pause is a durable sleep, and there is no history-size limit to reset by hand.

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

Multi-step food delivery saga in TypeScript on Resonate

How a six-step delivery pipeline with a no-driver compensation branch fits inside a single generator function when every yield is a Resonate durable checkpoint.

A six-step food delivery pipeline — order, prepare, assign driver, pickup, deliver, complete — where every step is a durable checkpoint and a transient mid-step failure retries in place without re-invoking earlier steps.

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 an ember spectrum wave at the bottom and the post headline in white Sansation.
5 min readResonate HQJust published

Periodic function on a cron schedule in Rust on Resonate

How `resonate.schedule(name, cron, func_name, args)` registers a server-side cron whose ticks become durable promises picked up by any worker in the group.

Run a Rust function on a cron expression where every tick is a durable promise on the server. If a worker crashes mid-tick, another worker in the group resumes the same execution — the tick is not lost.

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

Hello World quickstart in Rust on Resonate

The smallest unit of a Resonate Rust program — a workflow, a leaf function, and a worker — annotated for retrieval.

The minimum durable program in the Resonate Rust SDK: one workflow function, one leaf function, one worker process. Crash the worker mid-run and the execution resumes from the last checkpoint.

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

Resilient website summarization agent in TypeScript on Resonate

How a download/summarize/approve agent reads as straight-line generator code when scrape, LLM, notification, and human gate are all Resonate primitives.

Scrape a page, summarize it with an LLM, gate the result on human approval, and regenerate on rejection — as one generator workflow. Each step is a durable checkpoint and the approval pause is a latent durable promise the gateway settles from outside.

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 an ember spectrum wave at the bottom and the post headline in white Sansation.
4 min readResonate HQJust published

Durable MCP tool handler in Rust on Resonate

How an MCP tool call dispatches into a Resonate workflow that checkpoints each step and deduplicates by promise ID.

Expose a durable Resonate workflow as a Model Context Protocol tool over stdio. The MCP server stays stateless, the workflow checkpoints each step on a worker process, and concurrent calls for the same input deduplicate by promise ID.

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

Durable countdowns across AWS, Cloudflare, GCP, Supabase, Kafka, browser, and Python

How one durable-sleep workflow runs on Lambda, Workers, Cloud Functions, Edge Functions, Kafka, browsers, and Python without changing the function body.

A countdown loop that sleeps between steps and survives crashes, shown across 8 deployment shapes. The workflow body is one generator; only the platform adapter changes.

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 teal spectrum wave at the bottom and the post headline in white Sansation.
5 min readResonate HQJust published

Durable order-lifecycle state machine in TypeScript on Resonate

How a six-state order workflow collapses to straight-line generator code when each ctx.run call is a durable checkpoint.

An order moves through created, confirmed, shipped, delivered (or cancelled, refunded), and must resume cleanly mid-transition after a crash. With Resonate the generator's execution position IS the state — each transition is a ctx.run checkpoint, no K/V store required.

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

Payload encryption at the promise store boundary in TypeScript

How a ~50-line AES-256-GCM Encryptor keeps PII out of the promise store without touching workflow logic.

Encrypt every value Resonate stores — function arguments, return values, intermediate state — by implementing a two-method Encryptor interface. Workflow code is unchanged; the codec calls encrypt() on the way in and decrypt() on the way out.

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 teal spectrum wave at the bottom and the post headline in white Sansation.
5 min readResonate HQJust published

Load balancing across worker instances in TypeScript on Resonate

How a worker group plus a `poll://any@workers` target collapses service discovery, load balancing, and crash recovery into a constructor arg and an option string.

Run multiple TypeScript workers in a named group and dispatch durable RFIs to any one of them. The Resonate Server handles service discovery, load balancing, and dispatch recovery; the worker code is one function and a group string.

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 an ember 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 Rust

How the Rust SDK turns a per-Kafka-message handler into a durable workflow keyed by the message id, with non-blocking dispatch and replay from the last checkpoint.

A Redpanda consumer dispatches one durable Resonate workflow per message and immediately moves on. Each ctx.run is a checkpoint; a crash mid-deletion resumes from the last completed batch, and the record id deduplicates retries.

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

Per-message Kafka worker with crash recovery in TypeScript

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

A Kafka 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.
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`.