Introducing Durable Agents
We’re excited to ship Durable Agents. Durable Agents can survive client disconnects, browser refreshes, or network blips.
Run multiple requests in parallel, watch them or leave them in flight and come back later. Or connect from a different client and observe in-progress or completed streams from the start.
Before Durable Agents, an agent stream was tied to the HTTP connection that started it. And Mastra’s storage layer persisted on a per-turn (agents) or per-step (workflow) layer. But if the connection dropped, there was no way of resuming from the point it disconnected. You had to go back to the beginning of the turn or step.
The default implementation, createDurableAgent(), uses a server cache to persist the stream and routes events through Mastra’s event system letting you observe a stream by subscribing using the runId. Durable agents wrap the agentic loop in a workflow.