WorkflowContext reference
WorkflowContext (ctx) is passed to the workflow entry function and each agent's run handler. Use it for input, shared state, calling other agents, and SDK methods (AI, search, documents).
Properties
ctx.input
Workflow input from runWorkflow, or overridden when you call runAgent with input
ctx.state
Shared mutable object for this run β use it to pass data between agents
ctx.agentName
Name of the agent currently running (inside an agent run handler)
ctx.senderId
Sender id used for SDK calls inside the workflow
ctx.workflow
Parent workflow definition
ctx.notifier
Underlying notifier instance (advanced use)
Methods
ctx.runAgent(name, { input? })
Run one registered agent. Optional input overrides ctx.input for that agent.
ctx.runAgents(spec)
Run multiple agents in parallel. Returns { results }.
ctx.waitForMessage({ timeoutMs? }) / wait_for_message
Wait for the next inbound realtime message (WebSocket).
ctx.sendAI({ message, saveHistory?, sessionId?, provider?, model?, label? })
Call the AI API. Optional provider / model override project defaults (or agent defaults). Optional label names the step in the dashboard.
ctx.fetchAIHistory({ label? })
Fetch AI history for senderId.
ctx.search({ query, limit?, minSimilarity?, filterbySource?, label?, vectorStore?, embedding?, serverConfig? })
Semantic search over the knowledge base. Store and embedding follow vector stores.
ctx.addDocument(opts) / updateDocument / deleteDocument / listDocuments / getDocument
Knowledge-base document helpers. The same vectorStore, embedding, and serverConfig fields apply.
ctx.recordStep({ label, input?, output?, status? })
Record a custom step when observability is enabled.
Python names use snake_case: run_agent, run_agents, send_ai, fetch_ai_history, etc.
Call one agent
Call agents in parallel
More patterns: Parallel agents & shared state.
Shared state
Observability
When observability: true on the workflow, calls like sendAI, search, runAgent, and recordStep show up as steps in the dashboard. You do not need extra setup beyond enabling the flag and connecting the client.
Errors
Language notes
JS / TS
@dnotifier-realtime/dnotifier β runAgent, runAgents
Dart
package:dnotifier/dnotifier.dart β same camelCase API
Python
from dnotifier import Workflow β run_agent, run_agents
Next steps
Last updated