@@ -429,6 +429,16 @@ async def on_handoff_hook(
429429
430430 # optional global vars available for the taskflow tasks
431431 global_variables = taskflow .get ('globals' , {})
432+ model_config = taskflow .get ('model_config' , {})
433+ if model_config :
434+ model_dict = available_tools .model_config .get (model_config , {})
435+ if not model_dict :
436+ raise ValueError (f"No such model config: { model_config } " )
437+ model_dict = model_dict .get ('models' , {})
438+ if model_dict :
439+ if not isinstance (model_dict , dict ):
440+ raise ValueError (f"Models section of the model_config file { model_conig } must be a dictionary" )
441+ model_keys = model_dict .keys ()
432442
433443 for task in taskflow ['taskflow' ]:
434444
@@ -448,7 +458,9 @@ async def on_handoff_hook(
448458 for k ,v in reusable_taskflow ['taskflow' ][0 ]['task' ].items ():
449459 if k not in task_body :
450460 task_body [k ] = v
451-
461+ model = task_body .get ('model' , DEFAULT_MODEL )
462+ if model in model_keys :
463+ model = model_dict [model ]
452464 # parse our taskflow grammar
453465 name = task_body .get ('name' , 'taskflow' ) # placeholder, not used yet
454466 description = task_body .get ('description' , 'taskflow' ) # placeholder not used yet
@@ -465,7 +477,6 @@ async def on_handoff_hook(
465477 toolboxes_override = task_body .get ('toolboxes' , [])
466478 env = task_body .get ('env' , {})
467479 repeat_prompt = task_body .get ('repeat_prompt' , False )
468- model = task_body .get ('model' , DEFAULT_MODEL )
469480 # this will set Agent 'stop_on_first_tool' tool use behavior, which prevents output back to llm
470481 exclude_from_context = task_body .get ('exclude_from_context' , False )
471482 # this allows you to run repeated prompts concurrently with a limit
@@ -600,6 +611,7 @@ async def _deploy_task_agents(resolved_agents, prompt):
600611 run_hooks = TaskRunHooks (
601612 on_tool_end = on_tool_end_hook ,
602613 on_tool_start = on_tool_start_hook ),
614+ model = model ,
603615 agent_hooks = TaskAgentHooks (
604616 on_handoff = on_handoff_hook ))
605617 return result
@@ -643,7 +655,8 @@ async def _deploy_task_agents(resolved_agents, prompt):
643655 YamlParser (cwd ).get_yaml_dict ((cwd / 'personalities' ).rglob ('*' )) |
644656 YamlParser (cwd ).get_yaml_dict ((cwd / 'taskflows' ).rglob ('*' )) |
645657 YamlParser (cwd ).get_yaml_dict ((cwd / 'prompts' ).rglob ('*' )) |
646- YamlParser (cwd ).get_yaml_dict ((cwd / 'toolboxes' ).rglob ('*' )))
658+ YamlParser (cwd ).get_yaml_dict ((cwd / 'toolboxes' ).rglob ('*' )) |
659+ YamlParser (cwd ).get_yaml_dict ((cwd / 'configs' ).rglob ('*' )))
647660
648661 p , t , l , user_prompt , help_msg = parse_prompt_args (available_tools )
649662
0 commit comments