Skip to main content

Quickstart from scratch

quickstart banner

Minimal steps to get started with Resonate.

1. Install Resonate

Install the Resonate Server + CLI on your local machine.

Install with Homebrew
Shell
brew install resonatehq/tap/resonate

Run the Resonate Server

Start Resonate Server
Shell
resonate dev

2. Install the SDK

Add the Resonate SDK to your project as a dependency.

Install with uv
Shell
uv add resonate-sdk

3. Register a function

Register a flow function with Resonate and start a Worker process to execute it.

main.py
Python
from resonate import Resonate, Context
from typing import Generator, Any

resonate = Resonate.remote()

def step_1(_: Context, greetee: str) -> str:
print("running step 1")
return f"Hello {greetee} from step 1!"

def step_2(_: Context, greetee: str) -> str:
print("running step 2")
return f"Hello {greetee} from step 2!"


@resonate.register
def flow(ctx: Context, greetee: str) -> Generator[str, Any, Any]:
print("running flow")
flow_greeting = f"Hello {greetee} from the main flow!"
step_1_greeting = yield ctx.run(step_1, greetee=greetee)
step_2_greeting = yield ctx.run(step_2, greetee=greetee)
greeting = f"{flow_greeting} {step_1_greeting} {step_2_greeting}"
return greeting

resonate.start()

Run your Worker

Run with uv
Shell
uv run main.py

4. Invoke a function

Invoke the flow function defined above.

Invoke flow
Shell
resonate invoke hello-world-greeting-flow --func flow --arg World --target poll://any@worker

5. Get the result

Get the result of the invoked flow function using the promise ID.

Get the result of flow
Shell
resonate promises get hello-world-greeting-flow

You should see the following output:

resonate promises get output
Shell
Id:       hello-world-greeting-flow
State: RESOLVED
Timeout: 1764970170102

Idempotency Key (create):
Idempotency Key (complete): hello-world-greeting-flow

Param:
Headers:
Data:
{"func":"flow","args":["World"],"version":1}

Value:
Headers:
Data:
"Hello World from flow! Hello World from step 1! Hello World from step 2!"

Tags:
resonate:invoke: poll://any@workers

The Data field under Value contains the final greeting returned by the flow function.