resonate-basic-durable-world-usage-python

resonate-basic-durable-world-usage-python is a skill for Claude Code, Codex from resonatehq/resonate-skills. It costs 64 tokens per session (2,423 once invoked), scanned A, original, Apache-2.0.

A Python guide for writing Resonate durable functions—functions that save progress at checkpoints so they can resume after crashes or restarts.

In plain words
What is it for?
Using the Resonate context for checkpoints, remote calls, detached work, promises, delays, and dependency injection inside registered functions.
Why use it?
It explains how to structure asynchronous code and avoid operations that would make recovery or replay unreliable.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/resonatehq/resonate-skills/resonate-basic-durable-world-usage-python
Any agent
npx skills add resonatehq/resonate-skills --skill resonate-basic-durable-world-usage-python
Clone the repo
git clone --depth 1 https://github.com/resonatehq/resonate-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for resonate-basic-durable-world-usage-python

README.md
[![agentmods](https://agentmods.dev/badge/skills/resonatehq/resonate-skills/resonate-basic-durable-world-usage-python.svg)](https://agentmods.dev/skills/resonatehq/resonate-skills/resonate-basic-durable-world-usage-python)
Your own site
<a href="https://agentmods.dev/skills/resonatehq/resonate-skills/resonate-basic-durable-world-usage-python"><img src="https://agentmods.dev/badge/skills/resonatehq/resonate-skills/resonate-basic-durable-world-usage-python.svg" alt="Measured on agentmods" height="20"></a>
Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,423 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00064 $0.02423
Opus 5 $0.00032 $0.01211
Sonnet 5 $0.00013 $0.00485
Haiku 4.5 $0.00006 $0.00242

Measured 6d ago against content hash ce6cba649105, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

resonate-basic-durable-world-usage-python scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

requests.post(WEBHOOK_URL, json=arg) # runs on every replay
resonate-basic-durable-world-usage-python/SKILL.md · 275 lines

How it starts

The opening of the file, as written. The whole thing — 275 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Resonate Basic Durable World Usage — Python

Overview

Durable functions are the payload of Resonate. They are async def coroutines that the SDK treats as a sequence of durable checkpoints. Every await ctx.run(...) or await ctx.rpc(...) is a save point: if the process crashes, the function resumes from the last successful checkpoint on another process or a restart.

This skill covers the Context API (ctx.*) that you use inside those functions. The ephemeral-world counterpart (Resonate class, registration, top-level invocation) lives in resonate-basic-ephemeral-world-usage-python.

The contract

Every durable function:

  1. Is registered with r.register(fn) in the ephemeral world.
  2. Takes ctx (the Context) as its first parameter; any other parameters after that are the invocation args.
  3. Uses await to interact with ctx. Each awaited ctx.* call is a durable checkpoint.
  4. Is deterministic when replayed: no direct time.time(), no random.random(), no raw network I/O outside ctx.run.

Minimal shape:

from __future__ import annotations
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from resonate.context import Context

async def process_order(ctx: Context, order_id: str) -> dict:
    # step 1 — durable: its result is persisted
    order = await ctx.run(load_order, order_id)

    # step 2 — durable: runs locally in the same worker
    charge = await ctx.run(charge_card, order)

    # step 3 — ordinary Python control flow; free to branch, loop, raise
    if not charge["ok"]:
        raise RuntimeError(f"payment failed: {charge['reason']}")

    return {"order_id": order_id, "status": "paid"}

If this function crashes after step 1 but before step 2, it resumes at step 2 on restart — load_order is NOT re-run. Its result is read from the promise store.

Same-process invocation: ctx.run

ctx.run invokes another function in the same process durably. The durable function awaits it and the result is checkpointed:

Read the full file on GitHub · 275 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 275 lines · 64 tokens per session scan A ce6cba649105

Subscribe to this mod's changes

resonate-basic-durable-world-usage-python is a skill published in the GitHub repository resonatehq/resonate-skills (6 stars, last pushed 14d ago), licensed Apache-2.0. It adds 64 tokens to every session and 2,423 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.