@@ -354,6 +354,8 @@ async def main():
354354 reasoning_effort (string): Optional. The reasoning effort for the LM call
355355 between ['minimal', 'low', 'medium', 'high', 'disable', 'none', None].
356356 Default to None (no reasoning).
357+ use_chain_of_thought (bool): Optional. Use chain of thought for tool calls generator,
358+ usefull when using non-reasoning models. Default False.
357359 tools (list): The list of `Tool` or MCP tools available to the agent.
358360 autonomous (bool): Optional. Whether the agent runs autonomously
359361 (executing tools automatically) or in interactive mode where the user
@@ -379,6 +381,7 @@ def __init__(
379381 use_inputs_schema = False ,
380382 use_outputs_schema = False ,
381383 reasoning_effort = None ,
384+ use_chain_of_thought = False ,
382385 tools = None ,
383386 autonomous = True ,
384387 return_inputs_with_trajectory = True ,
@@ -409,6 +412,7 @@ def __init__(
409412 self .use_inputs_schema = use_inputs_schema
410413 self .use_outputs_schema = use_outputs_schema
411414 self .reasoning_effort = reasoning_effort
415+ self .use_chain_of_thought = use_chain_of_thought
412416 self .language_model = language_model
413417
414418 self .tools = {}
@@ -422,19 +426,34 @@ def __init__(
422426 self .return_inputs_with_trajectory = return_inputs_with_trajectory
423427 self .max_iterations = max_iterations
424428
425- self .tool_calls_generator = ChainOfThought (
426- schema = tool_calls_schema ,
427- prompt_template = self .prompt_template ,
428- examples = self .examples ,
429- instructions = self .instructions ,
430- temperature = self .temperature ,
431- use_inputs_schema = self .use_inputs_schema ,
432- use_outputs_schema = self .use_outputs_schema ,
433- reasoning_effort = self .reasoning_effort ,
434- language_model = self .language_model ,
435- name = "tool_calls_generator_" + self .name ,
436- )
429+ if use_chain_of_thought :
430+ self .tool_calls_generator = ChainOfThought (
431+ schema = tool_calls_schema ,
432+ prompt_template = self .prompt_template ,
433+ examples = self .examples ,
434+ instructions = self .instructions ,
435+ temperature = self .temperature ,
436+ use_inputs_schema = self .use_inputs_schema ,
437+ use_outputs_schema = self .use_outputs_schema ,
438+ reasoning_effort = self .reasoning_effort ,
439+ language_model = self .language_model ,
440+ name = "tool_calls_generator_" + self .name ,
441+ )
442+ else :
443+ self .tool_calls_generator = Generator (
444+ schema = tool_calls_schema ,
445+ prompt_template = self .prompt_template ,
446+ examples = self .examples ,
447+ instructions = self .instructions ,
448+ temperature = self .temperature ,
449+ use_inputs_schema = self .use_inputs_schema ,
450+ use_outputs_schema = self .use_outputs_schema ,
451+ reasoning_effort = self .reasoning_effort ,
452+ language_model = self .language_model ,
453+ name = "tool_calls_generator_" + self .name ,
454+ )
437455
456+
438457 self .final_generator = Generator (
439458 schema = self .schema ,
440459 language_model = self .language_model ,
0 commit comments