[PR #32330] fix(api): populate process_data on agent nodes for proper tracing #33675

Open
opened 2026-02-21 20:53:42 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/32330

State: open
Merged: No


Summary

  • Agent nodes in workflows now appear as GENERATIONs (not SPANs) in Langfuse, LangSmith, Opik, and Weave, with proper token usage and cost tracking.
  • Extracts model provider/name from the agent's MODEL_SELECTOR parameter and populates process_data on NodeRunResult, mirroring the LLM node pattern.
  • Adds explicit NodeType.AGENT fallback in all four tracing providers so agent nodes are always recognized as generation-type operations.
  • Always includes TOTAL_TOKENS, TOTAL_PRICE, and CURRENCY in agent node execution metadata.

Closes #24361
Closes #24360

Test plan

  • All 670 existing unit tests pass (ops + workflow suites)
  • Manual: set up a workflow with an agent node, enable Langfuse tracing, verify in Langfuse that the agent node appears as a GENERATION with token usage, model name, and cost
  • Manual: repeat with LangSmith, Opik, Weave to confirm consistent behavior
**Original Pull Request:** https://github.com/langgenius/dify/pull/32330 **State:** open **Merged:** No --- ## Summary - Agent nodes in workflows now appear as **GENERATIONs** (not SPANs) in Langfuse, LangSmith, Opik, and Weave, with proper token usage and cost tracking. - Extracts model provider/name from the agent's `MODEL_SELECTOR` parameter and populates `process_data` on `NodeRunResult`, mirroring the LLM node pattern. - Adds explicit `NodeType.AGENT` fallback in all four tracing providers so agent nodes are always recognized as generation-type operations. - Always includes `TOTAL_TOKENS`, `TOTAL_PRICE`, and `CURRENCY` in agent node execution metadata. Closes #24361 Closes #24360 ## Test plan - [x] All 670 existing unit tests pass (ops + workflow suites) - [ ] Manual: set up a workflow with an agent node, enable Langfuse tracing, verify in Langfuse that the agent node appears as a GENERATION with token usage, model name, and cost - [ ] Manual: repeat with LangSmith, Opik, Weave to confirm consistent behavior
yindo added the pull-request label 2026-02-21 20:53:42 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33675