Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CrewAI Multi Tool Usage Single Trace Problem #3090

Unanswered
OnurYigitArpali asked this question in Q&A
Discussion options

I want to integrate langfuse to crewai. There is one crew having an agent that use multiple custom tools. After a single execution, i expect to create single trace by Langfuse. But it creates multiple trace entities for tools, generations, etc as seen in the images. I already tried the methods discussed in https://github.com/orgs/langfuse/discussions/6291. Also check the related documents, but i could not to create single trace.

Screenshot 2025年07月01日 at 10 37 09 Screenshot 2025年07月01日 at 10 36 56 Screenshot 2025年07月01日 at 10 32 40
from crewai.project import CrewBase, agent, crew, task
from langfuse import Langfuse
import openlit
from tools import (x,y)
@CrewBase
class AnalyzerCrew():
 agents_config = 'config/agents.yaml'
 tasks_config = 'config/tasks.yaml'
 @agent
 def planner(self) -> Agent:
 return Agent(
 config=self.agents_config['planner'],
 tools=[
 x,y
 ],
 verbose=True,
 allow_delegation=False,
 max_iter=2,
 max_rpm=15,
 max_execution_time=300
 )
 @task
 def research_planning(self) -> Task:
 return Task(
 config=self.tasks_config['research_planning'],
 agent=self.planner(),
 output_pydantic=ResearchPlan,
 output_file='research_plan.json'
 )
 @crew
 def crew(self) -> Crew:
 """Creates the CTI research planning crew - first stage of multi-agent workflow"""
 return Crew(
 agents=self.agents,
 tasks=self.tasks,
 process=Process.sequential,
 verbose=True,
 planning=True,
 planning_llm="openai/gpt-4o-mini"
 )
_langfuse_client = Langfuse(
 public_key=config.public_key,
 secret_key=config.secret_key,
 host=config.host,
 debug=config.debug
)
openlit.init(
 tracer=client._otel_tracer,
 disable_batch=True
)
with _langfuse_client.start_as_current_span(
 name="Analysis Workflow"
) as span:
 # Initialize crew
 crew = AnalyzerCrew()
 print(f"✅ Crew initialized successfully")
 
 # Run analysis
 result = crew.crew().kickoff(
 inputs={'text': text, 'output_dir': output_dir}
 )
You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /