Agent node is not tracked correctly in Langfuse #16364

Open
opened 2026-02-21 19:25:49 -05:00 by yindo · 11 comments
Owner

Originally created by @DavideDelbianco on GitHub (Aug 22, 2025).

Originally assigned to: @laipz8200 on GitHub.

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.7.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Setup a chatflow with an Agent node.
Setup tracing with Langfuse

✔️ Expected Behavior

LLM usage by the agent should be traced in Langfuse

Actual Behavior

Usage is not traced

Image
Originally created by @DavideDelbianco on GitHub (Aug 22, 2025). Originally assigned to: @laipz8200 on GitHub. ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.7.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Setup a chatflow with an Agent node. Setup tracing with Langfuse ### ✔️ Expected Behavior LLM usage by the agent should be traced in Langfuse ### ❌ Actual Behavior Usage is not traced <img width="493" height="534" alt="Image" src="https://github.com/user-attachments/assets/e9922c14-90d9-4f17-b2c4-41a2ce5e1eb1" />
yindo added the 🐞 bug label 2026-02-21 19:25:49 -05:00
Author
Owner

@DavideDelbianco commented on GitHub (Aug 22, 2025):

this is partially related to #24360 because once fixed, the values traced will be wrong until the other issue is resolved

@DavideDelbianco commented on GitHub (Aug 22, 2025): this is partially related to #24360 because once fixed, the values traced will be wrong until the other issue is resolved
Author
Owner

@DavideDelbianco commented on GitHub (Aug 22, 2025):

FYI Langfuse added new types to support agent, tools, embedding etc...
https://github.com/langfuse/langfuse/pull/8507/files

There's not just SPAN, GENERATION, EVENT anymore

@DavideDelbianco commented on GitHub (Aug 22, 2025): FYI Langfuse added new types to support agent, tools, embedding etc... https://github.com/langfuse/langfuse/pull/8507/files There's not just SPAN, GENERATION, EVENT anymore
Author
Owner

@dosubot[bot] commented on GitHub (Sep 22, 2025):

Hi, @DavideDelbianco. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that in Dify version 1.7.2 (self-hosted Docker), the Agent node's LLM usage is not properly tracked in Langfuse despite tracing being configured.
  • The issue is partially linked to #24360, where fixing one issue still leaves incorrect trace values until both are addressed.
  • You highlighted that Langfuse has introduced new trace types beyond SPAN, GENERATION, and EVENT to support agents, tools, and embeddings, which may be relevant for resolving this.
  • The issue remains unresolved with no recent updates or fixes applied.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open.
  • Otherwise, I will automatically close this issue in 15 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Sep 22, 2025): Hi, @DavideDelbianco. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that in Dify version 1.7.2 (self-hosted Docker), the Agent node's LLM usage is not properly tracked in Langfuse despite tracing being configured. - The issue is partially linked to #24360, where fixing one issue still leaves incorrect trace values until both are addressed. - You highlighted that Langfuse has introduced new trace types beyond SPAN, GENERATION, and EVENT to support agents, tools, and embeddings, which may be relevant for resolving this. - The issue remains unresolved with no recent updates or fixes applied. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open. - Otherwise, I will automatically close this issue in 15 days. Thank you for your understanding and contribution!
Author
Owner

@clintam123 commented on GitHub (Sep 29, 2025):

FYI Langfuse added new types to support agent, tools, embedding etc... https://github.com/langfuse/langfuse/pull/8507/files

There's not just SPAN, GENERATION, EVENT anymore

Are there any update on this? Update agent node's observation type from span to agent would be great @laipz8200

@clintam123 commented on GitHub (Sep 29, 2025): > FYI Langfuse added new types to support agent, tools, embedding etc... https://github.com/langfuse/langfuse/pull/8507/files > > There's not just SPAN, GENERATION, EVENT anymore Are there any update on this? Update agent node's observation type from span to agent would be great @laipz8200
Author
Owner

@dosubot[bot] commented on GitHub (Sep 29, 2025):

@crazywoola, the user clintam123 has pointed out that Langfuse has added new trace types beyond SPAN, GENERATION, and EVENT, and is requesting an update to change the agent node's observation type from span to agent. Could you please assist with this?

@dosubot[bot] commented on GitHub (Sep 29, 2025): @crazywoola, the user clintam123 has pointed out that Langfuse has added new trace types beyond SPAN, GENERATION, and EVENT, and is requesting an update to change the agent node's observation type from span to agent. Could you please assist with this?
Author
Owner

@jortegac commented on GitHub (Oct 1, 2025):

I have an issue with this as well. I cannot track the cost in Langfuse of agent nodes in a workflow. I can see the tracing detail in Langfuse and the function calling agent node in the workflow is marked as SPAN, and the cost is not tracked.

BUT if I use an Agent App rather than a Workflow App then the cost is tracked correctly. I really do need to use a workflow though

@jortegac commented on GitHub (Oct 1, 2025): I have an issue with this as well. I cannot track the cost in Langfuse of agent nodes in a workflow. I can see the tracing detail in Langfuse and the function calling agent node in the workflow is marked as SPAN, and the cost is not tracked. BUT if I use an Agent App rather than a Workflow App then the cost is tracked correctly. I really do need to use a workflow though
Author
Owner

@laipz8200 commented on GitHub (Oct 9, 2025):

We're planing a re-designed Agent Node ;)

@laipz8200 commented on GitHub (Oct 9, 2025): We're planing a re-designed Agent Node ;)
Author
Owner

@DavideDelbianco commented on GitHub (Jan 13, 2026):

@laipz8200

Any news? the logging is still bad, token usage is still missing, and the agent node does not seems to allow sub agents / graph pieces

@DavideDelbianco commented on GitHub (Jan 13, 2026): @laipz8200 Any news? the logging is still bad, token usage is still missing, and the agent node does not seems to allow sub agents / graph pieces
Author
Owner

@dosubot[bot] commented on GitHub (Feb 13, 2026):

Hi, @DavideDelbianco. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that in Dify v1.7.2 (self-hosted Docker), the Agent node's LLM usage is not properly tracked in Langfuse, with missing token usage and incorrect cost tracking in workflows.
  • The problem is linked to Langfuse introducing new trace types for agents and tools that are not yet integrated into Dify's tracking.
  • Other users have experienced similar cost tracking issues in workflow apps but not in agent apps.
  • A maintainer mentioned plans for a redesigned Agent Node to address this, but no concrete updates have been provided so far.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open.
  • Otherwise, I will automatically close this issue in 15 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Feb 13, 2026): Hi, @DavideDelbianco. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that in Dify v1.7.2 (self-hosted Docker), the Agent node's LLM usage is not properly tracked in Langfuse, with missing token usage and incorrect cost tracking in workflows. - The problem is linked to Langfuse introducing new trace types for agents and tools that are not yet integrated into Dify's tracking. - Other users have experienced similar cost tracking issues in workflow apps but not in agent apps. - A maintainer mentioned plans for a redesigned Agent Node to address this, but no concrete updates have been provided so far. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open. - Otherwise, I will automatically close this issue in 15 days. Thank you for your understanding and contribution!
Author
Owner

@DavideDelbianco commented on GitHub (Feb 13, 2026):

Yes issue is still relevant and I am waiting on the promise agent node refactor to finally be able to track consumptions and tools usage in external tracing tools

@DavideDelbianco commented on GitHub (Feb 13, 2026): Yes issue is still relevant and I am waiting on the promise agent node refactor to finally be able to track consumptions and tools usage in external tracing tools
Author
Owner

@jortegac commented on GitHub (Feb 14, 2026):

A fix for this has been submitted in #32330. Agent nodes now populate process_data with model info and usage, and the Langfuse tracer recognizes them as GENERATIONs with proper token/cost tracking.

@jortegac commented on GitHub (Feb 14, 2026): A fix for this has been submitted in #32330. Agent nodes now populate `process_data` with model info and usage, and the Langfuse tracer recognizes them as GENERATIONs with proper token/cost tracking.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#16364