Workflows overview
Workflows orchestrate multi-step AI logic with named agents, shared state, and optional observability in the DNotifier dashboard. Define agents once, compose them in a Workflow, and execute with runWorkflow.
Core concepts
Agent
Named unit of work β classic defineAgent({ name, run }) or tool agent defineAgent({ name, tools, instructions })
Tools / MCP
Local notifier.tools.register or notifier.mcp.connect β see Tools & MCP
Workflow
Entry function + registered agents β new Workflow({ name, entry })
WorkflowContext
ctx passed to entry and agents β AI, search, runAgent / runAgents, shared state
Standalone runAgent
notifier.runAgent(agent, { input }) for tool agents outside a workflow
Middleware
Hooks around agents and workflows β logging, tool access, auth β see Middleware
Checkpoints
sessionId + resume / retry / replay β durable runs across turns and failures β see Checkpoints
Observability
observability: true β step telemetry in the dashboard
Runner
notifier.runWorkflow({ workflow, input })
Architecture
runWorkflow({ input })
β
βΌ
Workflow.entry(ctx)
β
ββ ctx.runAgent("intent-agent")
ββ ctx.search({ query })
ββ ctx.sendAI({ message })
ββ ctx.state.sharedKey = value
β
βΌ
{ result, state, executionId }Three-step integration
Define agents β
DNotifier.defineAgent/define_agentBuild a workflow β
new DNotifier.Workflow+registerAgentsRun a workflow β
runWorkflowafterconnect()
For tools and MCP, see Tools & MCP agents (local tools, MCP connect, standalone runAgent).
For logging, tool guards, and workflow access checks, see Middleware.
For multi-turn memory and retry after failure, see Checkpoints, sessions & resume.
For agents on other servers, see Remote agents (JavaScript, Python, and Dart).
To let Claude, Cursor, or other agents call yours, see Serve agents over MCP and Agent-to-agent (A2A).
When to use workflows
Intent routing
Classify β branch to search or chat
RAG pipelines
Search β summarize β answer
Content generation
Draft β edit β SEO (multi-agent)
Tool / MCP assistants
Agent loop with local or MCP tools
Auditable automation
Observability per step
vs single sendAI
One model call
Many steps with branching
No shared state object
ctx.state across agents
Manual orchestration in app code
Declarative entry function
AI session logs only
Workflow dashboard + step detail
Examples
Classify β search or general Q&A
Blog: create β edit β SEO
Register a tool and run with runAgent
Public MCP server + diagram assistant
Reference
Next steps
Last updated