What the agent does
This is for a software company that sells time tracking and billing to small consultancies: IT advisers, management consultants, engineering firms. Consultants put off timesheets, and most of what they would type on Friday is already in their Outlook calendar: a workshop with one client, two calls with another, the internal planning meeting. The company adds Draft my week: every Friday afternoon each consultant finds a timesheet filled in from their own calendar, mapped to the firm's client codes, waiting to be corrected and submitted.
The company saves the agent once as a template with POST /o/{org}/agents, with "connections": ["microsoft-calendar"] (it connects a Microsoft calendar of its own first) and instructions that keep it to reading. When a consultant turns the feature on, the backend makes their agent with {"template": "<template id>", "name": "timesheet-<user id>"}, calls POST /o/{org}/agents/{agent}/connections {"type": "app", "name": "microsoft-calendar"}, and opens the authorize_url in a popup for that consultant, who signs in on Microsoft's page. Rush asks Microsoft for Calendars.ReadWrite, the scope its Microsoft Calendar product names; the template's instructions and every prompt forbid creating, changing or deleting an event.
A run reads GET /me/calendarView with startDateTime and endDateTime for Monday to Friday. Microsoft's reference says the calendar view returns the occurrences, exceptions and single instances of events in the range, so a weekly recurring call appears once for each week it happened. The run sends Prefer: outlook.timezone with the consultant's time zone so times come back in local hours, selects subject, start, end, categories, attendees, organizer, isAllDay, isCancelled, showAs and sensitivity, and follows @odata.nextLink to the end.
Each event is matched to a client code from the firm's list in input: first by an Outlook category named for the client, which many consultants already use, then by the attendee email domains the list gives for each client. An event with only colleagues is Internal; cancelled events, all-day events and events shown as free are left out; an event marked private counts as unassigned time with no subject. It totals hours per client per day, rounded to the firm's increment, and lists every event it could not place so the consultant decides.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "<agent id>",
"input": "Draft my timesheet for 2026-11-16 to 2026-11-20 from my Microsoft calendar. Call GET /me/calendarView with startDateTime 2026-11-16T00:00:00-05:00 and endDateTime 2026-11-21T00:00:00-05:00, header Prefer: outlook.timezone=\"Eastern Standard Time\", $select subject,start,end,categories,attendees,organizer,isAllDay,isCancelled,showAs,sensitivity, following @odata.nextLink. Client codes: HARB (category Harbor Co-op, domain harborcoop.example), MLT (category Millton Schools, domain millton.example), GRN (category Greenway Logistics, domain greenway.example). Our own domain: northbeam.example. Match by category first, then attendee domain; only colleagues means INTERNAL; two clients in one event goes to unplaced. Skip cancelled, all-day and showAs free events. Private events: UNASSIGNED with no subject. Round each day's total per code to 0.25 h. Return only JSON {days: [{date, entries: [{code, hours, events: [subject]}]}], unplaced: [{date, start, end, subject, reason}]}. Read only: do not create, update, accept, decline or delete any event."
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
The session's answer is the JSON, which the app's webhook handler loads into the consultant's draft timesheet for the week, each line showing the events it came from. Unplaced events appear in a short list beside it with the reason each could not be placed.
What the consultant checks before submitting: hours the calendar does not show, such as travel or work between meetings; meetings that ran over or ended early; an event matched to a client by one stray attendee; and the unplaced list. The draft is a starting point, and the app submits nothing until the consultant presses Submit.
Run it on every Friday afternoon, per consultant
The app's scheduler sends one POST /o/{org}/sessions per consultant with the feature on, at 15:00 on Friday in each consultant's time zone, with their agent id as agent, the week's dates and the firm's client list in input, and a request_id that is a UUID v5 of the user id and the week, so a retried job starts no second run. Every consultant's run starts at once, and those past the key's max_concurrent wait as queued until a slot frees.
A consultant back from leave can press Draft again for any past week, and the app sends the same request with that week's dates.
The use case this job follows, with its automation and trigger: Run an agent per customer task.
Why run it on Rush?
Each consultant's Microsoft sign-in is theirs, held in Rush's connection under their agent. The company keeps no Microsoft tokens and registers no Microsoft app, since the consultant signs in to Rush's app on Microsoft's page, and a session's accounts names the Microsoft account it read, so the company can show a consultant which runs opened their calendar.
Each Friday is a session per consultant with its own computer, a record of each Graph call and its model cost, which the company adds up per consultant with GET /o/{org}/sessions?agent=<agent id>. A calendar holds things a timesheet does not need, so the prompt turns private events into unassigned time with no subject, and the transcript shows exactly what was read.
Frequently asked questions
Why does Rush ask for write access to the calendar?
Rush's Microsoft Calendar sign-in asks for Calendars.ReadWrite, the one scope that product names, so the same connection can serve jobs that book meetings. Microsoft's reference lists Calendars.ReadBasic as enough to read a calendar view; this agent's instructions forbid every change, and the transcript records each Graph call.
What about a second calendar for client work?
This prompt reads the default calendar. Microsoft's reference has the same view for any of the user's calendars, /me/calendars/{id}/calendarView, so a consultant who keeps client work on a second calendar can have the app name it in input.
Does it read meeting notes or agendas?
No. It selects the subject, times, categories, attendees and a few flags, never the event body. That is enough to place most meetings and keeps agendas and dial-in details out of the run.
What if two clients are in one meeting?
The agent puts that event under unplaced with both clients named, and the consultant splits the time. A guessed split would put wrong hours on an invoice.