# Small Quiz (ungraded) [[quiz2]]

It's time to test your understanding of the *Code Agents*, *Tool Calling Agents*, and *Tools* sections. This quiz is optional and not graded.

---

### Q1: What is the key difference between creating a tool with the `@tool` decorator versus creating a subclass of `Tool` in smolagents?

Which statement best describes the distinction between these two approaches for defining tools?

@tool decorator is mandatory for retrieval-based tools, while subclasses of Tool are only for text-generation tasks",
    explain: "Both approaches can be used for any type of tool, including retrieval-based or text-generation tools.",
  },
  {
    text: "The @tool decorator is recommended for simple function-based tools, while subclasses of Tool offer more flexibility for complex functionality or custom metadata",
    explain: "This is correct. The decorator approach is simpler, but subclassing allows more customized behavior.",
    correct: true
  },
  {
    text: "@tool can only be used in multi-agent systems, while creating a Tool subclass is for single-agent scenarios",
    explain: "All agents (single or multi) can use either approach to define tools; there is no such restriction.",
  },
  {
    text: "Decorating a function with @tool replaces the need for a docstring, whereas subclasses must not include docstrings",
    explain: "Both methods benefit from clear docstrings. The decorator doesn't replace them, and a subclass can still have docstrings.",
  }
]}
/>

---

### Q2: How does a CodeAgent handle multi-step tasks using the ReAct (Reason + Act) approach?

Which statement correctly describes how the CodeAgent executes a series of steps to solve a task?

---

### Q3: Which of the following is a primary advantage of sharing a tool on the Hugging Face Hub?

Select the best reason why a developer might upload and share their custom tool.

---

### Q4: ToolCallingAgent differs from CodeAgent in how it executes actions. Which statement is correct?

Choose the option that accurately describes how ToolCallingAgent works.

---

### Q5: What is included in the smolagents default toolbox, and why might you use it?

Which statement best captures the purpose and contents of the default toolbox in smolagents?

---

Congratulations on completing this quiz! 🎉 If any questions gave you trouble, revisit the *Code Agents*, *Tool Calling Agents*, or *Tools* sections to strengthen your understanding. If you aced it, you're well on your way to building robust smolagents applications!

