> 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/observability/observability.md). Agents can also search and read this documentation through its [MCP server](https://dnotifier.gitbook.io/product-docs/~gitbook/mcp).

# Observability overview

DNotifier gives you **three separate switches** for visibility into AI and workflows. They solve different problems — use them together in production.

| Flag                      | Where you set it                    | What it does                                            | Where you see it          |
| ------------------------- | ----------------------------------- | ------------------------------------------------------- | ------------------------- |
| **`logs: true`**          | `DNotifier` constructor             | AI **session logging** — start, complete, tokens, model | Dashboard → **Logs**      |
| **`saveHistory: true`**   | Each `sendAI` call (default `true`) | Stores AI turns for product/UI retrieval                | Via `fetchAIHistory`      |
| **`observability: true`** | `Workflow` definition               | Execution + step graph for multi-agent runs             | Dashboard → **Workflows** |

```
                    ┌─────────────────────────────┐
  logs: true   ───► │ Dashboard Logs              │  ops / tokens / model
                    └─────────────────────────────┘

  saveHistory  ───► │ Server AI history store     │  fetchAIHistory for UI
                    └─────────────────────────────┘

  observability ─► │ Dashboard Workflows         │  agents, steps, executionId
                    └─────────────────────────────┘
```

{% hint style="info" %}
These flags are **independent**. Turning on workflow observability does **not** enable session logs, and `saveHistory` does **not** create dashboard log rows.
{% endhint %}

## Quick enable (all three)

{% tabs %}
{% tab title="JavaScript" %}

```js
const notifier = new DNotifier({
  appId: process.env.DNOTIFIER_APP_ID,
  secret: process.env.DNOTIFIER_SECRET,
  transport: "http",
  userId: "user-123",
  logs: true, // session logging
});

await notifier.connect();

await notifier.sendAI({
  senderId: "user-123",
  message: { text: "Hello" },
  saveHistory: true, // AI message history (default)
});

const workflow = new DNotifier.Workflow({
  name: "support-router",
  observability: true, // workflow step telemetry
  async entry(ctx) {
    return ctx.sendAI({ message: { text: ctx.input } });
  },
});

const run = await notifier.runWorkflow({ workflow, input: "Help me" });
console.log(run.executionId);
```

{% endtab %}

{% tab title="Python" %}

```python
notifier = DNotifier(
    app_id=os.environ["DNOTIFIER_APP_ID"],
    secret=os.environ["DNOTIFIER_SECRET"],
    transport="http",
    user_id="user-123",
    logs=True,
)
await notifier.connect()

await notifier.send_ai(
    sender_id="user-123",
    message={"text": "Hello"},
    save_history=True,
)

workflow = Workflow(
    name="support-router",
    observability=True,
    entry=entry,
)
run = await notifier.run_workflow(workflow=workflow, input_data="Help me")
print(run.get("executionId"))
```

{% endtab %}

{% tab title="Dart" %}

```dart
final notifier = DNotifier(
  appId: Platform.environment['DNOTIFIER_APP_ID']!,
  secret: Platform.environment['DNOTIFIER_SECRET']!,
  transport: 'http',
  userId: 'user-123',
  logs: true,
);
await notifier.connect();

await notifier.sendAI(
  senderId: 'user-123',
  message: {'text': 'Hello'},
  saveHistory: true,
);

final workflow = Workflow(
  name: 'support-router',
  observability: true,
  entry: (ctx) => ctx.sendAI(message: {'text': ctx.input}),
);
final run = await notifier.runWorkflow(workflow: workflow, input: 'Help me');
print(run.executionId);
```

{% endtab %}
{% endtabs %}

## Choose the right tool

| Goal                                            | Use                                                                                                                          |
| ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| Debug which model/tokens a single `sendAI` used | [`logs: true`](https://dnotifier.gitbook.io/product-docs/observability/enable-session-logs.md)                               |
| Show past AI replies in your app UI             | [`saveHistory: true`](https://dnotifier.gitbook.io/product-docs/observability/save-ai-message-history.md) + `fetchAIHistory` |
| Trace a multi-agent pipeline step-by-step       | [`observability: true`](https://dnotifier.gitbook.io/product-docs/observability/ai-workflow-observability.md)                |
| Continue or retry an agent after a failure      | [`sessionId` + resume / retry](https://dnotifier.gitbook.io/product-docs/workflows-and-agents/checkpoints.md)                |
| All of the above in production                  | Enable **all three** (plus checkpoints when you need durable runs)                                                           |

## Guides in this section

| Guide                                                                                                             | Question it answers                                  |
| ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| [AI workflow observability](https://dnotifier.gitbook.io/product-docs/observability/ai-workflow-observability.md) | How do I enable and use workflow / AI observability? |
| [Enable session logs](https://dnotifier.gitbook.io/product-docs/observability/enable-session-logs.md)             | How do I enable `logs: true`?                        |
| [Save AI message history](https://dnotifier.gitbook.io/product-docs/observability/save-ai-message-history.md)     | How do I save and load AI message history?           |
| [Observability FAQ](https://dnotifier.gitbook.io/product-docs/observability/faq.md)                               | Common questions (SEO / AEO friendly)                |

## Related

* [Dashboard overview](https://dnotifier.gitbook.io/product-docs/getting-started/dashboard-overview.md)
* [Session logging (AI)](https://dnotifier.gitbook.io/product-docs/ai/session-logging.md)
* [AI history](https://dnotifier.gitbook.io/product-docs/ai/ai-history.md)
* [Workflow observability (workflows section)](https://dnotifier.gitbook.io/product-docs/workflows-and-agents/observability.md)
* [Checkpoints, sessions & resume](https://dnotifier.gitbook.io/product-docs/workflows-and-agents/checkpoints.md)
