Schema-Validated LLM Workflows: A Benchmark Protocol and Comparative Evaluation Across Six Python Implementations
Organizations: Dhillon School of Business, University of Lethbridge, Canada · Al Hussein Technical University, Jordan · Universidad de Guanajuato, Mexico · Universidad de Guadalajara, Mexico
Abstract
Large language models are increasingly used to extract records, generate SQL, summarize reports, answer policy questions, and route operational work. At these software boundaries, parseable output is necessary but does not establish task correctness. We present a reproducible benchmark protocol, a public executable artifact, and a confirmatory live API evaluation that separate structural validity from task-specific correctness across five business workflow tasks and six Python implementation conditions: PydanticAI, LangGraph, DSPy, CrewAI, Agno, and a framework-free SDK reference. We hypothesize that (H1) schema validity and task quality are separable, (H2) structured-output binding paths are heterogeneous under a shared model and lowest-common-denominator contract, and (H3) condition-by-task interactions concentrate failures rather than shifting all tasks equally. Confirmatory analysis uses distinct task instances (100 extraction and 50 per other task, with three nested replicates) under a frozen analysis plan, yielding a 5400-row primary matrix with equivalence margins and Holm-adjusted contrasts against the SDK reference. In the eligible confirmatory run, overall schema validity was 0.684 and mean automated quality was 0.638. PydanticAI, LangGraph, and DSPy retained near-ceiling schema validity with mean quality 0.91-0.94, while the plain SDK, Agno, and CrewAI conditions were substantially lower in this package and model configuration. Schema-valid rows still produced many task-score flags, especially in extraction and compliance QA, and quality residuals show strong condition-by-task interactions (including a workflow collapse for CrewAI). Labelled ablations address retry budgets and feature-using mechanisms; primary contrasts remain system-configuration findings, not causal attributions to marketed library features.
Figures & tables
| Task input and ground truth | Provider constraint and implementation condition | Shared record and evaluation | ||
| Structural scorer task-specific scorer cost and audit fields |
| Benchmark family | Typical unit of analysis | Gap relative to this protocol |
|---|---|---|
| Constrained decoding / JSON Schema benches (e.g., JSONSchemaBench, StructEval, SOB) | Schema coverage, parseability, constrained-decoding engines | Rarely compares application-boundary implementations on matched business tasks with shared task scorers. |
| Validity–correctness studies (e.g., Constraint Tax) | Paired validity vs. answer/executable accuracy | Strong on metric separation; not a multi-framework business-workflow harness. |
| Agent tool/state benches (e.g., AgentBench, CORE, tool-trace validators) | Tools, trajectories, path or state success | Often omit a shared schema-validity surface and an SDK reference that isolates provider enforcement. |
| Business-task evals (SQL, extraction, factuality) | Task correctness on domain data | Often report correctness without comparing the engineering boundary that accepted the output. |
| This protocol | Implementation condition business task under shared schemas, scorers, and provenance | Connects structural validity, task scoring, cost, and mechanism ablations under a frozen confirmatory plan. |
| Question | Current evidence | Admissible claim |
|---|---|---|
| RQ1 | Hardened runners, provenance, and live execution paths across 30 implementation–task cells | Configured paths complete and enter the reporting pipeline under pinned model/package settings. |
| RQ2 / H1 | Structural flags, deterministic task scores, effective design counts | Schema validity can coexist with lower automated task scores; flags are candidates until human review. |
| RQ3 / H2–H3 | Eligible confirmatory matrix under frozen power/equivalence settings | Instance-clustered paired contrasts vs plain SDK; condition task residuals describe interactions. |
| RQ4 | Labeled ablation/stress rows and mechanism tables | Causal attribution only for conditions that activate the claimed mechanism. |
| Task | Input | Required output |
|---|---|---|
| Structured extraction | Synthetic invoices and complaints | Typed fields, optional values, confidence, and error state |
| SQL generation | Question and SQLite schema | Query, explanation, referenced tables and columns, or refusal |
| Report summarization | Synthetic tabular and narrative report | Headline, revenue summary, risks, recommendations, and outlook |
| Compliance QA | Synthetic policy and question | Answer, quoted citations, confidence, unsupported-claim list, and review flag |
| Workflow decision | Synthetic support request | Classification, proposed tool, extracted entities, recommendation, and review flag |
| Condition | Confirmatory LCD mechanism | Interpretation limit |
|---|---|---|
| PydanticAI | Agent with a Pydantic output_type | Validators/typed deps reserved for labeled ablations. |
| Plain SDK | Provider JSON Schema response format followed by Pydantic parsing | Framework-free reference for provider enforcement plus local parsing. |
| LangGraph | Structured model call wrapped in a small retry graph | Does not test a stateful business process or human interrupt. |
| DSPy | Untuned typed signature and Predict with application coercion | Does not test metric-driven optimization. |
| CrewAI | One agent and one task with output_pydantic | Does not test delegation or multi-agent coordination. |
| Agno | One agent with a Pydantic output schema | Does not test tools, teams, or workflow state. |
| Task | Confirmatory primary score | Hardening in the artifact |
|---|---|---|
| Extraction | Macro-average of normalized field matches | Distinct layouts/templates with template_id ; label-derivability tests |
| SQL | Result-set equality under read-only checks | Separate fresh DBs for predicted vs gold; reject non-SELECT writes |
| Summarization | Source-fact coverage with unsupported-content penalty | Forbidden-term penalty in quality score; blinded review packet |
| Compliance QA | Answer/citation support with unsupported-claim penalty | Claim-grounding scores beyond empty-list exact match |
| Workflow | Decision fields plus tool execution and state-path match | Shared tool stubs and expected state paths scored on every row |
| Task | Instances | Approx. MDE (quality) | Equiv. power @ 0 | Notes |
|---|---|---|---|---|
| Extraction | 100 | 0.024 | 0.999 | 3 nested replicates |
| SQL generation | 50 | 0.034 | 0.986 | Distinct DB per instance |
| Summarization | 50 | 0.034 | 0.986 | Unsupported-content penalty |
| Compliance QA | 50 | 0.034 | 0.986 | Claim grounding |
| Workflow | 50 | 0.034 | 0.986 | Executed tool/state scoring |
| Condition | Extract | SQL | Summary | Compliance | Workflow | Overall |
|---|---|---|---|---|---|---|
| PydanticAI | 100.0 | 100.0 | 100.0 | 100.0 | 100.0 | 100.0 |
| LangGraph | 100.0 | 100.0 | 100.0 | 100.0 | 100.0 | 100.0 |
| DSPy | 99.3 | 100.0 | 100.0 | 100.0 | 100.0 | 99.8 |
| Plain SDK | 33.3 | 33.3 | 64.0 | 35.3 | 33.3 | 38.8 |
| Agno | 33.3 | 33.3 | 63.3 | 35.3 | 34.0 | 38.8 |
| CrewAI | 32.0 | 33.3 | 64.0 | 35.3 | 0.0 | 32.8 |
| Condition | Extract | SQL | Summary | Compliance | Workflow | Overall |
|---|---|---|---|---|---|---|
| PydanticAI | 0.921 | 0.873 | 0.992 | 0.973 | 0.928 | 0.935 |
| LangGraph | 0.922 | 0.880 | 1.000 | 0.976 | 0.941 | 0.940 |
| DSPy | 0.890 | 0.760 | 1.000 | 0.981 | 0.944 | 0.911 |
| Plain SDK | 0.307 | 0.293 | 0.640 | 0.345 | 0.308 | 0.367 |
| Agno | 0.307 | 0.287 | 0.631 | 0.345 | 0.313 | 0.365 |
| CrewAI | 0.292 | 0.280 | 0.640 | 0.345 | 0.000 | 0.308 |
| Task | Rows | Designs | Schema-valid | Flagged ( ) | Mean |
|---|---|---|---|---|---|
| compliance_qa | 900 | 50 | 609 | 370 | 0.661 |
| extraction | 1800 | 100 | 1194 | 642 | 0.606 |
| multi_step | 900 | 50 | 551 | 175 | 0.572 |
| sql_generation | 900 | 50 | 600 | 94 | 0.562 |
| summarization | 900 | 50 | 737 | 9 | 0.817 |
| Condition | Extract | SQL | Summary | Compliance | Workflow |
|---|---|---|---|---|---|
| PydanticAI | +0.017 | +0.014 | -0.122 | +0.015 | +0.058 |
| LangGraph | +0.013 | +0.015 | -0.120 | +0.013 | +0.066 |
| DSPy | +0.011 | -0.076 | -0.091 | +0.047 | +0.098 |
| Plain SDK | -0.028 | +0.002 | +0.094 | -0.045 | +0.006 |
| Agno | -0.027 | -0.003 | +0.087 | -0.043 | +0.014 |
| CrewAI | +0.015 | +0.047 | +0.152 | +0.014 | -0.243 |
| Condition | Metric | PydanticAI | LangGraph | DSPy | Plain SDK | Agno | CrewAI |
|---|---|---|---|---|---|---|---|
| Zero-retry | schema | 100.0 | 100.0 | 80.0 | 100.0 | 80.0 | 60.0 |
| quality | 0.925 | 0.934 | 0.741 | 0.926 | 0.730 | 0.555 | |
| provider_calls | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | |
| After retry budget | schema | 100.0 | 100.0 | 80.0 | 100.0 | 80.0 | 60.0 |
| quality | 0.923 | 0.934 | 0.741 | 0.926 | 0.739 | 0.555 | |
| provider_calls | 1.00 | 1.00 | 1.60 | 1.00 | 1.60 | 2.20 |
| Condition | Task | Schema% | Quality | Calls |
|---|---|---|---|---|
| Validators off | SQL | 100.0 | 0.867 | 1.00 |
| Compliance | 100.0 | 0.966 | 1.00 | |
| Workflow | 100.0 | 0.920 | 1.00 | |
| Validators on | SQL | 100.0 | 0.867 | 1.00 |
| Compliance | 100.0 | 0.973 | 1.00 | |
| Workflow | 100.0 | 0.933 | 1.00 |
| Condition | Task | Schema% | Quality | Calls | Typed-deps trace |
|---|---|---|---|---|---|
| Prompt-only context | Compliance | 100.0 | 0.973 | 1.00 | 0% |
| Workflow | 100.0 | 0.911 | 1.00 | 0% | |
| Typed dependencies | Compliance | 100.0 | 0.974 | 1.00 | 100% |
| Workflow | 100.0 | 0.933 | 1.00 | 100% |
| Task family | Business process | What “good” must mean operationally |
|---|---|---|
| Extraction | Accounts payable / intake automation | Fields are present and match the source document before posting. |
| SQL generation | Self-serve analytics | Query executes under least privilege and returns the intended grain. |
| Summarization | Management reporting | Claims are supported by the report; fluency is not enough. |
| Compliance QA | Policy / controls advisory | Answers cite the governing text and abstain when unsupported. |
| Workflow decision | Tier-1 support / case routing | Tool choice and human-review flags match operating procedure. |
| Threat | Consequence for this paper | Mitigation in the confirmatory design |
|---|---|---|
| Construct-limited scores | Automated flags are not human-confirmed semantic error rates. | Deterministic scorers plus blinded audit packets; flags reported as candidates. |
| Implementation mismatch | The LCD matrix uses only a subset of each library’s advertised mechanisms. | Labeled feature-using ablations for RQ4; attribute results to concrete configurations. |
| Adapter fragility | CrewAI/Agno surfaces can change with package versions. | Pin versions in run provenance; retain SDK baseline. |
| Synthetic data | Clean templates may not represent document noise or production tools. | Stratify harder synthetic cases; report licensed public-data extensions separately. |
| Single model and time period | Provider behavior and library integrations can change. | Pin versions; optional secondary-model ablation subset. |
| Incomplete mechanism coverage | Retry/validator/typed-deps ablations do not exhaust RQ4. | Expand ablations before mechanism-level product claims. |
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
| Mechanism | Minimum active condition | Required evidence |
|---|---|---|
| Provider enforcement | Strict schema mode versus relaxed generation with the same final validator | Exact request mode, provider acceptance, parse result, and independent validity |
| Retry feedback | Common call budget with and without validation feedback | Attempt count, feedback text or hash, retry cause, final status, tokens, and latency |
| Typed dependencies/tools | Versioned resource passed through a typed boundary and an executed tool | Dependency version, validated arguments, authorization, tool result, and final disposition |
| Graph state | Multiple nodes, persisted state, and a review or recovery interrupt | State transitions, checkpoint/restart evidence, approval decision, and executed outcome |
| DSPy optimization | Frozen train/development/test split and declared optimizer | Optimizer configuration, development calls and cost, compiled program, and held-out results |
| Condition | Files | LOC | Markers | Optional dependencies |
|---|---|---|---|---|
| PydanticAI | 1 | 162 | 2 | pydantic-ai |
| Plain SDK | 1 | 146 | 7 | none beyond shared dependencies |
| LangGraph | 1 | 193 | 6 | langgraph , langchain-openai |
| Agno | 1 | 142 | 3 | agno |
| DSPy | 1 | 217 | 6 | dspy |
| CrewAI | 1 | 237 | 6 | crewai |
LLM Evaluation
Large language model evaluation measures what models can do, how reliably they do it, and whether benchmark scores predict real-world performance.
See all 2,567 papers