@@ -815,22 +815,76 @@ def _resolve(obj):
815815 return _resolve (raw )
816816
817817 def _create_agents_from_config (self , agents_cfg : Dict [str , Dict [str , Any ]]) -> None :
818- """Create and register Agent instances from the agents section of gateway.yaml."""
818+ """Create and register Agent instances from the agents section of gateway.yaml.
819+
820+ Supports all agent configuration options including:
821+ - tools: List of tool names to resolve via ToolResolver
822+ - tool_choice: Tool selection mode ('auto', 'required', 'none')
823+ - reflection: Enable reflection/interactive mode (default: True)
824+ - allow_delegation: Allow task delegation
825+ - role: Agent role (CrewAI-style)
826+ - goal: Agent goal (CrewAI-style)
827+ - backstory: Agent backstory (CrewAI-style)
828+ """
819829 from praisonaiagents import Agent
820830
831+ # G1: Resolve tool names to callables (same pattern as agents_generator)
832+ tool_resolver = None
833+ try :
834+ from praisonai .tool_resolver import ToolResolver
835+ tool_resolver = ToolResolver ()
836+ except ImportError :
837+ logger .debug ("ToolResolver not available, agents will have no tools" )
838+
821839 for agent_id , agent_def in agents_cfg .items ():
822840 instructions = agent_def .get ("instructions" , "" )
823841 model = agent_def .get ("model" , None )
824842 memory = agent_def .get ("memory" , False )
843+
844+ # G4: Support role/goal/backstory for CrewAI-style agents
845+ role = agent_def .get ("role" , None )
846+ goal = agent_def .get ("goal" , None )
847+ backstory = agent_def .get ("backstory" , None )
848+
849+ # G1: Resolve tools from YAML config
850+ agent_tools = []
851+ yaml_tool_names = agent_def .get ("tools" , [])
852+ if yaml_tool_names and tool_resolver :
853+ for tool_name in yaml_tool_names :
854+ if not tool_name or not isinstance (tool_name , str ):
855+ continue
856+ tool_name = tool_name .strip ()
857+ resolved = tool_resolver .resolve (tool_name )
858+ if resolved :
859+ agent_tools .append (resolved )
860+ logger .debug (f"Resolved tool '{ tool_name } ' for agent '{ agent_id } '" )
861+ else :
862+ logger .warning (f"Tool '{ tool_name } ' not found for agent '{ agent_id } '" )
863+
864+ # Additional agent options from YAML
865+ tool_choice = agent_def .get ("tool_choice" , None )
866+ reflection = agent_def .get ("reflection" , True ) # Default: enable reflection/interactive mode
867+ allow_delegation = agent_def .get ("allow_delegation" , False )
825868
826869 agent = Agent (
827870 name = agent_id ,
828871 instructions = instructions ,
829872 llm = model ,
830873 memory = memory ,
874+ tools = agent_tools if agent_tools else None ,
875+ reflection = reflection ,
876+ allow_delegation = allow_delegation ,
877+ role = role ,
878+ goal = goal ,
879+ backstory = backstory ,
831880 )
881+
882+ # Store tool_choice for later use in chat()
883+ if tool_choice :
884+ agent ._yaml_tool_choice = tool_choice
885+
832886 self .register_agent (agent , agent_id = agent_id )
833- logger .info (f"Created agent '{ agent_id } ' (model={ model } )" )
887+ logger .info (f"Created agent '{ agent_id } ' (model={ model } , tools= { len ( agent_tools ) } , reflection= { reflection } )" )
834888
835889 def _determine_routing_context (
836890 self , channel_type : str , message_metadata : Dict [str , Any ]
0 commit comments