
Hybrid AI workflows for document imports
Follow a supplier import with Layest’s Doclay to see where rules, language models, agents and human review fit, and how to measure quality and cost.
An operations team is onboarding a new supplier. The supplier sends a structured master-data form, a scanned company document and an email with a separate billing address. The form contains a supplier reference that software can copy directly. The scanned document needs interpretation. The email explains an exception that could affect which address goes into the system. Treating all three inputs the same creates extra work, extra model calls or both.
Layest builds hybrid workflows for situations like this. Fixed rules handle steps with clear inputs and decisions. Large language models (LLMs) help when a step depends on reading or interpreting variable material. An agent can investigate exceptions when the next step depends on what it finds, and people can review the cases that require a business decision. Doclay, Layest’s Import Agent, makes that division of work concrete. It captures information from documents and other source material, transforms the extracted data, and prepares it for review and export to the destination a team chooses.
What makes a workflow hybrid?
A hybrid workflow uses different methods for different decisions within the same process. The important boundary is who decides what happens next. When the business can specify the decision in advance, a rule can make it. When the step calls for interpreting language or a document layout, a model can propose an answer. When several possible actions might resolve an exception, an agent can choose among permitted tools and use each result to decide what to do next.
Rules handle decisions the business can write down
A rule can check that a required field is present, compare an identifier against master data, or send an approved record to the configured destination. The outcome can be tested against the same inputs and business rules. A document may contain ambiguous information while the rule for what to do with ambiguity stays clear. For example, a record with two conflicting identifiers goes to review every time.
A targeted model call handles interpretation
A model can identify which organisation a letter refers to, extract a field from an unfamiliar form, or distinguish a billing address from a delivery address in a note. Giving the model a specific task and an expected set of fields makes its output easier to validate. The workflow can then resume its regular sequence. This arrangement gives the software control over when to call the model and what context it receives. Jorge Arango’s analysis of targeted model calls.
An agent investigates when the next step is uncertain
An agent might first look up a supplier record, then compare the result against a second document or ask for review. Each result can determine the next action. The workflow still sets the objective, the available tools and the conditions for stopping. In a document process, a tool that reads an existing record and an action that changes that record can have separate permissions. Simon Willison’s explanation of agents and tool loops.
A supplier import with Layest’s Doclay
Doclay connects document intake with downstream work. It reads files and scans, identifies relevant information and prepares structured output. Teams can review, adjust and approve the result before it is finalised. The output can then be prepared for a downstream system, an internal tool, a database or a spreadsheet. Here is how a team could apply those capabilities to a supplier onboarding workflow.
1. Read the fields that are already structured
A supplier form arrives with a reference number, legal name and country. If the fields match the expected schema, the workflow can copy them directly and apply the same validation it uses for records created by staff. It can also check whether the reference has already been imported. This path can run without a language model. The original file remains the reference if the team needs to revisit the import.
2. Use a model to interpret the supporting documents
The scan has a different layout and contains both the parent company and the local subsidiary. The email adds a billing address in free text. A model can propose separate values for the entities and for each address, using the relevant pages and message as context. The output can include an empty value where the evidence is missing. For a review screen, showing the source passage beside a proposed field gives the reviewer something concrete to check.
3. Check the output and route exceptions
A filled field can be well formed and still refer to the wrong company. Rules can check whether a value is present, whether it matches the expected format and whether it agrees with an existing record. If the scan identifies the parent but the form names the subsidiary, a bounded agent could consult an authorised supplier directory and prepare the evidence for review. A human can then resolve which entity belongs in the record. The exception path keeps routine imports moving while protecting consequential decisions.
4. Approve and send a structured record
Once the team has reviewed the proposed record where required, the workflow can map approved fields to the destination’s schema. A useful design gives each import a stable reference so a retry after a temporary connection failure can be handled without creating a second record. At this point, the output is structured and the business decision has been made. The transfer itself can follow the same fixed procedure each time.
Where quality improves
Quality means the downstream record is correct and usable. A rules-only approach can reliably handle known forms, but unfamiliar layouts and free text can leave useful information locked in files. A model can recover more of that context. The rules and review step then address a different kind of quality by catching missing fields, format problems and conflicts before the output reaches another system.
It helps to separate structural checks from checks of meaning. A postal code can pass a format test while belonging to the delivery address instead of the billing address. The relevant question for evaluation is whether the system assigned the right role to each address. For supplier intake, a good test set covers routine forms, scans with inconsistent labels, duplicate submissions, missing evidence and conflicts between two documents. Track both whether the final record is correct and where failures first appeared. Hamel Husain and Shreya Shankar’s guide to AI evaluation.
Human review works best when it has a clear job. A reviewer looking at a conflict should see the competing values, their source and the field that will be exported. Corrections can help the team distinguish a rule that needs changing from a recurring extraction error. That makes it possible to improve the right step and keep the rest of the workflow stable.
Why selective model use can lower costs
Model usage depends on how many calls the workflow makes, what it sends in each call and how many times an exception retries or invokes tools. In the supplier example, checking a reference against an existing record costs no language-model tokens when a conventional query does the work. When a model is needed, passing only the relevant pages or text can reduce the input. An agent can receive a limited budget for tool calls and hand unresolved cases to a reviewer.
Suppose a team imports 1,000 documents and 650 arrive in a known structured format. If the other 350 each require one initial model call, the hybrid workflow makes 350 initial calls instead of 1,000. That is an illustration of how routing changes call volume. Actual cost also depends on document size, model prices, retries and review time. A useful comparison measures the total cost per correctly processed record and checks whether faster processing comes with more corrections downstream.
How to choose the right degree of autonomy
Start with the output the next system needs. List the fields it accepts, where each value should come from and who owns exceptions. Put decisions with explicit criteria on the rule path. Reserve model calls for the fields or passages that require interpretation. Add agent-driven investigation when exceptions recur and the right sequence of checks genuinely varies. Give that path a stopping point and an owner for handoffs.
A pilot should compare the workflow with the existing process using the same mix of inputs. Measure time to an approved record, correction rates by field, how often cases go to review and the model cost per completed import. These measures show where the workflow saves work and where it merely moves work from data entry to review. They also reveal which document formats can move to the rule path as the team standardises its inputs.
What Layest brings to the process
With Doclay, the team can use one workflow to turn incoming files into structured information, review the proposed result and prepare it for the systems where work continues. The supplier example shows why those steps belong together. Intake provides the context for extraction, review connects the proposed values to business judgement, and export gives the process a usable outcome. Each step has a different job and can use the method that fits it.
For the operations team, the result to aim for is straightforward. A supplier record arrives with the correct entity and address, the person responsible for an exception can see what needs deciding, and routine work uses fewer model calls. That is the practical value of Layest’s hybrid approach.