Tool Use

agentsnotebookscohere-developer-experience

Calendar Agent Multi-Step tool use with the Cohere Chat API

In the example below, we demonstrate how to use the cohere Chat API with the list_calendar_events and create_calendar_event tools to book appointments. Booking the correct appointment requires the model to first check for an available slot by listing existing events, reasoning about the correct slot to book the new appointment and then finally invoking the right tool to create the calendar event. To learn more about Tool Use, read the official multi-step tool use guide.

[5]
[6]
[7]
[8]
I will check the user's calendar for today after 3pm and book an hour-long appointment in the first available slot.
Listing events: [{"start": "14:00", "end": "15:00"}, {"start": "15:00", "end": "16:00"}, {"start": "17:00", "end": "18:00"}]
The user has events scheduled from 2pm to 4pm and from 5pm to 6pm. I will book an hour-long appointment from 4pm to 5pm.
Creating a 1 hour long event at 16:00 on 05/23/2024
I've booked an hour-long appointment for you today from 4pm to 5pm.