Skip to main content

Overview

The Compliance Engine is a rule evaluation system that lets you define conditions, evaluate candidate and employee data against those conditions, and trigger actions based on the results. It’s the decision-making brain behind automated hiring, onboarding, and workforce compliance.

How Rules Work

A Rule is a condition tree that evaluates to true or false. Rules are composed of Rule Nodes — atomic conditions connected with AND/OR logic.

Rule Nodes

Each Rule Node contains:

Operators

Object Graph Integration

Rules reference data using the Object Graph path system:
This allows rules to evaluate any data point in the system without hardcoding field references.

Rule Instances

A Rule Instance is a rule configured for a specific context. The same rule definition can be reused across multiple contexts with different parameters. Contexts where rules are used:
  • Hiring Flow stages — Gate stage transitions
  • Automations — Conditional action execution
  • Form compliance — Validate form submissions
  • Document requirements — Verify document data

Rule Instance Values

Rule Instance Values provide context-specific parameters:

Rule Executions

Every rule evaluation is recorded as a Rule Execution: This provides a complete audit trail of all compliance decisions.

AI-Powered Rules

Firstwork supports AI-powered rule evaluation where complex conditions can be assessed by LLM:
  • Natural language conditions (“Is this document a valid government-issued ID?”)
  • Document content analysis
  • Sentiment analysis on text responses
  • Complex multi-factor assessments
AI rules use LangChain and LiteLLM to integrate with multiple AI providers (OpenAI, Anthropic, Google).

Using Rules in Automations

Rules serve as the conditional logic in Automations: When an automation fires:
  1. The trigger event occurs
  2. The rule is evaluated against current data
  3. If the rule passes, the associated actions execute
  4. If the rule fails, alternative actions can execute (or nothing happens)

Best Practices

Create small, focused rules that check one thing. Combine them using AND/OR logic for complex conditions. This makes rules easier to debug and reuse. Name rules descriptively: “US Work Authorization Check” is better than “Rule 1”. This helps when reviewing rule executions and debugging compliance issues. Use the rule evaluation preview to test rules against sample data before applying them to active hiring flows. Regularly review rule execution logs to identify:
  • Rules that always pass or fail (may need adjustment)
  • Unexpected evaluation results
  • Performance bottlenecks in complex rule trees