AI agents and developer implementation
AI Scheduling API Tutorial: Build a Long-Running Group-Meeting Workflow
A hard group meeting does not finish inside one model turn. One participant replies now, another replies tomorrow, a Microsoft token expires, an optional guest declines, and the organizer changes the deadline while the workflow sleeps. An AI scheduling API integration has to survive that elapsed time without asking the model to remember the thread.
Build the long-running scheduling workflow in eight steps
Start from one durable meeting request. The HTTP request that creates it should return quickly. The coordination job can then wait for calendar reads, participant replies, approvals, and provider recovery without keeping a model call or server thread open.
- 1
Parse the instruction into a versioned meeting brief
Create a record withmeeting_request_id, revision, organizer, purpose, duration, date window, booking deadline, meeting time zone, working-hour policy, location, approval mode, and approved outreach channels. Split people intorequired_participantsandoptional_participants. Preserve the original instruction for audit, but run the workflow from typed fields.- Reject a brief with no organizer, duration, date window, or required participant.
- Use IANA time-zone names rather than permanent UTC offsets.
- Bind every later approval and proposal to the current revision.
- 2
Create one durable job and return its handle
Accept the brief through a command such asPOST /meeting-requests, persist it before starting work, and return202 Acceptedwith the request ID, current state, status URL, and allowed next actions. A worker may crash. A model session may end. Neither event should erase the meeting or force the organizer to repeat the brief.- Store state outside the model transcript.
- Make request creation idempotent for client retries.
- Expose cancel, revise, approve, and status operations against the same handle.
- 3
Resolve consent and availability source per participant
For each person, record organizer authority, permitted contact channel, calendar connection, consent state, time zone, and role. Read approved Google or Microsoft free/busy when available. Normalize provider results into intervals with participant ID, source, retrieval time, time zone, and error state. Missing or partial evidence is not free time.- Ask for the smallest calendar permission that supports free/busy.
- Keep event titles, descriptions, and attendee lists out of agent context.
- Separate expired access, denied access, throttling, and provider failure.
- 4
Pause for conversational availability without losing state
Calendar connection is optional. Create an outreach task for an unconnected participant that includes organizer, purpose, duration, bounded date window, time zone, and response deadline. Parse the answer into the same availability shape as connected free/busy. A reply such as ‘Tuesday afternoon’ without a zone moves toneeds_clarification; it does not become a guessed interval.- Require an approved channel before contacting a participant.
- Cap reminders and honor decline, opt-out, and do-not-contact state.
- Silence from a required participant blocks completion rather than changing the quorum.
- 5
Wake on events and recompute from current evidence
Resume the job when a participant replies, a calendar changes, an approval arrives, or a deadline timer fires. Treat notifications as signals to fetch or reconcile current state, not as the full truth. Increment the evidence version when a required calendar, participant response, time zone, or meeting constraint changes. Invalidate proposals built from an older version.- Deduplicate every inbound event before changing meeting state.
- Process out-of-order notifications against provider and meeting versions.
- Rebuild after an invalid sync token or expired subscription.
- 6
Generate slots with deterministic attendance policy
Intersect every required participant first. Score surviving slots for optional attendance, working hours, organizer preferences, buffers, time-zone fairness, and the booking deadline. Store the evidence version and rejection reason behind each proposal. Let the model explain the tradeoff; keep quorum and consent rules in deterministic code.- Never drop a required participant to produce a convenient answer.
- Show which optional people can attend each proposal.
- A no-overlap result names the smallest constraints an authorized person could change.
- 7
Approve and commit exactly one canonical event
Bind approval to the meeting revision, proposal ID, attendee set, organizer calendar, and start time. Re-check fresh free/busy immediately before the write. Derive a booking key from that approved tuple, persist the provider event identifier, and reconcile an uncertain timeout before retrying. A repeated tool call must return the original event rather than send a second invitation.- Expire approval after a required constraint or calendar changes.
- Record partial writes as recoverable state instead of claiming success.
- Keep booking, rescheduling, and cancellation as separate authorized actions.
- 8
Return verified completion and meeting-level observability
Finish only after verifying organizer calendar, event ID, start, end, time zone, required attendees, optional attendees, and invitation dispatch. Emit meeting states such ascollecting_availability,waiting_on_required_participant,proposal_ready,awaiting_approval,committing,confirmed, andneeds_review.- Trace provider calls, participant messages, approvals, and commits by meeting request ID.
- Alert on stuck states, exhausted retries, and duplicate-commit attempts.
- Every terminal exception includes evidence and one safe operator action.
The model is not the workflow database
A model turn is good at translating ‘find an hour next week with the implementation team’ into a typed brief. It is a poor place to hold the authoritative participant list for two days. Conversation history can be truncated, retried, or resumed by another worker. A durable meeting record gives every session the same facts.
Keep reasoning bounded. The model can classify intent, request missing fields, and explain why one proposal wins. Deterministic services should enforce required attendance, consent, time zones, idempotency, reminder caps, and calendar writes. The result is easier to test and easier to recover when a provider or person does something unexpected.
Waiting is normal work
Long-running agent architecture separates existence from execution. The meeting exists continuously, but workers run only when an event, timer, or operator action advances it. Do not keep an LLM call open while a required participant is asleep. Checkpoint the state, schedule the next deadline, and wake from the next approved input.
Retries belong at individual side effects. A calendar read can retry without resending participant outreach. A participant reminder can retry without recreating the meeting. A booking timeout must reconcile before another write. Granular activities keep one provider failure from replaying every successful action that came before it.
Scheduling execution is bigger than an API call
A calendar API reads or writes provider resources. A booking link asks an invitee to choose from host-side slots. A poll gathers votes. A calendar-sync utility copies or exposes availability. An AI assistant can draft the outreach. Each can remove a step, but the organizer may still own the coordination loop.
Scheduling execution owns the instruction through required and optional people, connected free/busy, conversational fallback, overlap, consent, approval, safe commit, invitations, and recovery. WonderCal’s direction is to offer that execution layer beneath agents handling hard multi-person meetings across Google, Microsoft, company, and calendar boundaries.
Run the two-day acceptance test
Use five test participants across two companies and both calendar providers. Leave one required participant unconnected. Deliver one reply after the original model session ends. Add an ambiguous time zone, duplicate webhook, provider throttle, organizer revision, timeout after the calendar write, and optional decline.
Pass only when the workflow produces one canonical invitation or one bounded exception with current evidence. Restart workers between stages. Replay every event. The job should resume from persisted state, keep consent intact, and never ask the organizer to rebuild the participant list from reply-all archaeology.
Choose an AI scheduling API by the work it owns
Endpoints are not the product boundary. Compare the durable meeting state, external reach, fallback, recovery, and proof behind them.
| Decision vector | Direct calendar APIs | Booking or polling API | WonderCal execution direction |
|---|---|---|---|
| Execution completion | Reads and writes provider resources; your system owns the meeting brief, people, outreach, slot policy, and proof. | Creates a choice or booking surface; participant response and final closure may remain outside the API. | Target boundary accepts a hard-meeting brief and returns verified invitations or a bounded exception. |
| Cross-company reach | Every tenant, provider, credential, identity, and external participant path becomes application code. | External people can use the surface when its host and event model fit the meeting. | Designed for required and optional people across Google, Microsoft, companies, and unconnected calendars. |
| Optional-sync fallback | You build authority, outreach, reply parsing, reminders, clarification, and consent. | The link or poll is the fallback and gives participants another task. | Target design combines connected free/busy and conversational collection inside one meeting record. |
| Recovery and observability | Full control, with full responsibility for provider replay, reconciliation, traces, and operator tools. | Usually exposes booking or response activity, while the larger meeting state may live elsewhere. | The release should prove durable states, reason codes, idempotency, events, and operator recovery. |
| Consent and control | Your application enforces scopes, participant authority, approvals, retention, and revocation. | Participant action is explicit, but organizer authority and extra outreach remain application concerns. | Target model separates reads, outreach, booking, rescheduling, cancellation, and approval policy. |
| Time to ship | Fast for one connected calendar; long-running groups add a coordination and support roadmap. | Fast when self-service booking or polling fulfills the user promise. | Worth adopting when the live execution layer removes coordination logic your team does not need to own. |
Execution completion
Direct calendar APIs
Reads and writes provider resources; your system owns the meeting brief, people, outreach, slot policy, and proof.
Booking or polling API
Creates a choice or booking surface; participant response and final closure may remain outside the API.
WonderCal execution direction
Target boundary accepts a hard-meeting brief and returns verified invitations or a bounded exception.
Cross-company reach
Direct calendar APIs
Every tenant, provider, credential, identity, and external participant path becomes application code.
Booking or polling API
External people can use the surface when its host and event model fit the meeting.
WonderCal execution direction
Designed for required and optional people across Google, Microsoft, companies, and unconnected calendars.
Optional-sync fallback
Direct calendar APIs
You build authority, outreach, reply parsing, reminders, clarification, and consent.
Booking or polling API
The link or poll is the fallback and gives participants another task.
WonderCal execution direction
Target design combines connected free/busy and conversational collection inside one meeting record.
Recovery and observability
Direct calendar APIs
Full control, with full responsibility for provider replay, reconciliation, traces, and operator tools.
Booking or polling API
Usually exposes booking or response activity, while the larger meeting state may live elsewhere.
WonderCal execution direction
The release should prove durable states, reason codes, idempotency, events, and operator recovery.
Consent and control
Direct calendar APIs
Your application enforces scopes, participant authority, approvals, retention, and revocation.
Booking or polling API
Participant action is explicit, but organizer authority and extra outreach remain application concerns.
WonderCal execution direction
Target model separates reads, outreach, booking, rescheduling, cancellation, and approval policy.
Time to ship
Direct calendar APIs
Fast for one connected calendar; long-running groups add a coordination and support roadmap.
Booking or polling API
Fast when self-service booking or polling fulfills the user promise.
WonderCal execution direction
Worth adopting when the live execution layer removes coordination logic your team does not need to own.
Frequently asked questions
What is an AI scheduling API?
Why should group scheduling run as a long-running job?
How should an AI scheduling API handle people without connected calendars?
How do you prevent duplicate bookings after retries?
Is WonderCal’s AI scheduling API available now?
Primary sources
- Google for Developers: Long-running agents with ADK — official pause, resume, durable state, and event-driven dormancy guidance
- Temporal: Activity definition — official durable retry, timeout, granularity, and idempotency guidance
- Google Calendar API: Freebusy query — official Google free/busy request, scopes, bounds, and error fields
- Microsoft Graph: calendar getSchedule — official Microsoft availability endpoint and time-zone behavior
- RFC 9110: Idempotent methods — HTTP idempotency semantics used as a base for safe command retries
Let the meeting outlive the model turn
Evaluate WonderCal’s developer release against the long-running job: durable intent, connected and conversational availability, safe waiting, consent, recovery, and one verified booking.
Review WonderCal for AI agents