# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates # SPDX-License-Identifier: MIT from langgraph.prebuilt import create_react_agent from src.config.agents import AGENT_LLM_MAP from src.llms.llm import get_llm_by_type from src.prompts import apply_prompt_template # Create agents using configured LLM types def create_agent( agent_name: str, agent_type: str, tools: list, prompt_template: str, pre_model_hook: callable = None, ): """Factory function to create agents with consistent configuration.""" return create_react_agent( name=agent_name, model=get_llm_by_type(AGENT_LLM_MAP[agent_type]), tools=tools, prompt=lambda state: apply_prompt_template( prompt_template, state, locale=state.get("locale", "en-US") ), pre_model_hook=pre_model_hook, )