@@ -232,23 +232,21 @@ def create_tools(self) -> list:
232232 return tools_list
233233
234234 def _convert_tool (self , base_tool ):
235- """Convert BaseTool to framework-specific tool type .
235+ """Convert BaseTool to framework-specific tool adapter .
236236
237237 Args:
238238 base_tool: BaseTool instance
239239
240240 Returns:
241- Framework-specific tool object with tracing preserved
241+ Tool adapter with gather_traces() for tracing support.
242+ For smolagents: SmolagentsToolAdapter (has .tool attribute for raw Tool)
243+ For langgraph: LangGraphToolAdapter (has .tool attribute for StructuredTool)
244+ For llamaindex: LlamaIndexToolAdapter (has .tool attribute for FunctionTool)
242245 """
243246 if self .framework == "smolagents" :
244- adapter = base_tool .to_smolagents ()
245- # Return the actual tool, not the adapter
246- # The adapter has a .tool attribute with the smolagents Tool instance
247- return adapter .tool if hasattr (adapter , "tool" ) else adapter
247+ return base_tool .to_smolagents ()
248248 elif self .framework == "langgraph" :
249- adapter = base_tool .to_langgraph ()
250- # LangGraph adapter already returns the StructuredTool directly
251- return adapter
249+ return base_tool .to_langgraph ()
252250 elif self .framework == "llamaindex" :
253251 return base_tool .to_llamaindex ()
254252 else :
@@ -339,7 +337,7 @@ def _setup_single_agent(
339337 temperature : float ,
340338 ) -> tuple [List [AgentAdapter ], Dict [str , AgentAdapter ]]:
341339 """Setup a single agent with all tools."""
342- tools = environment .get_tools ()
340+ tool_adapters = environment .get_tools ()
343341 agent_spec = agent_data ["agent" ]
344342
345343 # Sanitize agent name to be a valid Python identifier for smolagents
@@ -351,6 +349,9 @@ def _setup_single_agent(
351349 # Create smolagents model
352350 model = get_model (model_id , framework , temperature )
353351
352+ # Extract raw smolagents Tool objects from adapters
353+ tools = [adapter .tool for adapter in tool_adapters ]
354+
354355 # Create agent
355356 agent = ToolCallingAgent (
356357 model = model ,
@@ -375,6 +376,9 @@ def _setup_single_agent(
375376 # Create LangChain model
376377 model = get_model (model_id , framework , temperature )
377378
379+ # Extract raw LangChain StructuredTool objects from adapters
380+ tools = [adapter .tool for adapter in tool_adapters ]
381+
378382 # Create agent graph
379383 class AgentState (TypedDict ):
380384 messages : Annotated [List [Any ], add_messages ]
@@ -412,6 +416,9 @@ def call_model(state: AgentState):
412416 # Create LlamaIndex LiteLLM model (supports Gemini via 'gemini/' prefix)
413417 model = get_model (model_id , framework , temperature )
414418
419+ # Extract raw LlamaIndex FunctionTool objects from adapters
420+ tools = [adapter .tool for adapter in tool_adapters ]
421+
415422 # Create ReActAgent with tools
416423 agent = ReActAgent .from_tools (
417424 tools = tools ,
@@ -463,7 +470,8 @@ def _setup_multi_agent(
463470
464471 # Create specialist agents
465472 specialist_agents = []
466- all_tools = environment .get_tools ()
473+ all_tool_adapters = environment .get_tools ()
474+ all_tools = [adapter .tool for adapter in all_tool_adapters ]
467475
468476 for agent_spec in specialist_specs :
469477 # Get tools for this specialist
@@ -521,7 +529,8 @@ class MultiAgentState(TypedDict):
521529 messages : Annotated [List [Any ], add_messages ]
522530 next_agent : str
523531
524- all_tools = environment .get_tools ()
532+ all_tool_adapters = environment .get_tools ()
533+ all_tools = [adapter .tool for adapter in all_tool_adapters ]
525534
526535 # Create specialist agent nodes
527536 specialist_nodes = {}
@@ -628,7 +637,8 @@ def route_to_specialist(state: MultiAgentState) -> Literal["orchestrator", "__en
628637 # Create LlamaIndex LiteLLM model (supports Gemini via 'gemini/' prefix)
629638 model = get_model (model_id , framework , temperature )
630639
631- all_tools = environment .get_tools ()
640+ all_tool_adapters = environment .get_tools ()
641+ all_tools = [adapter .tool for adapter in all_tool_adapters ]
632642
633643 # Create specialist agents
634644 specialist_agents_dict = {}
0 commit comments