Workflow agents

A workflow agent is the hybrid of the two building blocks. A durable workflow owns the fixed, auditable part of a process, and it hands the open-ended judgment to a conversational agent from inside a step. The run stays durable and auditable while the agent handles the part you cannot write down in advance.

A workflow is durable and deterministic but cannot hold a free-form conversation. An agent reasons through fuzzy input but has no durable pipeline, retries, or audit trail.

Two directions

  • A workflow delegates to an agent, which is the common case. A step runs one turn of a sibling agent, in-process, and reads back its reply. Because it runs in a 'use step', the reply is a durable checkpoint.

    import { callDeepAgent } from '@stackbone/sdk/workflow';
    
    async function askAgent(message: string) {
      'use step';
      const { text } = await callDeepAgent('support', message);
      return text;
    }

    Use streamDeepAgent instead of callDeepAgent when you want the reply streamed live into the run's chat surface. It runs the same in-process turn and returns the same durable { text }, but the Studio Playground serves the workflow as a token-by-token chat rather than a one-shot run. The stackbone add workflow-agent scaffold generates this streaming call.

  • An agent starts a workflow. A tool's handler can launch a long-running workflow with stackbone.workflows.start(name, input) (fire-and-forget) or startAndWait(...) when it needs the result before replying.

When to use it

Pick the hybrid when a process has a rigid outline and a judgment-heavy middle: triage then act, or draft then approve. If it is a pure conversation, use a plain agent. If it is a fixed pipeline, use a plain workflow.

Scaffold the whole thing in one command:

stackbone add workflow-agent lead-qualifier

Where to go next

  • Getting started: scaffold and run a hybrid end to end.
  • Examples: a delegating workflow, an agent that starts a workflow, and a draft-then-approve flow.
  • Agents and Workflows are the two building blocks on their own.
BUILT WITH ❤️ FROM CANADA AND SPAIN