> For the complete documentation index, see [llms.txt](https://dnotifier.gitbook.io/product-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dnotifier.gitbook.io/product-docs/workflows-and-agents/overview.md).

# 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`.

{% hint style="info" %}
Run workflows with **`transport: "http"`**. Each `runWorkflow` call authenticates via `connect()` and returns `{ result, state, executionId? }`.
{% endhint %}

## Core concepts

| Concept             | Description                                                                               |
| ------------------- | ----------------------------------------------------------------------------------------- |
| **Agent**           | Named unit of work — `defineAgent({ name, run(ctx) })`                                    |
| **Workflow**        | Entry function + registered agents — `new Workflow({ name, entry })`                      |
| **WorkflowContext** | `ctx` passed to `entry` and agents — AI, search, `runAgent` / `runAgents`, shared `state` |
| **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

1. [**Define agents**](/product-docs/workflows-and-agents/define-agent.md) — `DNotifier.defineAgent`
2. [**Build a workflow**](/product-docs/workflows-and-agents/build-workflow.md) — `new DNotifier.Workflow` + `registerAgents`
3. [**Run a workflow**](/product-docs/workflows-and-agents/run-workflow.md) — `runWorkflow` after `connect()`

For agents on other servers, see [**Remote agents**](/product-docs/workflows-and-agents/remote-agents.md) (JavaScript, Python, and Dart).

## When to use workflows

| Scenario             | Why workflows                       |
| -------------------- | ----------------------------------- |
| Intent routing       | Classify → branch to search or chat |
| RAG pipelines        | Search → summarize → answer         |
| Content generation   | Draft → edit → SEO (multi-agent)    |
| Auditable automation | Observability per step              |

## vs single `sendAI`

| Single prompt                    | Workflow                         |
| -------------------------------- | -------------------------------- |
| 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

| Example                                                                           | Description                       |
| --------------------------------------------------------------------------------- | --------------------------------- |
| [Intent router](/product-docs/workflows-and-agents/example-intent-router.md)      | Classify → search or general Q\&A |
| [Multi-agent pipeline](/product-docs/workflows-and-agents/example-multi-agent.md) | Blog: create → edit → SEO         |

## Reference

* [**Workflow observability**](/product-docs/workflows-and-agents/observability.md)
* [**WorkflowContext reference**](/product-docs/workflows-and-agents/workflow-context.md)

## Next steps

* [**Define an agent**](/product-docs/workflows-and-agents/define-agent.md)
* [**AI overview**](/product-docs/ai/overview.md)
