AI agents and scheduling API architecture
Meeting Scheduling API: Rank Hard Constraints Before Preferences
The ‘best’ meeting time is meaningless until the valid set exists. Tuesday morning may satisfy the organizer’s preference and include the optional executive. It still loses if one required engineer is busy, the customer has not confirmed a time zone, or the availability snapshot predates a calendar change. Put preferences into the hard-constraint phase and the API will return polished nonsense.
Build the two-stage slot engine in eight steps
Use one sixty-minute implementation review across two companies. Three people are required, one executive is optional, two calendars are connected through Google and Microsoft, one required customer will reply without connecting, and the organizer prefers mornings. The engine must explain why each slot is valid before it explains why one valid slot ranks first.
- 1
Compile the instruction into typed meeting intent
Storemeeting_request_id, revision, authenticated organizer, purpose, duration, bounded date window, deadline, meeting IANA time zone, location, required and optional participants, approved substitutes, working-hour policy, buffers, preferences, outreach consent, approval mode, and allowed calendar actions. Preserve the source instruction but run matching against the typed revision.- Reject missing organizer, duration, bounded window, deadline, or required participant.
- Separate hard constraints, soft preferences, and facts that still need clarification.
- Every availability record, proposal, approval, and booking points to the current revision.
- 2
Write the hard-constraint contract first
Treat required attendance, authorized substitutes, duration, date bounds, explicit blackouts, minimum notice, mandatory buffers, location limits, consent, and valid time-zone interpretation as pass-or-fail rules. Decide whether working hours are hard or soft for each participant. Keep optional attendance and organizer preference out of validity.- The engine cannot drop a required person to manufacture a slot.
- An optional decline never turns a valid slot invalid.
- Only an authorized organizer revision can relax a hard rule.
- 3
Collect availability with source and consent
Read approved Google and Microsoft free/busy for connected calendars. For an unconnected participant, send an approved request for bounded windows, parse the reply into the participant’s local zone, and record consent, message ID, reply time, source, and freshness. A calendar connection reduces work; it is not a condition for joining the meeting.- Possessing an address does not grant outreach permission.
- Missing provider access or participant silence is missing evidence, not open time.
- Private event titles, descriptions, and unrelated attendees never enter the slot record.
- 4
Normalize intervals without erasing meaning
Convert provider busy ranges and participant windows into canonical half-open intervals while preserving original local input, IANA zone, account, provider, retrieval or reply time, freshness policy, consent state, and typed error. Expand recurring and daylight-saving cases against the meeting window rather than freezing a current UTC offset.- Ambiguous date or zone language triggers one narrow clarification.
- A numeric offset alone is not a durable participant time zone.
- Corrections supersede old intervals and mark derived proposals stale.
- 5
Generate the valid set from required overlap
Subtract every required participant’s busy intervals, explicit blackouts, buffers, and notice rules from the bounded search window. Intersect the remaining windows and cut them into duration-sized candidates. Attach the exact required evidence versions and constraint decisions to each survivor. Do not score anything that failed validity.- Provider error for one required person blocks validity until recovered or decided.
- Each candidate can prove every required participant is covered.
- A no-overlap result names the smallest authorized decision that could change the set.
- 6
Rank survivors with an explicit scorecard
Score valid slots for optional attendance, organizer preference, participant working-hour comfort, time-zone fairness, notice, travel or focus buffers, and other declared soft rules. Use named weights or ordered tie-breaks, not hidden model taste. Return both total order and a reason breakdown that an organizer can inspect.- A soft score can never rescue an invalid slot.
- Optional people improve rank without changing required quorum.
- Tie-breaking is deterministic for the same intent and evidence versions.
- 7
Approve, revalidate, and commit once
Bind approval to the meeting revision, proposal ID, attendee set, score explanation, organizer calendar, and event wording. Re-read fresh required availability immediately before the write. Use a booking idempotency key, persist provider correlation and event IDs, reconcile uncertain timeouts before retry, and invalidate approval when a hard constraint changes.- A repeated MCP tool or REST command returns the original result.
- A stale top-ranked slot returns to matching rather than booking on old evidence.
- Partial provider writes move to reconciliation with one safe operator action.
- 8
Verify completion and trace every decision
Read back one canonical event and verify start, end, zone, organizer, required attendees, optional-attendee decision, and invitation dispatch. Emit meeting-level events for intent revision, availability source, constraint rejection, score components, approval, retries, reconciliation, and terminal status. Completion is a verified booking or a bounded exception, not a list of suggested times.- Operators can reproduce a proposal from stored intent and evidence versions.
- Healthy participant wait is separate from stuck processing or provider failure.
- Every terminal exception names current evidence, one owner, and one allowed next action.
Validity and preference are different products
Validity answers whether the meeting may happen at a slot. Preference answers which valid slot is more desirable. Required attendance, consent, duration, authoritative time zones, and fresh evidence belong on the first side. Optional attendance, morning preference, and fairness belong on the second.
Keep that boundary in the API response. A useful proposal exposes validity, required_evidence_versions, constraint_results, preference_scores, and explanation. A single unexplained score makes support and approval harder than calendar Tetris was.
No overlap is a decision package, not an empty array
Hard meetings often have no valid slot under the first brief. Return the binding conflicts and the smallest policy choices that could open the set: extend the date window, shorten duration, approve a substitute, change a required role, relax a buffer, or request a new window from one participant.
Do not apply the change automatically. Duration, quorum, outreach, and deadline belong to authorized humans or declared policy. The API should make the tradeoff legible, preserve the current attempt, and resume from a new revision after approval.
A slot finder is still not scheduling execution
A calendar API can return free/busy. A poll can gather votes. A booking link can expose host-side openings. A calendar-sync utility can show conflicts. An AI assistant can draft availability outreach. A ranking function can order candidate times. Each is a component.
Scheduling execution carries the instruction through required and optional people, participant outreach, connected or conversational evidence, time zones, consent, overlap, preferences, approval, safe retries, one event, invitations, and recovery. The terminal proof is why the category is larger than slot ranking.
Run the preference-trap acceptance test
Create three candidates. The first matches the organizer’s morning preference but excludes one required customer. The second includes every required person and the optional executive during reasonable local hours. The third includes every required person but uses stale Microsoft evidence and forces one participant outside declared working hours.
Pass when only the second slot reaches approval. Fail when a preference score hides missing quorum, stale evidence, ambiguous time zone, or absent consent. Then change the connected customer calendar before commit and confirm the engine rebuilds the valid set rather than trusting the old winner.
Compare slot ranking by the meeting outcome it owns
The fastest ranking function is not the shortest path to a booking if the application still has to collect missing evidence, enforce authority, repair stale proposals, and verify invitations.
| Decision vector | Prompt-based slot ranking | Calendar APIs plus custom constraint engine | WonderCal execution direction |
|---|---|---|---|
| Execution completion | Can order times described in context but may stop at a suggestion or drafted message. | Can finish when the team builds participant coordination, approval, booking, and verification around the engine. | Target boundary returns verified invitations or a bounded exception after matching and approval. |
| Cross-company reach | Depends on the availability copied into model context and the identities the application can reach. | Provider access is strong; external participant identity and coordination remain application work. | Designed for required and optional people across companies, Google, Microsoft, and unconnected calendars. |
| Optional-sync fallback | May draft a request, while reply identity, parsing, consent, and freshness are left outside the score. | The team can add reply ingestion and normalize it beside provider evidence. | Target model combines connected free/busy and bounded conversational windows before ranking. |
| Recovery and observability | Explanations may change between runs and rarely preserve exact evidence versions. | Full control with constraint traces, retry policy, stale-state repair, and reconciliation to build. | Target release should expose rejected constraints, score reasons, retries, reconciliation, and final proof. |
| Consent and control | A confident ranking can hide missing outreach authority, stale approval, or a relaxed hard rule. | Exact control is possible when consent and approval wrap every source and side effect. | Target model separates availability access, participant contact, proposal approval, booking, and later changes. |
| Time to ship | Fast for a controlled demo with all availability already present. | Rational when constraint policy and scheduling behavior are the product advantage. | Worth adopting when users need completed hard meetings and the ranking stack is undifferentiated work. |
Execution completion
Prompt-based slot ranking
Can order times described in context but may stop at a suggestion or drafted message.
Calendar APIs plus custom constraint engine
Can finish when the team builds participant coordination, approval, booking, and verification around the engine.
WonderCal execution direction
Target boundary returns verified invitations or a bounded exception after matching and approval.
Cross-company reach
Prompt-based slot ranking
Depends on the availability copied into model context and the identities the application can reach.
Calendar APIs plus custom constraint engine
Provider access is strong; external participant identity and coordination remain application work.
WonderCal execution direction
Designed for required and optional people across companies, Google, Microsoft, and unconnected calendars.
Optional-sync fallback
Prompt-based slot ranking
May draft a request, while reply identity, parsing, consent, and freshness are left outside the score.
Calendar APIs plus custom constraint engine
The team can add reply ingestion and normalize it beside provider evidence.
WonderCal execution direction
Target model combines connected free/busy and bounded conversational windows before ranking.
Recovery and observability
Prompt-based slot ranking
Explanations may change between runs and rarely preserve exact evidence versions.
Calendar APIs plus custom constraint engine
Full control with constraint traces, retry policy, stale-state repair, and reconciliation to build.
WonderCal execution direction
Target release should expose rejected constraints, score reasons, retries, reconciliation, and final proof.
Consent and control
Prompt-based slot ranking
A confident ranking can hide missing outreach authority, stale approval, or a relaxed hard rule.
Calendar APIs plus custom constraint engine
Exact control is possible when consent and approval wrap every source and side effect.
WonderCal execution direction
Target model separates availability access, participant contact, proposal approval, booking, and later changes.
Time to ship
Prompt-based slot ranking
Fast for a controlled demo with all availability already present.
Calendar APIs plus custom constraint engine
Rational when constraint policy and scheduling behavior are the product advantage.
WonderCal execution direction
Worth adopting when users need completed hard meetings and the ranking stack is undifferentiated work.
Frequently asked questions
What should a meeting scheduling API rank?
What is the difference between a hard constraint and a scheduling preference?
How should an API handle no overlap?
Can unconnected participants be included in slot ranking?
Where can developers review WonderCal’s scheduling API direction?
Primary sources
- Google Calendar API: Freebusy query — official Google availability request, response, bounds, time-zone, and error fields
- Microsoft Graph: calendar getSchedule — official Microsoft availability operation, working hours, permissions, and time-zone behavior
- Google OR-Tools: Scheduling — official constraint-programming scheduling examples and modeling entry point
- RFC 5545: Internet Calendaring and Scheduling — calendar components, free/busy, recurrence, duration, and time-zone semantics
- OpenTelemetry: Traces — official trace and span concepts for meeting-level decision evidence
Make the API prove validity before preference
Evaluate WonderCal and your own engine on one cross-company fixture: hard quorum, optional attendance, missing calendar fallback, explicit scoring, fresh approval, and one verified booking.
Review WonderCal for AI agents