In the example from the chapter, what is the sequence of tool calls the agent makes to make the room comfortable for sleeping, and what information does it gather before making those calls?
The agent first gathers information by calling check_temperature() and check_light(). After learning the room is 24°C and the light is ON, it makes two further tool calls: set_thermostat(temp=20) and dim_lights(). Once both succeed, it tells the user that the thermostat is set to 20°C and the lights are dimmed for sleeping.
In the example, the agent is given tools to check temperature, check light status, set the thermostat, and dim the lights. Given the user request 'Make the room comfortable for sleeping,' the agent begins by calling check_temperature() and check_light() because it needs to know the current conditions before acting. The tool results reveal that the temperature is 24 Celsius and the room light is ON. Using this information, the agent decides that the room is too warm and too bright for sleeping, so it fires two more tool calls: set_thermostat(temp=20) and dim_lights(). Both calls return SUCCESS. With no further actions needed, the agent sends the user a final answer: it has set the thermostat to 20°C and dimmed the lights, so the room should soon be comfortable for sleeping.
Key points
- The agent's first tool calls are check_temperature() and check_light().
- Before acting, it gathers that the room temperature is 24 Celsius and the light is ON.
- It then calls set_thermostat(temp=20) and dim_lights() to adjust the room.
- Both actions return SUCCESS, so the agent responds directly to the user without more tool calls.
Related questions
AI Agents and Applications
Andrea De Mauro
MEAP Edition Version 7 · Manning Publications