API Reference

Workflow

Trigger state machine transitions and query workflow history for interviews.

The workflow API exposes the HITL state machine transitions. Use it to manually trigger state changes (approve, reject, schedule) and to retrieve transition history for audit trails.

Endpoints

MethodEndpointPermissionDescription
POST/workflow/interviews/:id/transitioninterview:approveTrigger state transition
GET/workflow/interviews/:id/historyinterview:readGet transition history
GET/workflow/interviews/:id/available-transitionsinterview:readList valid next states

POST /workflow/interviews/:id/transition

Trigger an explicit workflow transition. The available transitions depend on the current state — use the available-transitions endpoint to see valid options before calling.

bash
curl -X POST http://localhost:3009/api/v1/workflow/interviews/interview-uuid/transition \
  -H "Authorization: Bearer <jwt>" \
  -H "Content-Type: application/json" \
  -d '{
    "transition": "APPROVE",
    "userId": "recruiter-uuid",
    "reason": "Plan looks comprehensive and well-structured"
  }'
Response 200
{
  "interviewId": "interview-uuid",
  "previousState": "PENDING",
  "newState": "APPROVED",
  "transition": "APPROVE",
  "triggeredBy": "recruiter-uuid",
  "reason": "Plan looks comprehensive and well-structured",
  "timestamp": "2024-01-15T11:00:00.000Z"
}
TransitionFrom StateTo StateDescription
VALIDATERECEIVEDVALIDATING_SKILLSStart skill validation
REQUEST_INFORECEIVEDINFO_NEEDEDRequest missing data from HITL
COMPLETE_INFOINFO_NEEDEDVALIDATING_SKILLSInfo completed by HITL
GENERATE_PLANVALIDATING_SKILLSGENERATING_PLANAgno begins plan generation
PLAN_READYGENERATING_PLANPENDINGPlan ready for review
APPROVEPENDINGAPPROVEDRecruiter approves plan
REJECTPENDINGREJECTEDRecruiter rejects plan
MODIFYPENDINGGENERATING_PLANRecruiter requests changes
SCHEDULEAPPROVEDSCHEDULEDInterview scheduled
STARTSCHEDULEDIN_PROGRESSInterview session started
COMPLETEIN_PROGRESSCOMPLETEDInterview session ended
ASSESSCOMPLETEDASSESSMENT_PENDINGAssessment ready for review
APPROVE_ASSESSMENTASSESSMENT_PENDINGASSESSMENT_APPROVEDAssessment approved
CANCEL*CANCELLEDCancel at any stage

GET /workflow/interviews/:id/history

Returns the full audit trail of all state transitions for an interview.

bash
curl http://localhost:3009/api/v1/workflow/interviews/interview-uuid/history \
  -H "Authorization: Bearer <jwt>"
Response 200
{
  "interviewId": "interview-uuid",
  "transitions": [
    {
      "id": "transition-uuid",
      "from": "RECEIVED",
      "to": "VALIDATING_SKILLS",
      "transition": "VALIDATE",
      "triggeredBy": "system",
      "reason": "Data validation passed",
      "timestamp": "2024-01-15T10:00:00.000Z"
    },
    {
      "id": "transition-uuid-2",
      "from": "VALIDATING_SKILLS",
      "to": "PENDING",
      "transition": "PLAN_READY",
      "triggeredBy": "agno-agent",
      "reason": "Plan generation complete",
      "timestamp": "2024-01-15T10:45:00.000Z"
    }
  ]
}

GET /workflow/interviews/:id/available-transitions

Returns the list of valid transitions from the interview's current state. Use this to conditionally render action buttons in the admin UI.

bash
curl http://localhost:3009/api/v1/workflow/interviews/interview-uuid/available-transitions \
  -H "Authorization: Bearer <jwt>"
Response 200 (state: PENDING)
{
  "currentState": "PENDING",
  "transitions": [
    {
      "name": "APPROVE",
      "description": "Approve the plan and generate candidate link",
      "requiredPermission": "interview:approve"
    },
    {
      "name": "REJECT",
      "description": "Reject the plan with a reason",
      "requiredPermission": "interview:approve"
    },
    {
      "name": "MODIFY",
      "description": "Request plan modifications from the AI agent",
      "requiredPermission": "interview:approve"
    },
    {
      "name": "CANCEL",
      "description": "Cancel this interview entirely",
      "requiredPermission": "interview:delete"
    }
  ]
}
Invalid transitions return a 400 Bad Request with the message "Transition X is not valid from state Y". Always check available transitions before calling.
Was this page helpful?