Open-source Python template. Resolves the employee in Deel, validates against their real entitlement, submits the request for approval, blocks the calendar.
The balance check runs against the employee's real Deel entitlement before anything is written. Insufficient balance, invalid dates, or an overlapping request end the run with the reason logged and the manager notified, and nothing is submitted.
contracts = execute_tool("deelmcp_contract_list", identifier=deel_user)
for c in contracts:
profile_id = (c.get("worker") or {}).get("id")
if not profile_id:
continue # onboarding incomplete
person = execute_tool("deelmcp_org_hris_person_get", identifier=deel_user,
tool_input={"hris_profile_id": profile_id})
if employee_email in emails_of(person):
return profile_idThree things you'd otherwise build: Deel OAuth, per-employee calendar access, Slack scopes. Handled.
Clone github.com/scalekit-developers/workflow-agents-demos/tree/main/pto-leave-request-agent and adapt it for my people ops stack.
I am building for: my HR team (or: an HR tech product) <- edit this line
Connectors my users need: Deel, Google Calendar, Slack <- edit this line
Trigger: one run per leave request. Deliver: a real Deel time-off request pending approval, a blocked calendar, and a manager DM.
Steps:
1. Create Scalekit AgentKit connections for deel (the DEELMCP connector), googlecalendar for the employee's own identity, and an MCP-variant slack (SLACKMCP, not the plain REST SLACK connector -- the send-message parameter names differ). Copy the exact connection names into DEEL_CONNECTOR / GOOGLE_CALENDAR_CONNECTOR / SLACK_CONNECTOR.
2. Set EMPLOYEE_EMAIL to an email that matches Deel's org chart, plus MANAGER_EMAIL or MANAGER_SLACK_ID, PTO_START_DATE, PTO_END_DATE, and PTO_TYPE.
3. Confirm the worker has a time-off policy assigned for that PTO_TYPE before the first run -- deelmcp_timeoff_request_create needs a policy_id and Step 2 fails without one.
4. Keep the validation order in run_flow.py: resolve worker, resolve policy, check overlaps, check balance, and only then submit. Rejections must notify the manager and write nothing.
5. Keep status REQUESTED on submission. If I want approvals automated, add deelmcp_timeoff_request_review as a separate explicit step and tell me the risk.
6. Set EMPLOYEE_DEEL_PROFILE_ID to skip the contract-list lookup, then run python run_flow.py and describe how to trigger it from my HR portal.
Each one runs on delegated identity, scoped per user.