Anchorage API reference
    Preparing search index...
    • Wrap an Agent as a FlowsafeDurableAgent and register its loop workflow and raw agent on the runtime. The workflow uses the same runtime.register path init()'s boundCreateWorkflow uses; the raw agent lets Mastra resolve the durable input's agentId after isolate eviction.

      Workflow registration is IDEMPOTENT by its shared id: every durable agent compiles to the ONE 'durable-agentic-loop' workflow, while the agentId in each run's input selects one of the uniquely registered raw agents. A second createFlowsafeDurableAgent on a shared runtime therefore registers its agent but must not throw 'duplicate workflow id'. Like init()'s createWorkflow, registration also throws once runs have started (the Mastra instance is frozen) — call this at host setup, before any run.

      Multi-agent caveat: the shared loop bakes in the FIRST registrant's maxSteps (it is compiled into the isTaskComplete step) as the DEFAULT — a per-call stream(msg, { maxSteps }) still overrides it, so this only bites a second-plus agent that relies on its CONSTRUCTOR budget. Agents needing distinct default step budgets take separate runtimes.

      Type Parameters

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

      Returns FlowsafeDurableAgent<TAgentId, TTools, TOutput>