Anchorage API reference
    Preparing search index...

    Interface FlowsafeDurableAgentOptions<TAgentId, TTools, TOutput>

    interface FlowsafeDurableAgentOptions<
        TAgentId extends string = string,
        TTools extends ToolsInput = ToolsInput,
        TOutput = undefined,
    > {
        agent: Agent<TAgentId, TTools, TOutput>;
        cache?: false | MastraServerCache;
        id?: TAgentId;
        maxSteps?: number;
        name?: string;
        pubsub?: PubSub;
        runtime: RunnerRuntime;
        threadRuntime?: AgentThreadStreamRuntime;
    }

    Type Parameters

    • TAgentId extends string = string
    • TTools extends ToolsInput = ToolsInput
    • TOutput = undefined
    Index

    Properties

    agent: Agent<TAgentId, TTools, TOutput>

    The Agent to wrap with durable, runtime-driven execution.

    cache?: false | MastraServerCache

    Resumable-stream cache — see createDurableAgent's cache.

    Optional id override (defaults to agent.id).

    maxSteps?: number

    Max steps for the agentic loop (bakes into the shared loop's isTaskComplete step).

    name?: string

    Optional name override (defaults to agent.name).

    pubsub?: PubSub

    Stream and agent-level pub/sub. Uses pubsub ?? runtime.pubsub, or the wrapper's stream bus when both are absent. Thread state, signal delivery, and the run's drain share this identity. Construction refuses a wrapped agent with a different pub/sub of its own. The wrapped agent's pub/sub follows the last wrapper constructed over it.

    runtime: RunnerRuntime

    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 host-owned run IDs, the per-leg grant context, and persisted snapshot provenance apply to agent legs. The loop workflow is registered on this runtime by the factory (idempotently — one shared id serves every durable agent).

    threadRuntime?: AgentThreadStreamRuntime

    Public Mastra thread runtime (mastra.agentThreadStreamRuntime). Core registers started runs itself. When present, a run resumed through resumeViaRuntime() registers on the agent's pub/sub so active-thread signals join it. Without it, resumed runs are absent from thread state and signals sent while they run are not delivered into them.