Lightweight
Durable Execution
Highly performant & efficient to build reliable AI agents and workflows.
Trusted in production by
- IndeedBuilt on iWF, Dex’s predecessor10M+ workflows per day
- 2 startupsIn stealth mode, built on Dex
- MengosBuilt on Dex
Zero dependencies
Fast and efficient
One 16-vCPU AWS EC2 instance.
- p90 read latency at 35k/s
- 1.0 ms
From our benchmark. Temporal Cloud starts at 500 Actions/s and charges $50 per million Actions.
Easy to operate
- binary
- 22 MB
- memory to start
- 12 MB
Your data stays in your bucket. Unlimited history data storage. A standby takes over on failure.
No runs yet.
Paused
No Replay
You deploy new code mid-run
TemporalReplay
- 1
from datetime import timedelta ⋯ - 3
from temporalio import activity, workflow ⋯ - 21
@workflow.defn - 22
class ReplyWorkflow: ⋯ - 30
@workflow.run - 31
async def run(self, ticket: str) -> str: - 32
draft = await workflow.execute_activity( ⋯✓ - +
await workflow.execute_activity( ⋯✕ mismatch - 40
await workflow.wait_condition(lambda: self.approved) - 41
return await workflow.execute_activity( ⋯
History Events
- Workflow Execution Started
#1
- Activity Task Scheduled
#5draft_reply
- Activity Task Started
#6
- Activity Task Completed
#7
- Workflow Execution Signaled
#11approve_reply
- Activity Task Scheduled
#15send_reply
Stuck until you add versioning
DexNo replay
- 1
from dex import ( ⋯ - 9
class DraftReplyStep(Step[str]): ⋯✓ - −
return go_to(SendReplyStep, f"draft reply for {input}") - +
return go_to(NotifyReviewerStep, f"draft reply for {input}") ⋯ - +
class NotifyReviewerStep(Step[str]): ⋯ - 19
class SendReplyStep(Step[str]): - 20
def wait_for(self, context: Context, input: str) -> Wait: ⋯✓ - 23
def execute(self, context: Context, input: str) -> StepDecision: ⋯✓ - 27
class ReplyFlow(Flow[str]): ⋯
History Events
- Flow Started
#1
- Step Execute Completed
#2DraftReplyStep
- Rpc Execution Completed
#3approve_reply
- Step Wait For Completed
#4SendReplyStep
- Step Execute Completed
#5SendReplyStep
- Flow Closed
#6
Done. New runs take the new step
| Dex | Temporal | |
|---|---|---|
| Code | Ordinary code, no restrictionsSafe to change while Flows run. | Deterministic code, version branchesChanges need a version branch or multiple Worker versions in production. |
| Run state data | 64 MBData-nativeBuilt-in key-value store, up to 64 MB. | 1 MBVery limited sizeHistory and payload size limits. Usually under 1 MB. |
| Run history size | No limitConfigurable retention. | 50K events or 50 MBLonger runs need Continue-As-New. |
What developers say
Keep your agent framework
Add Dex to make its runs durable.
- A crash reruns only the call in flight.
- Approvals can wait for days.
- New code takes effect at the next Step.
$ pip install dex-agents-pydantic-ai "pydantic-ai-slim[openai]"agent = Agent("openai:gpt-5.2", instructions="You help customers with their orders.")
# @agent.tool find_order, refund_order, email_customer: unchanged
flow = pydantic_ai_session_flow(
agent,
flow_type="OrderAgent",
tool_policies={
"find_order": ToolPolicy(ToolEffect.READ),
"refund_order": ToolPolicy(ToolEffect.IDEMPOTENT_WRITE, requires_approval=True),
"email_customer": ToolPolicy(ToolEffect.NON_IDEMPOTENT_WRITE),
},
)$ pip install dex-agents-langgraphdef build_support_agent():
return create_agent(
init_chat_model("openai:gpt-5-mini"),
tools=[search_orders, refund_order],
system_prompt="You help customers with their orders.",
middleware=[DurableToolCallMiddleware()],
)
support_agent = langchain_agent_session_flow(
build_support_agent,
flow_type="SupportAgent",
tool_policies={
"search_orders": ToolPolicy(ToolEffect.READ),
"refund_order": ToolPolicy(ToolEffect.IDEMPOTENT_WRITE, requires_approval=True),
},
)$ pip install dex-agents-openai-agentsagent = Agent(
name="Support",
instructions="Help the customer with their orders.",
tools=[search_orders, create_refund],
)
flow = openai_agents_session_flow(
agent,
flow_type="SupportAgent",
tool_policies={
"search_orders": ToolPolicy(ToolEffect.READ),
"create_refund": ToolPolicy(ToolEffect.NON_IDEMPOTENT_WRITE),
},
)$ npm i @superdurable/dex-agents-vercel-ai @superdurable/dex-agents @superdurable/dex ai zodexport const supportAgentFlow = createVercelAiAgentSessionFlow(
{
model: openai("gpt-5"),
instructions: "You help customers with their orders. Ask before refunding.",
tools: { get_order, refund_order }, // tool({ ... }) as usual
toolPolicies: {
get_order: { effect: "read" },
refund_order: { effect: "idempotent_write", requiresApproval: true },
},
},
"SupportAgent",
{ interruptDeadlineMs: 24 * 60 * 60 * 1000 },
);$ npm i @superdurable/dex-agents-mastra @superdurable/dex-agents @superdurable/dex @mastra/core zodconst supportAgent = new Agent({
id: "support",
name: "Support",
instructions: "Help customers with their orders. Refund only when asked.",
model: "openai/gpt-5",
tools: { search_orders: searchOrders, refund_order: refundOrder },
});
const flow = createMastraAgentSessionFlow(supportAgent, "SupportAgent", {
toolPolicies: { refund_order: { effect: "idempotent_write", requiresApproval: true } },
interruptDeadlineMs: 24 * 60 * 60 * 1000,
});$ npm i @superdurable/dex-agents-pi @superdurable/dex-agents @superdurable/dex @earendil-works/pi-aiconst flow = createBuiltinAgentSessionFlow(
{
name: "support",
instructions: "Help customers with their orders.",
model: createPiAiModelClient(getModel("anthropic", "claude-sonnet-4-5")),
tools: [
// Pi AgentTools, as usual
piAgentFunctionTool(searchOrders, { effect: "read" }),
piAgentFunctionTool(refundOrder), // runs at most once
],
},
"SupportAgent",
);$ pip install dex-agents-google-adkagent = LlmAgent(
name="support",
model="gemini-2.5-flash",
instruction="Help customers with their orders.",
tools=[search_orders, refund_order, send_email],
)
flow = adk_agent_session_flow(
agent,
flow_type="SupportAgent",
tool_policies={
"search_orders": ToolPolicy(ToolEffect.READ),
"refund_order": ToolPolicy(ToolEffect.IDEMPOTENT_WRITE, requires_approval=True),
# send_email has no policy: unclassified, it runs once after approval.
},
)$ pip install dex-agents-claude-agent-sdkdef build_options(context: ClaudeAgentOptionsContext) -> ClaudeAgentOptions:
return ClaudeAgentOptions(
model="claude-sonnet-5",
system_prompt="You resolve order problems.",
tools=["Read", "Grep", "Bash"],
cwd=f"/srv/agents/{context.flow_id}",
)
flow = claude_agent_session_flow(
build_options,
[lookup_order, create_refund],
flow_type="SupportAgent",
tool_policies={"create_refund": ToolPolicy(ToolEffect.NON_IDEMPOTENT_WRITE)},
)With the Claude Agent SDK, each turn is one Step.
Use Dex SDKs
Install
$ go get github.com/superdurable/dex/sdk-go@latest $ go get github.com/superdurable/dex-connectors-library/connectors/google/gmail/go@v0.25.2Add the Dex skills
$ npx skills add superdurable/dex-skills --skill '*' --agent claude-code --globalOr --agent codex, --agent cursor.
Run locally (optional)
$ brew install superdurable/tap/dexcli $ dexcli dev
import (
"github.com/superdurable/dex/sdk-go/dex"
"time"
"github.com/superdurable/dex-connectors-library/sdkgo"
gmail "github.com/superdurable/dex-connectors-library/connectors/google/gmail/go"
)
type Customer struct {
Email string `json:"email"`
Reminders int `json:"reminders"`
}
var (
Replies = dex.DefineChannel[string]("reply")
CustomerState = dex.DefineAttribute[Customer]("customer")
)
type ReminderFlow struct {
dex.FlowDefaults
connection gmail.Connection
}
func (flow *ReminderFlow) GetSteps() []dex.StepDef {
return []dex.StepDef{
dex.DefineStartStep(awaitReply{}),
dex.DefineStep(gmail.NewSendMessageStep(gmail.SendMessageStepConfig[Customer]{
StepType: "SendReminder",
ConnectionName: "gmail",
Connection: flow.connection,
Annotations: sdkgo.StepAnnotations{
GroupID: "remind", GroupLabel: "Remind", Explanation: "Check Sent Mail before retrying a send.",
},
MapToOperationInput: func(customer Customer) gmail.SendMessageInput {
return gmail.SendMessageInput{
To: []string{customer.Email}, Subject: "Reminder", TextBody: "We are still waiting for your reply.",
}
},
Sent: sdkgo.GoTo(reminderSent{}),
})),
dex.DefineStep(reminderSent{}),
}
}
func (flow *ReminderFlow) GetRPCs() []dex.RPCDef {
return []dex.RPCDef{dex.DefineRPC(flow.Reply, nil)}
}
func (*ReminderFlow) GetPersistenceSchema() dex.PersistenceSchema {
return dex.PersistenceSchema{Channels: []dex.ChannelDef{Replies}, Attributes: []dex.AttributeDef{CustomerState}}
}
func (*ReminderFlow) Reply(ctx dex.Context, reply string) (*dex.RPCResult[string], error) {
if err := Replies.Publish(ctx, reply); err != nil {
return nil, err
}
return &dex.RPCResult[string]{Output: "received"}, nil
}
type awaitReply struct{ dex.StepDefaults }
func (awaitReply) WaitFor(dex.Context, Customer) (*dex.Wait, error) {
return dex.AnyOf(Replies.ForOne(), dex.Timer(3*24*time.Hour)), nil
}
func (awaitReply) Execute(ctx dex.Context, customer Customer) (*dex.StepDecision, error) {
if !ctx.HasTimerFired() {
return dex.GracefulComplete("replied"), nil
}
if customer.Reminders == 3 {
return dex.ForceFail("no reply after 3 reminders"), nil
}
customer.Reminders++
if err := CustomerState.Set(ctx, customer); err != nil {
return nil, err
}
return dex.GoTo(sdkgo.StepRef[Customer]("SendReminder"), customer), nil
}
type reminderSent struct {
dex.StepDefaultsNoWaitFor[gmail.SendMessageResult]
}
func (reminderSent) Execute(ctx dex.Context, _ gmail.SendMessageResult) (*dex.StepDecision, error) {
customer, err := CustomerState.Get(ctx)
if err != nil {
return nil, err
}
return dex.GoTo(awaitReply{}, customer), nil
}Install
$ pip install dex-python-sdk $ pip install dex-connector-google-gmailAdd the Dex skills
$ npx skills add superdurable/dex-skills --skill '*' --agent claude-code --globalOr --agent codex, --agent cursor.
Run locally (optional)
$ brew install superdurable/tap/dexcli $ dexcli dev
import dex
from dataclasses import dataclass, replace
from datetime import timedelta
from dex_connectors.sdk import MutationResult
from dex_connectors.google_gmail import Connection, SendMessageInput, SendMessageOutput, new_send_message_step
@dataclass(frozen=True)
class Customer:
email: str
reminders: int = 0
replies = dex.Channel[str]("reply", str)
customer_state = dex.Attribute[Customer]("customer", Customer)
class AwaitReply(dex.Step[Customer]):
def wait_for(self, context: dex.Context, customer: Customer) -> dex.Wait:
return dex.Wait.any_of(replies.for_one(), dex.Timer.by_duration(timedelta(days=3)))
def execute(self, context: dex.Context, customer: Customer) -> dex.StepDecision:
if not context.has_timer_fired():
return dex.graceful_complete("replied")
if customer.reminders == 3:
return dex.force_fail("no reply after 3 reminders")
customer = replace(customer, reminders=customer.reminders + 1)
customer_state.set(context, customer)
return dex.go_to(dex.StepRef("SendReminder"), customer)
class ReminderSent(dex.Step[MutationResult[SendMessageOutput]]):
def execute(self, context: dex.Context, input: MutationResult[SendMessageOutput]) -> dex.StepDecision:
return dex.go_to(AwaitReply, customer_state.get(context))
class ReminderFlow(dex.Flow[Customer]):
def __init__(self, connection: Connection) -> None:
self.await_reply = AwaitReply()
self.reminder_sent = ReminderSent()
self.send_reminder = new_send_message_step(
step_type="SendReminder",
step_input_type=Customer,
annotations={
"groupId": "remind",
"groupLabel": "Remind",
"explanation": "Check Sent Mail before retrying a send.",
},
connection=connection,
connection_name="gmail",
map_to_operation_input=lambda customer: SendMessageInput(
to=(customer.email,), subject="Reminder", text_body="We are still waiting for your reply."
),
sent=self.reminder_sent,
)
def get_steps(self) -> dex.StepList[Customer]:
return dex.StepList.start_step(self.await_reply).other_steps(self.send_reminder, self.reminder_sent)
def get_persistence_schema(self) -> dex.PersistenceSchema:
return dex.PersistenceSchema.of(replies, customer_state)
@dex.rpc
def reply(self, context: dex.Context, reply: str) -> dex.RPCResult[str]:
replies.publish(context, reply)
return dex.RPCResult("received")Install
$ npm install @superdurable/dex $ npm install @superdurable/connectors-sdk@0.1.1 @superdurable/connector-google-gmailAdd the Dex skills
$ npx skills add superdurable/dex-skills --skill '*' --agent claude-code --globalOr --agent codex, --agent cursor.
Run locally (optional)
$ brew install superdurable/tap/dexcli $ dexcli dev
import {
Attribute, Channel, type Context, type Flow, type PersistenceSchema, type RPCResult, type Step,
type StepDecision, StepList, StepRef, Timer, Wait, forceFail, goTo, gracefulComplete, jsonCodec, rpc, stringCodec,
} from '@superdurable/dex';
import type { MutationResult } from '@superdurable/connectors-sdk';
import { type GmailConnection, type SendMessageOutput, newSendMessageStep } from '@superdurable/connector-google-gmail';
type Customer = { email: string; reminders: number };
const replies = new Channel('reply', stringCodec);
const customerState = new Attribute('customer', jsonCodec<Customer>());
const THREE_DAYS_MS = 3 * 24 * 60 * 60 * 1000;
export class ReminderFlow implements Flow<Customer> {
private readonly awaitReply = new AwaitReply();
private readonly reminderSent = new ReminderSent();
constructor(private readonly connection: GmailConnection) {}
getFlowType(): string { return 'ReminderFlow'; }
getSteps(): StepList<Customer> {
return StepList.startStep(this.awaitReply).otherSteps(
newSendMessageStep({
stepType: 'SendReminder',
annotations: { groupId: 'remind', groupLabel: 'Remind', explanation: 'Check Sent Mail before retrying a send.' },
connection: this.connection,
connectionName: 'gmail',
mapToOperationInput: (customer: Customer) => ({
to: [customer.email], subject: 'Reminder', textBody: 'We are still waiting for your reply.',
}),
sent: this.reminderSent,
}),
this.reminderSent,
);
}
getPersistenceSchema(): PersistenceSchema { return { channels: [replies], attributes: [customerState] }; }
@rpc({ inputCodec: stringCodec, outputCodec: stringCodec })
reply(context: Context, reply: string): RPCResult<string> {
replies.publish(context, reply);
return { output: 'received' };
}
}
class AwaitReply implements Step<Customer> {
getStepType(): string { return 'AwaitReply'; }
waitFor(_context: Context, _customer: Customer): Wait {
return Wait.anyOf(replies.forOne(), Timer.byDuration(THREE_DAYS_MS));
}
execute(context: Context, customer: Customer): StepDecision {
if (!context.hasTimerFired()) return gracefulComplete('replied');
if (customer.reminders === 3) return forceFail('no reply after 3 reminders');
const next = { ...customer, reminders: customer.reminders + 1 };
customerState.set(context, next);
return goTo(new StepRef('SendReminder'), next);
}
}
class ReminderSent implements Step<MutationResult<SendMessageOutput>> {
getStepType(): string { return 'ReminderSent'; }
execute(context: Context, _result: MutationResult<SendMessageOutput>): StepDecision {
return goTo(AwaitReply, customerState.get(context));
}
}Add to build.gradle
implementation "io.superdurable:dex-sdk:1.32.0"Add the Dex skills
$ npx skills add superdurable/dex-skills --skill '*' --agent claude-code --globalOr --agent codex, --agent cursor.
Run locally (optional)
$ brew install superdurable/tap/dexcli $ dexcli dev
import io.superdurable.dex.Channel;
import io.superdurable.dex.Context;
import io.superdurable.dex.Flow;
import io.superdurable.dex.PersistenceSchema;
import io.superdurable.dex.RPC;
import io.superdurable.dex.RPCResult;
import io.superdurable.dex.Step;
import io.superdurable.dex.StepDecision;
import io.superdurable.dex.StepList;
import io.superdurable.dex.Timer;
import io.superdurable.dex.Wait;
import java.time.Duration;
public class ReminderFlow implements Flow<ReminderFlow.Customer> {
public record Customer(String email, int reminders) {}
static final Channel<String> replies = Channel.define("reply", String.class);
private final AwaitReply awaitReply = new AwaitReply();
private final SendReminder sendReminder = new SendReminder();
@Override
public StepList<Customer> getSteps() {
return StepList.startStep(awaitReply).otherSteps(sendReminder);
}
@Override
public PersistenceSchema getPersistenceSchema() {
return PersistenceSchema.of(replies);
}
@RPC
public RPCResult<String> reply(final Context context, final String reply) {
replies.publish(context, reply);
return RPCResult.of("received");
}
static final class AwaitReply implements Step<Customer> {
@Override
public Class<Customer> getInputType() { return Customer.class; }
@Override
public Wait waitFor(final Context context, final Customer customer) {
return Wait.anyOf(replies.forOne(), Timer.byDuration(Duration.ofDays(3)));
}
@Override
public StepDecision execute(final Context context, final Customer customer) {
if (!context.hasTimerFired()) {
return StepDecision.gracefulComplete("replied");
}
if (customer.reminders() == 3) {
return StepDecision.forceFail("no reply after 3 reminders");
}
return StepDecision.goTo(SendReminder.class, customer);
}
}
static final class SendReminder implements Step<Customer> {
@Override
public Class<Customer> getInputType() { return Customer.class; }
@Override
public StepDecision execute(final Context context, final Customer customer) {
sendReminderEmail(customer.email());
return StepDecision.goTo(AwaitReply.class, new Customer(customer.email(), customer.reminders() + 1));
}
}
// Your application's email code; no Java Gmail connector is published yet.
static void sendReminderEmail(final String email) {
}
}Install
$ cargo add dex-sdk serde --features serde/deriveAdd the Dex skills
$ npx skills add superdurable/dex-skills --skill '*' --agent claude-code --globalOr --agent codex, --agent cursor.
Run locally (optional)
$ brew install superdurable/tap/dexcli $ dexcli dev
use dex_sdk::{
Channel, Context, Flow, HandlerResult, PersistenceSchema, Rpc, RpcList, RpcResult, Step, StepDecision, StepList,
Timer, Wait,
};
use std::sync::LazyLock;
use std::time::Duration;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct Customer {
email: String,
reminders: u32,
}
pub const REPLY: Rpc<String, String> = Rpc::new("Reply");
static REPLIES: LazyLock<Channel<String>> = LazyLock::new(|| Channel::new("reply"));
#[derive(Default)]
pub struct ReminderFlow {
await_reply: AwaitReply,
send_reminder: SendReminder,
}
impl ReminderFlow {
fn reply(&self, context: &mut Context, reply: String) -> HandlerResult<RpcResult<String>> {
REPLIES.publish(context, reply)?;
Ok(RpcResult::new("received".to_string()))
}
}
impl Flow for ReminderFlow {
type StartInput = Customer;
fn steps(&self) -> StepList<'_, Self::StartInput> {
StepList::start(&self.await_reply).and(&self.send_reminder)
}
fn persistence(&self) -> PersistenceSchema {
PersistenceSchema::new().channel(&REPLIES)
}
fn rpcs(&self) -> RpcList<Self> {
RpcList::new().function(REPLY, Self::reply)
}
}
#[derive(Default)]
struct AwaitReply;
impl Step for AwaitReply {
type Input = Customer;
fn wait_for(&self, _context: &mut Context, _customer: Customer) -> HandlerResult<Wait> {
Ok(Wait::any_of([
REPLIES.for_one(),
Timer::by_duration(Duration::from_secs(3 * 24 * 60 * 60)),
]))
}
fn execute(&self, context: &mut Context, customer: Customer) -> HandlerResult<StepDecision> {
if !context.has_any_timer_fired() {
return Ok(StepDecision::graceful_complete("replied".to_string()));
}
if customer.reminders == 3 {
return Ok(StepDecision::force_fail("no reply after 3 reminders"));
}
Ok(StepDecision::go_to(&SendReminder, customer))
}
}
#[derive(Default)]
struct SendReminder;
impl Step for SendReminder {
type Input = Customer;
fn execute(&self, _context: &mut Context, mut customer: Customer) -> HandlerResult<StepDecision> {
send_reminder_email(&customer.email)?;
customer.reminders += 1;
Ok(StepDecision::go_to(&AwaitReply, customer))
}
}
// Your application's email code; no Rust Gmail connector is published yet.
fn send_reminder_email(_email: &str) -> HandlerResult<()> {
Ok(())
}Open-source connectors
Google Sheets
Gmail
Slack
Google Drive
Google Calendar
HubSpot
Airtable
Notion
Salesforce
OpenAI
Jira
Zendesk Support
LLM
Asana
Mailchimp
Trello
Calendly
Stripe
Zoom
PostgreSQL
MySQL
monday.com
Typeform
Twilio Messaging
Google Forms
LinkedIn
Microsoft SQL Server
Amazon S3
Microsoft Outlook Mail
GitHub
Gemini
Freshdesk
Google Docs
Microsoft Teams
Webhook
Intercom
Microsoft Excel
Zoho Desk
Help Scout
Spotify
Xero
Email (IMAP and SMTP)
BambooHR
Confluence
Microsoft OneDrive and SharePoint
Google Workspace Admin
Hacker News Daily
Microsoft Entra ID
Algolia
Alpha Vantage
Amazon SQS
Bitbucket
Brevo
ClickUp
Close
Cloudflare
Coda
Cohere
Contentful
Datadog
Discord
DocuSign eSignature
ElevenLabs
Figma
Front
GitLab
Gorgias
Harvest
Hiver
Jira Service Management
Klaviyo
Linear
Mailgun
Microsoft Outlook Calendar
Mixpanel
Netlify
NewsAPI
OAuth 2.0 HTTP
OpenWeatherMap
PagerDuty
PayPal
Pinecone
Pipedrive
Postmark
QuickBooks Online
Re:amaze
Resend
SendGrid
Sentry
Shopify
Smartsheet
Snowflake
Square
Supabase
TMDB
Todoist
Unsplash
Vercel
Webflow
WooCommerce
YouTube
Zoho CRM




