多智能体系统简介

使用 Hugging Face smolagents 的 AI Agents

Adel Nehme

VP of AI Curriculum, DataCamp

情景:职业顾问代理

该请求包含多项任务:

  • 简历更新
  • 求职搜索
  • 面试准备
  • 薪资调研

每项任务需要不同的工具与流程!

使用 Hugging Face smolagents 的 AI Agents

为何使用多智能体系统?

  • 使用一组专业化代理
  • 各代理专注于单一任务或领域
  • 防止过载与混乱

使用 Hugging Face smolagents 的 AI Agents

专业的简历代理

resume_agent = CodeAgent(
    tools=[WebSearchTool(), skill_translator, layout_generator],
    model=InferenceClientModel(),
    instructions="You are an expert in everything related to resumes.",
    name="resume_agent",
    description="Expert in resume writing and skill translation for career transitions"
)
使用 Hugging Face smolagents 的 AI Agents

公司调研专家

company_agent = CodeAgent(
    tools=[WebSearchTool(), background_compatibility_checker],
    model=InferenceClientModel(),
    instructions="You are an expert in everything related to company research",
    name="company_agent",
    description="Expert in researching companies, culture, and hiring practices for job seekers"
)
  • 按相同模式创建更多专业代理。
使用 Hugging Face smolagents 的 AI Agents

管理者代理

career_manager = CodeAgent(
    tools=[],
    model=InferenceClientModel(model_id="deepseek-ai/DeepSeek-R1"), # Reasoning model
    instructions="You are an advisory agent to help professionals build stellar careers",
    managed_agents=[resume_agent, company_agent, interview_agent, salary_agent]
)
  • 根据描述将任务分配给合适的专家。
  • 通过 managed_agents 参数协调四个专家代理。
  • 受益于具备强推理与协同能力的模型。
使用 Hugging Face smolagents 的 AI Agents

多智能体编排

result = career_manager.run("I want to switch from marketing to data science. 
Help me update my resume, find companies hiring, prepare for interviews, and understand salaries.")

使用 Hugging Face smolagents 的 AI Agents

开始练习吧!

使用 Hugging Face smolagents 的 AI Agents

Preparing Video For Download...