Ash
Ash4w ago

tags and metadata not visible in traces in langchain(crewai)

Hi everyone, I am using langfuse for monitoring my crewai agent calls. I am able to generate the traces using decorators, passing the tags with langfuse_context and passing that in callbacks. Below is my code example
from langfuse.decorators import langfuse_context, observe
@observe()
def question_extractor(self, llm_api):
langfuse_context.update_current_trace(
tags=["Question_Extracting_Agent"],
metadata={"agent_type": "question_extractor"},
)
langfuse_handler = langfuse_context.get_current_langchain_handler()
return Agent(
role="Question Agent",
goal="Extract key information ",
backstory="You analyze text to identify questions, concerns, and relevant details.",
llm=llm_api,
callbacks=[langfuse_handler]
)
from langfuse.decorators import langfuse_context, observe
@observe()
def question_extractor(self, llm_api):
langfuse_context.update_current_trace(
tags=["Question_Extracting_Agent"],
metadata={"agent_type": "question_extractor"},
)
langfuse_handler = langfuse_context.get_current_langchain_handler()
return Agent(
role="Question Agent",
goal="Extract key information ",
backstory="You analyze text to identify questions, concerns, and relevant details.",
llm=llm_api,
callbacks=[langfuse_handler]
)
But couldn't able to get any tags or metadata in my trace.
5 Replies
Marc
Marc4w ago
Do I undersyand you correctly, you can see the input/output of your agent in Langfuse but you do not see the tags and metadata added via update_current_trace?
Ash
Ash4w ago
yes that is correct
Marc
Marc4w ago
this should work, can you open an issue for this on github? langfuse.com/issues
Ash
Ash3w ago
Hi Marc, That would be difficult; I won’t be able to share the code for replicating the issue. In my team, we are using the self-hosted version of Langfuse. Currently, I am facing another issue with the deployed version. It would be great if we could schedule a call with someone from the Langfuse team, to solve both the issues. Thank you!
Marc
Marc3w ago
thanks for scheduling some time, happy to quickly have a look together