n8n + Lang fuse integration #12598
-
Describe your questionWe are running a self-hosted n8n instance without the enterprise version and are trying to implement Langfuse for tracing, observability, token usage, and related metrics. I installed the community node @langfuse/n8n-nodes-langfuse, but it currently only supports fetching prompts and does not provide other functionality. Our workflow uses an AI Agent with the AWS Bedrock Chat Model. What would be the recommended approach to properly implement Langfuse in this setup? Langfuse Cloud or Self-Hosted?Self-Hosted If Self-HostedNo response If Langfuse CloudNo response SDK and integration versionsNo response Pre-Submission Checklist
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
The For tracing AI Agent workflows with AWS Bedrock in n8n, there's an open issue regarding output tokens not being captured with Recommended approach: If you have control over the integration code, you can manually update generations with usage details using the Langfuse SDK. Here's the pattern for Python:(1) from langfuse import get_client
def converse_with_bedrock(...):
response = client.converse(...)
langfuse = get_client()
langfuse.update_current_generation(
output=response['output']['message']['content'][0]['text'],
usage_details={
"input_tokens": response['usage']['inputTokens'],
"output_tokens": response['usage']['outputTokens'],
"total_tokens": response['usage']['totalTokens']
}
)
return responseFor AWS Bedrock credentials in self-hosted setups: You can use the AWS SDK default credential provider chain instead of static IAM credentials. This allows you to use IAM roles for EC2 instances or ECS task roles, AWS profiles, or environment variables ( Current limitations: Langfuse can only display output tokens and cost if the underlying LLM provider returns this info and the integration passes it through. If the Bedrock model or wrapper doesn't emit this metadata, Langfuse cannot show it—this is a limitation of the upstream provider or integration.(1) Check out these potentially useful sources:
📚 Sources:
Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @dreddy08, |
Beta Was this translation helpful? Give feedback.
Hi @dreddy08,
Currently, there is no native n8n tracing integration. Please upvote the related GitHub discussion here if you are interested in this.
One workaround we've seen is using an OpenRouter node + OpenRouter broadcast, via which you can send traces to Langfuse.