ComenzarEmpieza gratis

One Prompt, Many Tools

You've already created two tools for AgentsCafé:

  • generate_order_id: produces a timestamped ID like T5_Latte_20250812_0915
  • lookup_orders: reads orders.csv and returns a list of drinks for that table

Now let's create an agent that uses those two tools. So, for any table, the agent can fetch its orders and assign a unique ID to each drink.

Note: The model, tools and necessary imports have already been defined for you. A sample orders.csv is uploaded as well.

Este ejercicio forma parte del curso

AI Agents with Hugging Face smolagents

Ver curso

Instrucciones del ejercicio

  • Create a coding agent using your previously defined lookup_orders and generate_order_id tools.
  • Add pandas to the list of authorized imports to ensure the agent can read the CSV.
  • Use the agent's .run() method to process a task that fetches orders for a table and assigns IDs.

Ejercicio interactivo práctico

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

# Create a code agent with the lookup_orders and generate_order_id tools
agent = CodeAgent(
    tools=[____, ____],
    model=model,
    # Authorize pandas import
    additional_authorized_imports=['____']
)

task = (
    "For table 5, list their current drink orders and generate a unique order ID for each one."
)

# Run the agent passing the task
result = ____
print(result)
Editar y ejecutar código