Skip to content

feat: smart @mention booking flow with multi-attendee support#32

Draft
dhairyashiil wants to merge 2 commits intomainfrom
devin/1773320873-smart-mention-booking-flow
Draft

feat: smart @mention booking flow with multi-attendee support#32
dhairyashiil wants to merge 2 commits intomainfrom
devin/1773320873-smart-mention-booking-flow

Conversation

@dhairyashiil
Copy link
Member

feat: smart @mention booking flow with multi-attendee support

Summary

Upgrades the AI agent's booking flow so @Cal.com book a meeting with @bailey and @Keith Williams works end-to-end on Slack and Telegram — with clarification-first logic, multi-attendee resolution, and a fast-path for fully-specified requests.

System prompt changes (lib/agent.ts):

  • Rewrites the booking flow from "pick best match silently" to a 5-step clarification-first flow: resolve attendees → resolve event type → resolve date/time → confirm → multi-attendee handling
  • Adds a fast path that skips the confirmation round-trip when all details are unambiguous and the user says "go ahead" / "book it"
  • Relaxes CRITICAL RULES: allows re-calling check_availability for alternative slots, allows sequential tool calls during booking flows, allows same tool with different arguments (e.g. two lookup_platform_user calls for two users)

Tool & API changes:

  • book_meeting — adds optional guestEmails: string[] field, passed as guests in the POST /v2/bookings payload (Strategy A: email-only additional attendees in one call)
  • add_booking_attendee (new) — calls POST /v2/bookings/{uid}/attendees to add a full attendee record with name + timezone after booking (Strategy B: for Slack @mentions resolved via lookup_platform_user)
  • CreateBookingInput — adds guests?: string[]
  • AddAttendeeInput (new type) + addBookingAttendee() client function
  • check_availability — description updated to allow re-calls
  • MAX_STEPS — bumped 10 → 15 to accommodate multi-attendee flows

Files changed: lib/agent.ts, lib/calcom/client.ts, lib/calcom/types.ts

Review & Testing Checklist for Human

  • Verify POST /v2/bookings/{uid}/attendees endpoint exists in the Cal.com v2 API and accepts { name, email, timeZone }. The addBookingAttendee function assumes this endpoint — if it doesn't exist, the add_booking_attendee tool will always error at runtime.
  • Verify guests field is accepted by POST /v2/bookings. The book_meeting tool now passes guests: ["email@example.com"] — confirm the Cal.com API accepts this and actually adds them to the calendar event.
  • Manual Slack test: Try @Cal.com book a meeting with @someone and verify the agent asks for event type and time instead of silently picking. Try with two @mentions to test multi-attendee flow.
  • Manual Slack fast-path test: Try @Cal.com book a 30 min meeting with @someone at 3pm tomorrow, go ahead — should book immediately without asking for confirmation.
  • Manual Telegram test: Try book a meeting with John (john@example.com) — verify it asks for event type and time, then confirms before booking.
  • Review system prompt for contradictions between the new booking flow instructions and the relaxed CRITICAL RULES (especially rules 3, 4, 6).

Notes

  • All type errors in the changed files are pre-existing (missing ai/chat/zod module declarations and Node types — these resolve when dependencies are installed). No new type errors introduced.
  • The prompt changes are the highest-risk area since LLM behavior is non-deterministic and can't be verified by CI.
  • No automated tests added — the companion repo doesn't have an agent test suite, and the changes are primarily prompt engineering + thin API wrappers.

Link to Devin Session: https://app.devin.ai/sessions/f69e6c70ee544da7b5b6e91a9b73d29b
Requested by: @dhairyashiil

- Rewrite booking flow in system prompt to clarification-first logic
  with fast-path for fully-specified requests
- Add guestEmails field to book_meeting tool for email-only additional
  attendees (Strategy A: guests array in initial POST)
- Add add_booking_attendee tool for full attendee records with name +
  timezone after booking (Strategy B: POST /bookings/{uid}/attendees)
- Add AddAttendeeInput type and addBookingAttendee() client function
- Add guests field to CreateBookingInput type
- Relax CRITICAL RULES to support multi-step booking flows and
  re-calling check_availability for alternative slots
- Update check_availability description to allow re-calls
- Bump MAX_STEPS from 10 to 15 for multi-attendee flows
- Update Available Capabilities to list add_booking_attendee
@vercel
Copy link

vercel bot commented Mar 12, 2026

Deployment failed with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: companion-chat.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant