ComenzarEmpieza gratis

Divide and Conquer: Creating Specialist Agents

You're helping your younger sister apply to computer science programs. It's a lot to manage: researching schools, comparing programs, and writing strong essays.

To make the process easier, you decide to build two specialized agents:

  • One to research universities and their requirements
  • One to help write compelling application essays

You have access to the CodeAgent and WebSearchTool classes, as well as a pre-configured model.

Este ejercicio forma parte del curso

AI Agents with Hugging Face smolagents

Ver curso

Instrucciones del ejercicio

  • In the first agent, set the tools parameter to include the WebSearchTool.
  • Still in the first agent, provide a name string to identify it as the school research agent.
  • In the second agent, set the model parameter to use the provided model variable.
  • Finally, complete the second agent's description to summarize its purpose.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# School research specialist
school_agent = CodeAgent(
    # Assign a list of tools the agent can use
    ____=[WebSearchTool()],
    model=model,
    # Set the agent's unique name identifier
    ____="school_research_agent",
    description="Expert in researching universities, programs, and admission requirements"
)

# Essay writing specialist  
essay_agent = CodeAgent(
    tools=[WebSearchTool()],
    # Provide the model used to generate responses
    ____=model,
    name="essay_writing_agent",
    # Write a short description of the agent's area of expertise
    ____="Expert in crafting compelling college application essays and personal statements"
)
Editar y ejecutar código