update readme
🤗 Hugging Face | 📑 Paper
[ English | 中文 ]
在多agent系统中,能否选择合适的agent来解决用户的问题决定了整个系统的效果。
TCAndonRouter 是一个以推理为核心的多意图路由模块,其主要任务是多agent系统中的agent路由选择,除此之外,你也可以把TCAndonRouter用在任何的意图场景包括agent skills的选择,TCAndonRouter的优势为:
TCAndonRouter 采用监督微调(SFT)+ 强化学习(DAPO)进行训练,在 HWU64、MINDS14、SGD 以及腾讯云ITSM数据集(QCloud)等大规模真实企业数据集上达到了SOTA的效果。
修改 config/llm_config.toml 支持任意的llm,如需测试TCAndonRouter,建议使用vllm进行部署并修改该配置。 参考 example.py:
config/llm_config.toml
example.py
from llm_client import completion from prompt import router_prompt from utils import load_config agents = load_config('config/hwu64_config.xml') query = "Can you recommend any pub in mg road" prompt = router_prompt.format(agents=agents) + 'user:' + query message = [{'role': 'user', 'content': prompt}] response = completion(message) print(response)
from transformers import AutoModelForCausalLM, AutoTokenizer from prompt import router_prompt from utils import load_config tokenizer = AutoTokenizer.from_pretrained("tencent/TCAndon-Router") model = AutoModelForCausalLM.from_pretrained("tencent/TCAndon-Router", device_map="auto") agents = load_config('config/hwu64_config.xml') query = "Can you recommend any pub in mg road" prompt = router_prompt.format(agents=agents) + 'user:' + query messages = [{"role": "user", "content": prompt}] encoding = tokenizer.apply_chat_template( messages, tokenize=True, add_generation_prompt=False, return_tensors="pt" ) outputs = model.generate(encoding.to(model.device), max_new_tokens=2048) output_text = tokenizer.decode(outputs[0]) print(output_text)
我们提供了一个脚本来评估四个开源数据集。
bash run_eval.sh
如果你想在自己的数据集上使用 TCAndonRouter,需要提供agent描述,所需格式定义在 config/xxx_config.xml 中。 你可以使用 generate_agent_desc.py 通过 LLM 生成描述,或手动编写。
config/xxx_config.xml
generate_agent_desc.py
python generate_agent_desc.py --dataset hwu64 --limit 50
Refining Agent将多个agent的输出合并为单一的最终回复,更多详情请参考 example.py。
from llm_client import completion from prompt import refine_prompt answer_str = '' for intent in intent_list: print('executing intent: ', intent) agent_result = agent(query, intent) answer_str += f'# The answer of {intent}\n{agent_result}\n' prompt = refine_prompt.format(query=query, answer=answer_str) message = [{'role': 'user', 'content': prompt}] response = completion(message)
如果你在工作中使用了TCAndonRouter,请引用我们的paper:
@article{zhao2026TCAndonRouter, title={TCAndonRouter: Adaptive Reasoning Router for Multi-Agent Collaboration}, author={Jiuzhou Zhao, Chunrong Chen, Chenqi Qiao, Lebin Zheng, Minqi Han, Yanchi Liu, Yongzhou Xu, Xiaochuan Xu, Min Zhang}, journal={arXiv preprint:2601.04544}, year={2026} }
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
TCAndon-Router
🤗 Hugging Face | 📑 Paper
[ English | 中文 ]
🌟 简介
在多agent系统中,能否选择合适的agent来解决用户的问题决定了整个系统的效果。
TCAndonRouter 是一个以推理为核心的多意图路由模块,其主要任务是多agent系统中的agent路由选择,除此之外,你也可以把TCAndonRouter用在任何的意图场景包括agent skills的选择,TCAndonRouter的优势为:
TCAndonRouter 采用监督微调(SFT)+ 强化学习(DAPO)进行训练,在 HWU64、MINDS14、SGD 以及腾讯云ITSM数据集(QCloud)等大规模真实企业数据集上达到了SOTA的效果。
🔧 使用方法
使用vllm
修改
config/llm_config.toml支持任意的llm,如需测试TCAndonRouter,建议使用vllm进行部署并修改该配置。 参考example.py:使用 HuggingFace
评估
我们提供了一个脚本来评估四个开源数据集。
生成agent描述
如果你想在自己的数据集上使用 TCAndonRouter,需要提供agent描述,所需格式定义在
config/xxx_config.xml中。 你可以使用generate_agent_desc.py通过 LLM 生成描述,或手动编写。Refining Agent
Refining Agent将多个agent的输出合并为单一的最终回复,更多详情请参考
example.py。🤝 引用
如果你在工作中使用了TCAndonRouter,请引用我们的paper: