AI-agent calendar integration
Calendar API for AI Agents: Build a Google and Microsoft Availability Adapter
Google and Microsoft both answer free/busy questions. They do not answer them the same way. They use different permissions, request shapes, time-zone vocabularies, error models, and event-write semantics. If your agent talks directly to both, those differences leak into every prompt, retry, and support ticket. Put a typed adapter between the agent and the providers first.
Build the provider-neutral calendar adapter in eight steps
Start with one meeting fixture: an organizer, three required people, one optional observer, Google and Microsoft accounts, and one participant with no connected calendar. The adapter should make provider differences explicit without making the model responsible for them.
- 1
Create a typed meeting-intent envelope
Accept an organizer, duration, date window, booking deadline, meeting time zone, required and optional participants, working-hour rules, preferences, exclusions, approval mode, and permitted outreach channels. Give the request a stable ID and revision. The provider adapter should receive a bounded availability query, not an unstructured paragraph.- Reject a missing duration, date window, organizer, or required participant.
- Use IANA time-zone names in the domain model.
- Keep participant role separate from calendar account and provider.
- 2
Map consent to the smallest provider permission
Google’s free/busy endpoint accepts dedicated free/busy scopes. Microsoft Graph listsCalendars.ReadBasicas the least-privileged permission forgetSchedule. Store which user granted access, which source account is authoritative, which scopes apply, and whether access is active, expired, denied, or revoked. Do not request event-detail access when busy intervals satisfy the job.- Separate availability permission from event-write permission.
- Show the user which account and action they are authorizing.
- Never treat expired or denied access as an empty calendar.
- 3
Wrap Google free/busy behind one provider method
Call Google Calendar’s free/busy query with RFC 3339timeMinandtimeMax, a response time zone, and bounded calendar IDs. Convert each returned busy range into your canonical interval. Preserve calendar-level errors such as not found or internal error beside the participant instead of dropping the whole response or pretending the calendar is open.- Respect Google’s documented calendar and group expansion limits.
- Treat interval start as inclusive and end as exclusive.
- Record retrieval time and provider request correlation for support.
- 4
Wrap Microsoft getSchedule without copying subjects
Call Microsoft GraphgetSchedulewith SMTP addresses, a bounded time range, and an explicit response zone. Graph can return an availability view, schedule items, and working hours. The slot engine should consume status and interval evidence, not meeting subjects or locations. Convert Microsoft time-zone identifiers at the adapter boundary and keep the original identifier for audit.- Handle tentative, busy, out-of-office, and working-elsewhere policy explicitly.
- Keep the documented result-size error distinct from ordinary no-availability.
- Do not expose private schedule-item detail to the language model.
- 5
Normalize both providers into one availability contract
Returnparticipant_id,account_id,provider,window,busy_intervals,working_hours,retrieved_at,fresh_until, anderrors. An empty busy array with no errors means something different from an empty array after a partial failure. Make that distinction impossible to lose.- Merge multiple authorized calendars for one participant before declaring them free.
- Keep evidence versioned so a slot proposal can be marked stale.
- Never infer a participant’s time zone from a numeric offset alone.
- 6
Add optional-sync fallback above the adapter
One external participant may not authorize any calendar. Create an outreach task that asks for availability in plain language and records channel consent, message ID, time zone, response window, normalized intervals, and freshness. Feed that response into the same slot engine as provider data. The adapter should reportnot_connected; the coordination layer decides whether and how to ask.- Do not force an account or calendar connection to join the meeting.
- Ask a narrow follow-up for ambiguous dates or zones.
- Escalate required-participant silence rather than silently excluding the person.
- 7
Commit with provider-specific safety behind one booking command
Re-check fresh availability before writing. Google’s event insert endpoint can send updates to guests and accepts required and optional attendees. Microsoft Graph’s create-event example includes atransactionIdto reduce unnecessary retries and sends invitations to attendees. Your domain needs a separate idempotency key tied to meeting request, revision, and approved slot, plus stored provider event IDs.- One booking revision creates at most one canonical event.
- An uncertain timeout triggers reconciliation before another insert.
- Verify organizer, attendees, start, end, zone, and invitation behavior after the write.
- 8
Instrument evidence freshness, retries, and completion
Trace availability calls, consent decisions, fallback messages, slot proposals, approvals, commits, and provider reconciliation by meeting request ID. Use separate retry policy for throttling, expired credentials, ambiguous participant replies, and uncertain writes. Finish only atconfirmed,needs_review, or a terminal failure with a reason and safe next action.- Alert when a meeting remains in one state beyond its expected window.
- Keep private event details out of logs and traces.
- Expose source, freshness, and rejection reasons for the chosen slot.
The canonical availability shape
The provider adapter should return facts the slot engine can defend. A useful record includes participant and account identity, provider, query window, busy intervals, working hours, provider time zone, canonical IANA zone, retrieval time, freshness limit, and typed errors. Keep raw payloads in a restricted diagnostic store only when policy permits it.
This shape protects the agent from provider churn. Google may add a new error reason. Microsoft may return a status your first policy did not cover. The adapter can map that change into a typed unknown or needs-review state instead of letting a model guess from unfamiliar provider prose.
Free/busy privacy is a product decision
Google’s support documentation distinguishes ‘See only free/busy (hide details)’ from broader event-detail access. Microsoft offers a basic calendar-read permission for getSchedule. Use that boundary. The scheduling job needs to know that 14:00–15:00 is blocked. It does not need to know whether the block is a board call, medical appointment, customer escalation, or school pickup.
Privacy also applies to logs, model context, analytics, and participant outreach. Masking the response to the user while copying subjects into a trace is not privacy. Keep private metadata out of the coordination path from the first provider response onward.
Where calendar APIs stop
A calendar API reads or writes provider resources. A calendar-sync utility mirrors busy state. A booking link publishes host-side slots. A poll collects participant votes. An AI assistant can draft the request. None of those boundaries automatically owns required and optional roles, conversational collection from unconnected participants, reminder policy, cross-company overlap, approval, safe commit, and verified invitations.
Scheduling execution owns the instruction-to-booking outcome. WonderCal’s target is that layer beneath the agent. It is intended to combine connected Google and Microsoft evidence with conversational availability, coordinate people across company lines, find the overlap, send invitations, and return a completed result or a bounded exception.
A failure matrix for the adapter
Test expired Google consent, Microsoft permission denial, a partial free/busy response, a provider throttle, an unknown time zone, daylight-saving transition, overlapping calendars for one person, a required participant with no connection, duplicate booking commands, and a timeout after event creation. Each case needs a typed state and one recovery owner.
Do not use one generic retry loop. Provider throttling can use bounded backoff. Expired access needs reauthorization. A participant reminder follows human consent and cadence. An uncertain event write needs reconciliation. The adapter is production-ready when those paths are ordinary, observable, and safe.
Choose the calendar layer your agent actually needs
A provider adapter, a unified calendar API, and a scheduling execution layer remove different amounts of engineering work. Compare the complete meeting outcome.
| Decision vector | Direct Google or Microsoft build | Unified calendar API or sync layer | WonderCal execution direction |
|---|---|---|---|
| Execution completion | Provides calendar reads and writes; your application owns participants, slot policy, outreach, commit state, and proof. | Normalizes or mirrors calendars; coordination and participant closure usually remain in your product. | Target boundary carries a typed meeting brief through coordination to verified invitations or a bounded exception. |
| Cross-company reach | Every tenant, provider, credential, and external-participant path is your responsibility. | Provider access is easier, but unconnected people and company-level policy still need a workflow. | Designed for mixed Google and Microsoft participants across companies and calendar-access states. |
| Optional-sync fallback | Requires your own messaging, consent, reply parsing, reminders, and ambiguity handling. | Can report no connection; it does not necessarily collect the missing human answer. | Target product combines connected free/busy and conversational collection in one meeting record. |
| Recovery and observability | Maximum control and maximum responsibility for provider errors, replay, traces, and reconciliation. | Reduces provider differences; meeting-level state and operator recovery may still be yours. | The live release should prove states, reason codes, idempotency, webhooks, and human recovery. |
| Consent and privacy | You choose every scope, retention rule, redaction, revocation path, and outreach boundary. | Can centralize consent while your application still decides what reaches the agent or participant. | Target design uses private free/busy and separates calendar access, outreach permission, and booking approval. |
| Time to ship | Fast for one provider and one account; mixed-provider hard meetings create a separate roadmap. | Shortens provider integration work but not necessarily coordination logic. | Useful when the released product removes the full hard-meeting execution layer your team does not want to own. |
Execution completion
Direct Google or Microsoft build
Provides calendar reads and writes; your application owns participants, slot policy, outreach, commit state, and proof.
Unified calendar API or sync layer
Normalizes or mirrors calendars; coordination and participant closure usually remain in your product.
WonderCal execution direction
Target boundary carries a typed meeting brief through coordination to verified invitations or a bounded exception.
Cross-company reach
Direct Google or Microsoft build
Every tenant, provider, credential, and external-participant path is your responsibility.
Unified calendar API or sync layer
Provider access is easier, but unconnected people and company-level policy still need a workflow.
WonderCal execution direction
Designed for mixed Google and Microsoft participants across companies and calendar-access states.
Optional-sync fallback
Direct Google or Microsoft build
Requires your own messaging, consent, reply parsing, reminders, and ambiguity handling.
Unified calendar API or sync layer
Can report no connection; it does not necessarily collect the missing human answer.
WonderCal execution direction
Target product combines connected free/busy and conversational collection in one meeting record.
Recovery and observability
Direct Google or Microsoft build
Maximum control and maximum responsibility for provider errors, replay, traces, and reconciliation.
Unified calendar API or sync layer
Reduces provider differences; meeting-level state and operator recovery may still be yours.
WonderCal execution direction
The live release should prove states, reason codes, idempotency, webhooks, and human recovery.
Consent and privacy
Direct Google or Microsoft build
You choose every scope, retention rule, redaction, revocation path, and outreach boundary.
Unified calendar API or sync layer
Can centralize consent while your application still decides what reaches the agent or participant.
WonderCal execution direction
Target design uses private free/busy and separates calendar access, outreach permission, and booking approval.
Time to ship
Direct Google or Microsoft build
Fast for one provider and one account; mixed-provider hard meetings create a separate roadmap.
Unified calendar API or sync layer
Shortens provider integration work but not necessarily coordination logic.
WonderCal execution direction
Useful when the released product removes the full hard-meeting execution layer your team does not want to own.
Frequently asked questions
What should a calendar API for AI agents return?
Can Google Calendar and Microsoft Graph use the same free/busy contract?
Does an AI scheduling agent need full calendar access?
How does an agent schedule someone who will not connect a calendar?
Can WonderCal replace a direct calendar API build today?
Primary sources
- Google Calendar API: Freebusy query — official scopes, RFC 3339 bounds, limits, busy intervals, and error fields
- Google Calendar API: Events insert — official event creation, required and optional attendees, time zones, notifications, and event IDs
- Google Workspace: Configure OAuth consent and choose scopes — official guidance to choose the most narrowly focused authorization scope
- Microsoft Graph: calendar getSchedule — official permissions, request model, response time zones, availability, and errors
- Microsoft Graph: Create event — official event-write permission, attendees, invitations, time zones, and transaction ID example
- RFC 3339 — Internet timestamp format used at calendar API boundaries
Stop provider differences from becoming agent behavior
Use the adapter checklist to review WonderCal’s developer release. Demand private free/busy, mixed-provider normalization, optional-sync fallback, safe commits, observable recovery, and a final booking your agent can verify.
Explore WonderCal for AI agents