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

    PubSub 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.

    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 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).

    threadRuntime?: AgentThreadStreamRuntime

    Public 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.