The Agent to wrap with durable, runtime-driven execution.
OptionalcacheResumable-stream cache — see createDurableAgent's cache.
OptionalidOptional id override (defaults to agent.id).
OptionalmaxMax steps for the agentic loop (bakes into the shared loop's isTaskComplete step).
OptionalnameOptional name override (defaults to agent.name).
OptionalpubsubPubSub for the agent's own stream events (observe()/onChunk). DEFAULTS to
runtime.pubsub (the host Durable Object's single identity) when omitted, so the
run's events and the agent's observe()/emitError feed agree without the host
wiring it twice — a mismatched pubsub would leave observe() replaying an
empty feed. Pass an explicit instance only to override that default.
The RunnerRuntime through which the loop is driven. Required because
this is the whole point of the flowsafe wrapper: executeWorkflow() calls
runtime.start('durable-agentic-loop', ...) instead of the base
createRun + start, so tenant-scoped run IDs, the per-leg grant context, and the resume
ledger apply to agent legs. The loop workflow is registered on this runtime
by the factory (idempotently — one shared id serves every durable agent).
OptionalthreadPublic Mastra thread runtime (mastra.agentThreadStreamRuntime). When
present, started and rehydrated outputs are registered on the same pubsub
identity so active-thread signals join the durable loop.
Options for createFlowsafeDurableAgent.