Workflow Adherence
Validates that an agent followed an expected step sequence. Compares actual steps extracted from the output (or tool calls) against a configured expected order using Longest Common Subsequence (LCS) analysis, with support for required and prohibited step checks.
Config
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
expected_steps | string[] | Yes | — | Ordered list of expected steps |
required_steps | string[] | No | [] | Steps that must appear (order doesn't matter) |
prohibited_steps | string[] | No | [] | Steps that must NOT appear |
strict_order | boolean | No | false | If true, exact order is required (not just LCS match) |
extract_from | string | No | output | output (text parsing) or tool_calls (structured extraction) |
Use Cases
- Multi-step agent validation — Verify that an agent executes steps in the correct order, such as "authenticate, fetch data, validate, respond."
- Tool call sequence checking — Use
extract_from: "tool_calls"to validate that the agent called the right tools in the expected sequence. - Safety guardrails — Define prohibited steps to ensure agents never skip validation steps or call dangerous operations directly.
- Process compliance — Enforce that business processes are followed in order, such as KYC verification before account creation.
Examples
Basic step sequence
{
"expected_steps": ["PARSE_INPUT", "VALIDATE", "PROCESS", "RESPOND"],
"extract_from": "output"
}Tool call validation with required steps
{
"expected_steps": ["lookup_user", "check_balance", "process_payment", "send_receipt"],
"required_steps": ["check_balance", "process_payment"],
"extract_from": "tool_calls"
}
// Order is checked via LCS; required steps must appear regardless of positionStrict order with prohibited steps
{
"expected_steps": ["verify_identity", "fetch_records", "generate_report"],
"prohibited_steps": ["delete_records", "admin_override"],
"strict_order": true,
"extract_from": "tool_calls"
}
// Exact order required; fails if prohibited tools are calledFlexible ordering with required steps only
{
"expected_steps": ["GREET", "COLLECT_INFO", "VALIDATE", "CONFIRM", "CLOSE"],
"required_steps": ["VALIDATE", "CONFIRM"]
}
// VALIDATE and CONFIRM must appear; overall order scored via LCSScoring
The final score is a weighted combination: 60% order score (LCS length / expected steps) + 30% required steps score (found / total required) + 10% prohibited steps clean (1.0 if none found, 0.0 if any found). When no required steps are configured, the weights shift to 90% order + 10% prohibited. Scores at or above 0.5 are labeled "pass." The reasoning field lists the extracted steps, LCS details, any missing required steps, and any prohibited steps found.
Performance
Purely deterministic with no external API calls. Step extraction supports multiple formats: JSON arrays, markdown headers, labeled patterns (e.g. "Step 1: NAME"), ALL_CAPS identifiers, and line-delimited lists. Tool call extraction handles OpenAI format and generic name fields. The LCS computation runs in O(n*m) time where n and m are the step counts — negligible for typical workflows.