分布式异步执行 — 持久执行,简单易用
Resonate is an AI-native, extensible durable execution platform for agentic and classic workloads. Resonate features a dead simple programming model and a dead simple operational model: functions and promises on a single binary. Write normal code and get durable, scalable, and reliable applications.
A deep research agent: plan the searches, fan them out, synthesize the results.
async function research(context: Context, question: string) {
// Plan the searches
const queries = await context.run(agent,
`Plan the searches for: ${question}`
);
// Fan out the searches
const results = await Promise.allSettled(
queries.map((q) => context.rpc(search, q))
);
// Synthesize the results
return await context.run(agent,
`Write a cited report. ${question}: ${results}`
);
}That is the whole orchestration — no queue to drain, no state machine to advance, no scheduler to configure.
context.run calls a function and persists its result. On recovery the
call is not made again, its result is read back — you never pay for the same
tokens twice.context.rpc calls a function on another worker, on another machine, in
another language. It returns a promise, so Promise.allSettled gives you
fan-out with per-branch failure handling — the same code you would write
in-process.1. Install Resonate
brew install resonatehq/tap/resonate2. Install an SDK
npm install @resonatehq/sdk3. Write the worker — research.ts
agent and search are your code: a model call and a search API. Resonate does
not care what is inside them, only that their results are worth keeping.
import { type Context, type Info, Resonate } from "@resonatehq/sdk/async";
async function agent(info: Info, prompt: string) {
// your model call
}
async function search(info: Info, query: string) {
// your search API
}
async function research(context: Context, question: string) {
// as above
}
const resonate = new Resonate({ url: "http://localhost:8001" });
resonate.register("research", research);
resonate.register("search", search);
resonate.register("agent", agent);4. Start Resonate, then the worker
resonate dev
npx tsx research.tsresonate dev keeps state in memory for development. resonate serve keeps it
in a database — see Backends.
5. Activate the function
resonate invoke research.1 --func research --arg "What is durable execution?"[agent] Plan the searches for: What is durable execution?
[search] durable execution
[search] workflow recovery
[search] sagas
[agent] Write a cited report. What is durable execution? ...Kill the worker while the searches are in flight and start it again. The execution waits in the meantime, then resumes: the searches that never finished run again, and the plan — already persisted — does not.
Every durable execution, live: status, function, when it was created, when it settled, and when it times out. Filter by status, function, or time window, and search by id, function, or tag.
The console is compiled into the binary, so it works on an air-gapped or on-prem host.
Resonate sits in the middle of the stack you already run — your language, your compute, your storage, your transport — and a plugin for everything it does not natively support yet.
Resonate lets you build a server from three kinds of plugins: servers for
storage, workers for transport, and gateways for the edge. Name the
crates in Cargo.toml, register them in a Registry, and call run — Cargo
resolves, downloads, and compiles only what you named.
You pick plugins by naming them in Cargo.toml and registering them in main.rs.
Cargo.toml:
[dependencies]
resonate-base = { git = "https://github.com/resonatehq/resonate" }
resonate-server-postgres = { git = "https://github.com/resonatehq/resonate" }
resonate-transport-http-push = { git = "https://github.com/resonatehq/resonate" }
resonate-gateway-http = { git = "https://github.com/resonatehq/resonate" }
tokio = { version = "1", features = ["full"] }These crates are not on crates.io yet, so specify them by git or by path.
src/main.rs:
use resonate_base::{Options, Registry};
#[tokio::main]
async fn main() -> std::process::ExitCode {
resonate_base::main(
Registry::new()
.server(&resonate_server_postgres::PLUGIN)
.worker(&resonate_transport_http_push::PLUGIN)
.gateway(&resonate_gateway_http::PLUGIN),
Options::default().default_server("server_postgres"),
)
.await
}Resonate ships with the following plugins:
| Kind | Plugin |
|---|---|
| Server | server_sqlite |
| Server | server_postgres |
| Server | server_mysql |
| Server | server_scylladb |
| Server | server_blob |
| Worker | transport_http_push |
| Worker | transport_http_poll |
| Worker | transport_gcps |
| Worker | worker_bash |
| Gateway | gateway_http |
| Gateway | gateway_web |
| Gateway | gateway_metrics |
Durable by construction. Promises, tasks, and schedules are persisted before they are acted on. A crash mid-flight is a resume, not a loss.
Formally specified. The protocol has a machine-checked specification in resonate-specification, with mechanized invariants — not a prose document that drifted.
Differentially tested. Every storage engine is compared step-for-step against an executable oracle on randomized traffic, across SQLite, PostgreSQL, and MySQL, with a snapshot diff after every request.
One binary. brew install, resonate serve, done. No control plane to operate, no cluster to bootstrap.
Boring where it counts. Your existing database is the state store. Your existing observability stack gets Prometheus metrics and OpenTelemetry traces.
Supported backends:
| Backend | Flag |
|---|---|
| SQLite | (default) |
| PostgreSQL | --storage-type postgres |
| MySQL | --storage-type mysql |
| ScyllaDB | --storage-type scylladb |
| Blob | --storage-type blob |
All backends are held to the same behaviour by the differential test suite — the same requests go to every engine and to an executable model of the specification, and any divergence fails the build.
A worker is your code. Run it anywhere.
Resonate supports the following transports:
| Transport | Shape |
|---|---|
| HTTP push | Resonate calls your endpoint. Ideal for Cloud Run, Cloud Functions, and anything with a URL. |
| HTTP long-poll | Your worker holds a connection open. Ideal behind NAT, in a laptop, or in a private cluster. |
| Google Cloud Pub/Sub | Resonate publishes; your subscribers pick up the work. |
Integration plugins connect external systems to Resonate. Start a job in Airflow, render an image in Bannerbear, send a notification in Gotify — Resonate begins the work, tracks it to completion, and settles the promise with the result.
These are different from the server plugins that define storage, transport, and the API edge.
See the catalogue for all 447 systems on the roadmap.
| Language | Repository |
|---|---|
| TypeScript | resonate-sdk-ts |
| Python | resonate-sdk-py |
| Go | resonate-sdk-go |
| Java | resonate-sdk-java |
| Rust | resonate-sdk-rs |
See the full guide for deployment instructions.
brew install resonatehq/tap/resonate
resonate serveOr download binaries directly from the releases page.
git clone https://github.com/resonatehq/resonate
cd resonate
docker-compose upgit clone https://github.com/resonatehq/resonate
cd resonate
cargo build --release
./target/release/resonate serveConfiguration layers in order of increasing precedence:
resonate.toml)RESONATE_GATEWAYS__GATEWAY_HTTP__BIND=0.0.0.0:3000
RESONATE_SERVERS__ACTIVE=server_postgres
RESONATE_SERVERS__SERVER_POSTGRES__URL=postgres://...When Resonate calls protected endpoints, it can attach an auth header under [workers.transport_http_push.auth]:
| Mode | TOML | CLI |
|---|---|---|
| GCP ID token (Cloud Run / Cloud Functions) | mode = "gcp" |
--transports-http-push-auth-mode gcp |
| Static bearer | mode = "bearer" |
|
token = "my-token" |
--transports-http-push-auth-mode bearer |
|
--transports-http-push-auth-token my-token |
||
| None (default) | mode = "none" |
— |
Tokens come from Application Default Credentials; on Cloud Run this resolves to the service account identity automatically. Acquisition and refresh are handled by the google-cloud-auth crate.
Discord · Blog · X · LinkedIn · YouTube
暂无开放 Issues,或尚未同步最近议题。