创建Agent配置
创建agent.yaml配置文件。包含:name: hello_agent, description: 问候Agent, skills: [hello_skill], model: gpt-4。配置定义了Agent的基本信息和依赖的Skill。
实现Agent类
创建agent.py实现Agent类:class HelloAgent(BaseAgent): def process(self, input): skill = HelloSkill(); return skill.execute(name=input.user_name)。继承BaseAgent基类实现process方法。
注册Agent
注册Agent到系统:将Agent目录复制到/agents目录,或通过API注册POST /api/agents/register。注册后可以通过API调用Agent。
测试Agent
测试Agent调用:curl -X POST http://localhost:8000/api/agent/hello_agent -d '{"user_name": "测试"}'。返回:Hello, 测试! 测试成功。