> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate with W&B Weave

> Send traces from Dify applications to W&B Weave for LLM observability

### What is W\&B Weave

Weights & Biases (W\&B) Weave is a framework for tracking, experimenting with, evaluating, deploying, and improving LLM-based applications. Designed for flexibility and scalability, Weave supports every stage of your LLM application development workflow.

> [!NOTE]
>
> For more details, please refer to [Weave](https://docs.wandb.ai/weave).

### How to Configure Weave

#### 1. Register/Login

Register/Login to [W\&B Weave](https://wandb.ai/signup) and get your API key. Then, copy your API key from [here](https://wandb.ai/authorize).

#### 2. Integrate W\&B Weave with Dify

Configure Weave in the Dify application. Open the application you need to monitor, open **Monitoring** in the side menu, and select **Tracing app performance** on the page.

![Configure Weave in the Dify Application](https://assets-docs.dify.ai/2025/04/c33e8fda75ee9052ed23c8690e314862.png)

After clicking configure, paste the **API Key** and an existing, writable **project name**, and optionally specify the **W\&B entity**. If the entity is blank, Dify uses the API key's default entity, which may be a team. Save the configuration.

![Configure, Paste the API Key and Project Name, Also Specify the W\&B](https://assets-docs.dify.ai/2025/04/60bce1ae7b883825b13526d172ae0073.png)

Once successfully saved, you can view the monitoring status on the current page.

![Once Successfully Saved, You Can View the Monitoring Status on the Current Page](https://assets-docs.dify.ai/2025/04/9486cee7bbb61f069842c9ea860e679c.png)

### View Monitoring Data in Weave

Once configured, the debug or production data from applications within Dify can be monitored in Weave.

![Once Configured, the Debug or Production Data from Applications Within Dify Can](https://assets-docs.dify.ai/2025/04/a1c5aa80325e6d0223d48a178393baec.png)

When you switch to Weave, you can view detailed operation logs of Dify applications in the dashboard.

![When You Switch to Weave, You Can View Detailed Operation Logs of Dify](https://assets-docs.dify.ai/2025/04/2cb04027c00b606029fcc26af2801bfe.png)

Detailed LLM operation logs through Weave will help you optimize the performance of your Dify application.

> [!NOTE]
>
> After saving and enabling tracing, run the app again and check for a new trace in the monitoring service. Delivery is asynchronous; saving the configuration alone does not confirm that a trace has arrived.
>
> For the new Agent app type and workflows using the [new Agent node](https://docs.dify.ai/en/cloud/use-dify/nodes/agent.md#new-agent), **Capture content** is off by default: inputs, outputs, and most metadata are removed, and error text is redacted across the whole workflow. Enable it to send that content. Classic `agent-chat` apps and workflows using only classic Agent nodes retain ordinary tracing.

### Monitoring Data List

The tables below describe ordinary traces. For the new Agent app type or workflows containing a new Agent node, traces use a new UUIDv7 trace ID, with source and tracing-run IDs retained as `dify.source.id` and `dify.tracing.run_id` attributes. For the new Agent app type, `Agent attempt` spans with internal model and tool calls replace the ordinary `llm` span when **Capture Agent internals** is on. Separate moderation, suggested-question, and naming records are omitted for collected runs.

Dify exports a hierarchy of operations: a message contains an `llm` call, and a Chatflow message contains its workflow and node operations. Call `trace_id` preserves the value of nonzero UUID or 32-hex Dify trace identifiers; other values are hashed. Call `id` is derived. A supplied `X-Trace-Id` takes precedence over the message or workflow run ID. Native token usage is reported on model calls only.

For Chatflow, the trace root is the `message`, with the user's query as input (or workflow inputs when the query is empty). Its `workflow` child retains the workflow inputs and outputs.

The detail lists below describe Dify's source records and metadata. Only the relevant, available values are exported; the raw records are not sent in full.

#### **Workflow/Chatflow Trace Information**

**Used to track workflows and chatflows**

| Workflow | Weave Trace |
| - | - |
| workflow\_run\_id (Workflow) / message\_id (Chatflow), unless X-Trace-Id is supplied | trace\_id |
| user\_id | attributes.user\_id |
| workflow (Workflow) / message (Chatflow) | op\_name / display\_name |
| start\_time | started\_at |
| end\_time | ended\_at |
| Workflow inputs / Chatflow query (workflow inputs if empty) | inputs |
| outputs | output |
| Model token consumption (LLM calls) | summary.usage (per model) |
| metadata | attributes |
| error | exception |
| Session ID | thread\_id |
| Parent span (when present) | parent\_id |

**Workflow Trace Info**

* workflow\_id - Unique identifier of the workflow
* conversation\_id - Conversation ID
* workflow\_run\_id - ID of the current run
* tenant\_id - Tenant ID
* elapsed\_time - Time taken for the current run
* status - Run status
* version - Workflow version
* total\_tokens - Total tokens used in the current run
* file\_list - List of processed files
* triggered\_from - Source that triggered the current run
* workflow\_run\_inputs - Input data for the current run
* workflow\_run\_outputs - Output data for the current run
* error - Errors encountered during the current run
* query - Query used during the run
* workflow\_app\_log\_id - Workflow application log ID
* message\_id - Associated message ID
* start\_time - Start time of the run
* end\_time - End time of the run
* workflow node executions - Information about workflow node executions
* Metadata
  * workflow\_id - Unique identifier of the workflow
  * conversation\_id - Conversation ID
  * workflow\_run\_id - ID of the current run
  * tenant\_id - Tenant ID
  * elapsed\_time - Time taken for the current run
  * status - Run status
  * version - Workflow version
  * total\_tokens - Total tokens used in the current run
  * file\_list - List of processed files
  * triggered\_from - Source that triggered the current run

#### **Message Trace Information**

**Used to track LLM-related conversations**

| Chat | Weave Trace |
| - | - |
| message\_id (unless X-Trace-Id is supplied) | trace\_id |
| end\_user\_session\_id | attributes.end\_user\_session\_id |
| message | op\_name / display\_name |
| start\_time | started\_at |
| end\_time | ended\_at |
| inputs | inputs |
| outputs | output |
| Model token consumption (LLM calls) | summary.usage (per model) |
| metadata | attributes |
| error | exception |
| Session ID | thread\_id |

**Message Trace Info**

* message\_id - Message ID
* message\_data - Message data
* end\_user\_session\_id - User session ID
* conversation\_model - Conversation mode
* message\_tokens - Number of tokens in the message
* answer\_tokens - Number of tokens in the answer
* total\_tokens - Total number of tokens in the message and answer
* error - Error information
* inputs - Input data
* outputs - Output data
* file\_list - List of processed files
* start\_time - Start time
* end\_time - End time
* conversation\_mode - Conversation mode
* Metadata
  * conversation\_id - Conversation ID
  * ls\_provider - Model provider
  * ls\_model\_name - Model ID
  * status - Message status
  * from\_end\_user\_id - ID of the sending user
  * from\_account\_id - ID of the sending account
  * agent\_based - Whether the message is agent-based
  * workflow\_run\_id - Workflow run ID
  * from\_source - Message source

#### **Moderation Trace Information**

**Used to track conversation moderation**

| Moderation | Weave Trace |
| - | - |
| user\_id | attributes.user\_id |
| moderation | op\_name / display\_name |
| start\_time | started\_at |
| end\_time | ended\_at |
| inputs | inputs |
| action, flagged | output |
| metadata | attributes |
| ID derived from message\_id | parent\_id |

**Moderation Trace Info**

* message\_id - Message ID
* user\_id: User ID
* workflow\_app\_log\_id - Workflow application log ID
* inputs - Moderation input data
* message\_data - Message data
* flagged - Whether the content is flagged for attention
* action - Specific actions taken
* preset\_response - Preset response
* start\_time - Moderation start time
* end\_time - Moderation end time
* Metadata
  * message\_id - Message ID
  * action - Specific actions taken
  * preset\_response - Preset response

#### **Suggested Question Trace Information**

**Used to track suggested questions**

| Suggested Question | Weave Trace |
| - | - |
| user\_id | attributes.user\_id |
| suggested\_question | op\_name / display\_name |
| start\_time | started\_at |
| end\_time | ended\_at |
| inputs | inputs |
| suggested\_question | output |
| metadata | attributes |
| ID derived from message\_id | parent\_id |

**Message Trace Info**

* message\_id - Message ID
* message\_data - Message data
* inputs - Input content
* outputs - Output content
* start\_time - Start time
* end\_time - End time
* total\_tokens - Number of tokens
* status - Message status
* error - Error information
* from\_account\_id - ID of the sending account
* agent\_based - Whether the message is agent-based
* from\_source - Message source
* model\_provider - Model provider
* model\_id - Model ID
* suggested\_question - Suggested question
* level - Status level
* status\_message - Status message
* Metadata
  * message\_id - Message ID
  * ls\_provider - Model provider
  * ls\_model\_name - Model ID
  * status - Message status
  * from\_end\_user\_id - ID of the sending user
  * from\_account\_id - ID of the sending account
  * workflow\_run\_id - Workflow run ID
  * from\_source - Message source

#### **Dataset Retrieval Trace Information**

**Used to track knowledge base retrieval**

| Dataset Retrieval | Weave Trace |
| - | - |
| user\_id | attributes.user\_id |
| dataset\_retrieval | op\_name / display\_name |
| start\_time | started\_at |
| end\_time | ended\_at |
| inputs | inputs |
| documents | output |
| metadata | attributes |
| ID derived from message\_id | parent\_id |

**Dataset Retrieval Trace Info**

* message\_id - Message ID
* inputs - Input content
* documents - Document data
* start\_time - Start time
* end\_time - End time
* message\_data - Message data
* Metadata
  * message\_id - Message ID
  * ls\_provider - Model provider
  * ls\_model\_name - Model ID
  * status - Message status
  * from\_end\_user\_id - ID of the sending user
  * from\_account\_id - ID of the sending account
  * agent\_based - Whether the message is agent-based
  * workflow\_run\_id - Workflow run ID
  * from\_source - Message source

#### **Tool Trace Information**

**Used to track tool invocation**

| Tool | Weave Trace |
| - | - |
| user\_id | attributes.user\_id |
| tool\_name | op\_name / display\_name |
| start\_time | started\_at |
| end\_time | ended\_at |
| tool\_inputs | inputs |
| tool\_outputs | output |
| metadata | attributes |
| ID derived from message\_id | parent\_id |

#### **Tool Trace Info**

* message\_id - Message ID
* tool\_name - Tool name
* start\_time - Start time
* end\_time - End time
* tool\_inputs - Tool inputs
* tool\_outputs - Tool outputs
* message\_data - Message data
* error - Error information, if any
* inputs - Inputs for the message
* outputs - Outputs of the message
* tool\_config - Tool configuration
* time\_cost - Time cost
* tool\_parameters - Tool parameters
* file\_url - URL of the associated file
* Metadata
  * message\_id - Message ID
  * tool\_name - Tool name
  * tool\_inputs - Tool inputs
  * tool\_outputs - Tool outputs
  * tool\_config - Tool configuration
  * time\_cost - Time cost
  * error - Error information, if any
  * tool\_parameters - Tool parameters
  * message\_file\_id - Message file ID
  * created\_by\_role - Role of the creator
  * created\_user\_id - User ID of the creator

**Generate Name Trace Information**

**Used to track conversation title generation**

| Generate Name | Weave Trace |
| - | - |
| user\_id | attributes.user\_id |
| generate\_name | op\_name / display\_name |
| start\_time | started\_at |
| end\_time | ended\_at |
| inputs | inputs |
| outputs | output |
| metadata | attributes |

**Generate Name Trace Info**

* conversation\_id - Conversation ID
* inputs - Input data
* outputs - Generated conversation name
* start\_time - Start time
* end\_time - End time
* tenant\_id - Tenant ID
* Metadata
  * conversation\_id - Conversation ID
  * tenant\_id - Tenant ID


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.