Employee Onboarding

Automate the full employee onboarding lifecycle. An orchestrator agent coordinates across IT provisioning, benefits enrollment, training assignments, equipment ordering, and compliance documentation — triggering specialized workflows for each domain and handling exceptions when systems conflict or approvals are needed.

Architecture

flowchart TD A["New Hire Record<br/>from HRIS"] --> B["Orchestrator Agent<br/>Coordinates full onboarding"] B --> C["__run_workflow__<br/>IT Provisioning"] B --> D["__run_workflow__<br/>Benefits Enrollment"] B --> E["__run_workflow__<br/>Training Assignment"] B --> F["__run_workflow__<br/>Equipment Ordering"] C --> G{"All systems<br/>provisioned?"} D --> G E --> G F --> G G -->|"Yes"| H["✅ Onboarding Complete<br/>Welcome email sent"] G -->|"Conflicts / failures"| I["Human Review<br/>HR Coordinator"] I --> H style B fill:#dcfce7,stroke:#16a34a style C fill:#f3e8ff,stroke:#7c3aed style D fill:#f3e8ff,stroke:#7c3aed style E fill:#f3e8ff,stroke:#7c3aed style F fill:#f3e8ff,stroke:#7c3aed style I fill:#dbeafe,stroke:#2563eb

Deployment pattern: Agent-as-orchestrator (Pattern C). The agent is the decision-maker, each sub-workflow is a capability it invokes via __run_workflow__. The agent decides sequencing, handles dependencies, and manages exceptions.


Sub-Workflows

The orchestrator coordinates four domain-specific workflows. Each is a standard Hyphen workflow that can also be run independently.

IT Provisioning Workflow

Provisions accounts across all required systems:

json
{
  "name": "it_provisioning",
  "definition": {
    "actions": [
      {
        "type": "create_ad_account",
        "properties": {
          "first_name": "@input.first_name",
          "last_name": "@input.last_name",
          "department": "@input.department",
          "role": "@input.role"
        }
      },
      {
        "type": "provision_email",
        "properties": {
          "username": "@input.email",
          "distribution_lists": "@input.dl_membership"
        }
      },
      {
        "type": "assign_licenses",
        "properties": {
          "user_email": "@input.email",
          "licenses": "@input.required_licenses"
        }
      },
      {
        "type": "grant_system_access",
        "filter": {
          "condition": {
            "greaterThan": [{ "length": "@input.system_access" }, 0]
          }
        },
        "properties": {
          "user_email": "@input.email",
          "systems": "@input.system_access"
        }
      },
      {
        "type": "PbotApproval",
        "filter": {
          "condition": {
            "in": ["@input.access_level", ["admin", "elevated"]]
          }
        },
        "properties": {
          "comment": "New hire {{input.first_name}} {{input.last_name}} requires {{input.access_level}} access. Manager approval needed.",
          "request_payload": {
            "employee": "@input.first_name",
            "role": "@input.role",
            "systems": "@input.system_access",
            "access_level": "@input.access_level"
          }
        }
      }
    ]
  }
}

Benefits Enrollment Workflow

json
{
  "name": "benefits_enrollment",
  "definition": {
    "actions": [
      {
        "type": "check_eligibility",
        "properties": {
          "employee_type": "@input.employee_type",
          "start_date": "@input.start_date",
          "location": "@input.location"
        }
      },
      {
        "type": "create_benefits_profile",
        "properties": {
          "employee_id": "@input.employee_id",
          "eligible_plans": "@eligibility.plans"
        }
      },
      {
        "type": "PbotForm",
        "properties": {
          "expected_keys": ["health_plan", "dental_plan", "vision_plan", "retirement_contribution", "life_insurance"],
          "ttl_seconds": 604800,
          "reminder_intervals": [172800, 432000]
        }
      },
      {
        "type": "enroll_benefits",
        "properties": {
          "employee_id": "@input.employee_id",
          "selections": "@formData"
        }
      }
    ]
  }
}

Training Assignment Workflow

json
{
  "name": "training_assignment",
  "definition": {
    "actions": [
      {
        "type": "lookup_role_requirements",
        "properties": {
          "role": "@input.role",
          "department": "@input.department",
          "location": "@input.location"
        }
      },
      {
        "type": "loop",
        "properties": {
          "mode": "foreach",
          "items_path": "@role_requirements.required_courses",
          "item_variable_name": "course",
          "actions_to_execute": [
            {
              "type": "assign_course",
              "properties": {
                "employee_id": "@input.employee_id",
                "course_id": "@course.id",
                "due_date": "@course.due_date"
              }
            }
          ],
          "max_concurrency": 5,
          "failure_strategy": "continue_on_error",
          "result_key": "enrollment_results"
        }
      }
    ]
  }
}

Equipment Ordering Workflow

json
{
  "name": "equipment_ordering",
  "definition": {
    "actions": [
      {
        "type": "lookup_standard_kit",
        "properties": {
          "role": "@input.role",
          "location": "@input.location"
        }
      },
      {
        "type": "PbotApproval",
        "filter": {
          "condition": {
            "greaterThan": ["@standard_kit.total_cost", 3000]
          }
        },
        "properties": {
          "comment": "Equipment order for {{input.first_name}} {{input.last_name}} exceeds $3,000. Items: {{standard_kit.items}}. Approve?",
          "request_payload": {
            "items": "@standard_kit.items",
            "total_cost": "@standard_kit.total_cost"
          }
        }
      },
      {
        "type": "submit_equipment_order",
        "properties": {
          "employee_id": "@input.employee_id",
          "items": "@standard_kit.items",
          "ship_to": "@input.work_location"
        }
      }
    ]
  }
}

Orchestrator Agent

The top-level agent coordinates everything:

json
{
  "name": "employee_onboarding_orchestrator",
  "definition": {
    "actions": [
      {
        "type": "loop",
        "properties": {
          "mode": "react",
          "objective": "Onboard new employee:\n\nName: {{input.first_name}} {{input.last_name}}\nRole: {{input.role}}\nDepartment: {{input.department}}\nStart date: {{input.start_date}}\nLocation: {{input.location}}\nEmployee type: {{input.employee_type}}\n\nSteps:\n1) Run IT provisioning workflow — wait for completion\n2) Run benefits enrollment workflow — this may take days (PbotForm), run async\n3) Run training assignment workflow — wait for completion\n4) Run equipment ordering workflow — wait for completion\n5) If any workflow fails, log the failure and pause for HR review\n6) Once IT provisioning and training are done, send welcome email\n7) Complete with a summary of all onboarding steps and their status",
          "tools": [
            { "type": "action", "name": "gmail_send" },
            { "type": "workflow", "id": "wf_it_provisioning" },
            { "type": "workflow", "id": "wf_benefits_enrollment" },
            { "type": "workflow", "id": "wf_training_assignment" },
            { "type": "workflow", "id": "wf_equipment_ordering" }
          ],
          "model": "gpt-4",
          "max_iterations": 20,
          "timeout_ms": 600000,
          "on_stuck": {
            "iterations": 4,
            "action": "escalate"
          },
          "result_key": "onboarding_result"
        }
      },
      {
        "type": "custom-table",
        "properties": {
          "table": "onboarding_log",
          "operation": "write",
          "keys": ["employee_id"],
          "values": ["@input.employee_id"],
          "fields": {
            "name": "@input.first_name",
            "role": "@input.role",
            "start_date": "@input.start_date",
            "onboarding_status": "@onboarding_result.answer",
            "completed_at": "@now"
          }
        }
      }
    ]
  }
}

Sample Reasoning Trace

text
Iteration 1:
  Thought: "Starting onboarding for Sarah Chen, Senior Engineer, Platform Team. First: IT provisioning."
  Action: __run_workflow__
  Input: { "workflow_name": "it_provisioning", "input": {
    "first_name": "Sarah", "last_name": "Chen", "department": "Engineering",
    "role": "Senior Engineer", "email": "[email protected]",
    "required_licenses": ["GitHub Enterprise", "AWS Console", "Datadog"],
    "system_access": ["production_k8s", "staging_db"],
    "access_level": "elevated"
  }, "wait": true }
  Result: { "status": "completed", "context": { "__approved": true } }

Iteration 2:
  Thought: "IT provisioned. Elevated access was approved by manager. Storing this and moving to benefits."
  Action: __store_memory__
  Input: { "key": "it_status", "value": "completed — elevated access approved" }

Iteration 3:
  Thought: "Benefits enrollment requires employee input (plan selections). Running async — it may take days."
  Action: __run_workflow__
  Input: { "workflow_name": "benefits_enrollment", "input": {
    "employee_id": "EMP-4521", "employee_type": "full_time",
    "start_date": "2026-02-15", "location": "San Francisco"
  }, "wait": false }
  Result: { "workflow_run_id": "run_ben_789", "status": "running" }

Iteration 4:
  Thought: "Benefits running async. Proceeding with training and equipment in parallel."
  Action: __log_progress__
  Input: { "message": "IT ✅ | Benefits ⏳ (async) | Training: starting | Equipment: pending" }

Iteration 5:
  Thought: "Assigning required training."
  Action: __run_workflow__
  Input: { "workflow_name": "training_assignment", "input": {
    "employee_id": "EMP-4521", "role": "Senior Engineer",
    "department": "Engineering", "location": "San Francisco"
  }, "wait": true }
  Result: { "status": "completed", "context": { "courses_assigned": 7 } }

Iteration 6:
  Thought: "7 courses assigned. Now equipment."
  Action: __run_workflow__
  Input: { "workflow_name": "equipment_ordering", "input": {
    "employee_id": "EMP-4521", "first_name": "Sarah", "last_name": "Chen",
    "role": "Senior Engineer", "location": "San Francisco", "work_location": "SF Office"
  }, "wait": true }
  Result: { "status": "completed", "context": { "order_id": "EQ-8832" } }

Iteration 7:
  Thought: "IT, training, and equipment complete. Benefits still async. Sending welcome email now."
  Action: gmail_send
  Input: { "__oauth_account__": "[email protected]",
    "to": "[email protected]",
    "subject": "Welcome to the team, Sarah!",
    "body": "Hi Sarah,\n\nWe're excited to have you join the Platform Team on Feb 15!\n\nYour accounts are set up:\n- Email: [email protected]\n- GitHub, AWS, and Datadog access: ready\n- 7 training courses assigned in the LMS\n- Equipment shipping to SF Office\n\nYou'll receive a separate email about benefits enrollment. Please complete your plan selections within 7 days.\n\nSee you on the 15th!"
  }
  Result: { "sent": true }

Iteration 8:
  Thought: "Welcome email sent. All synchronous steps complete. Benefits enrollment is async and will complete when Sarah submits her selections."
  Action: __complete__
  Input: {
    "answer": "Onboarding 90% complete. IT provisioned (elevated access approved), 7 training courses assigned, equipment ordered (EQ-8832), welcome email sent. Benefits enrollment pending employee input (async).",
    "confidence": 0.95,
    "summary": "4 workflows triggered, 3 completed, 1 async pending"
  }

Why Agent-as-Orchestrator

This template demonstrates why a human coordinator is the bottleneck in onboarding — they manually sequence across disconnected systems, track which steps are done, handle exceptions, and send follow-up communications.

The orchestrator agent replicates that judgment:

Human coordinator does Orchestrator agent does
Checks which systems need provisioning Reads role requirements, triggers it_provisioning
Follows up on pending approvals Waits for PbotApproval, escalates if stuck
Decides sequencing (IT before training) Reasons about dependencies, runs workflows in logical order
Sends welcome email once ready Sends email after confirming IT + training are done
Tracks overall status __log_progress__ at each milestone
Escalates when things go wrong __pause_for_human__ when workflows fail

The difference: the agent does it in minutes, across any number of simultaneous new hires, with a complete audit trail.


Customization

HRIS integration: Replace @input with a webhook trigger from your HRIS (Workday, BambooHR, Rippling) that fires when a new hire record is created.

Sub-workflows: Add or remove sub-workflows based on your onboarding process — background check, office badge provisioning, parking assignment, team buddy assignment. Each is a standard Hyphen workflow the agent can invoke.

Approval routing: IT provisioning requires manager approval for elevated access. Equipment requires finance approval above $3K. Adjust thresholds and approval routing per your policies.

Timeline handling: Benefits enrollment uses PbotForm with a 7-day TTL and reminders at 48h and 5 days. The orchestrator runs this async so it doesn't block the rest of onboarding.

Offboarding: Mirror this template for employee offboarding — revoke access, recover equipment, process final pay, transfer knowledge base ownership. Same orchestrator pattern, reverse direction.