Start with the failure you need to prevent
A user asks an assistant to book a meeting at 3 p.m. Another appointment already occupies that time. The assistant should explain the conflict and offer alternatives. It should leave the calendar unchanged until the user chooses a valid time.
A prompt can describe this behaviour, but the component that writes the appointment needs its own check. In my Strands Calendar Agent reference project, the application checks for overlapping appointments before creating or moving a booking.
Design decision: use the model to interpret the request and explain the result. Use application code to check the scheduling rule.
Put the decision at the write boundary
The example uses Strands Agents with Amazon Bedrock for the conversation, TypeScript tools for calendar operations and SQLite for persistence. The create tool follows this sequence:
- Validate the requested date format and duration.
- Query stored appointments for overlapping time ranges.
- If a conflict exists, return the conflicting appointments and up to three nearby available start times. Do not create a booking.
- If the slot is available, create the appointment and return its identifier.
The update tool applies the same conflict check when the start time or duration changes. It excludes the appointment being moved from that check.
Return a result the agent can act on
The tool returns a structured conflict result with a status, the requested time, conflicting appointments and suggested alternatives. That gives the model concrete information to explain. The following pseudocode summarises the create path; it is not a copy-and-paste implementation.
validate(request)
conflicts = findOverlappingAppointments(request)
if conflicts exist:
return conflict(conflicts, nearestAvailableSlots(request))
return createAppointment(request)
Suggested times come from calendar logic, within the configured working day. The model can present those times to the user without calculating availability itself. The tool implementation contains the input schemas, overlap checks and response construction.
State the limits of the example
This is a local reference application. It demonstrates a useful boundary, but the check-before-write flow alone does not establish a concurrency guarantee for a multi-user service. Two requests could both check a free slot before either writes. A deployed service needs an atomic reservation strategy appropriate to its database and transaction model.
The cancellation tool also accepts a confirmation flag. That is useful for demonstrating a conversation flow, but a model-supplied Boolean is not independent evidence of user approval. For consequential actions, the application should record and validate approval outside the model’s arguments.
Timezone handling, tenant isolation, authorisation and external calendar synchronisation need their own design and tests before adapting this pattern for a shared service.
Test the rule separately from the conversation
The project includes calendar rule and configuration tests. For your own implementation, start with checks that do not depend on model output:
- An overlapping create request leaves stored appointments unchanged.
- A conflicting move preserves the original appointment.
- Adjacent appointments follow the chosen interval boundary rule.
- Suggested times fit the requested duration and working hours.
- Invalid input fails before any mutation.
Then evaluate the conversation: does the assistant explain the conflict, use returned alternatives and ask the user to choose? For a shared service, add concurrent write tests and authorisation tests at the persistence boundary.
Keeping these layers separate makes failures easier to diagnose. The model interprets intent. The tool checks the request. The persistence layer must enforce the guarantees the service promises.
Source and scope: based on the public Strands Calendar Agent educational project. The production considerations above are design recommendations, not claims about features implemented in the sample.