Moving beyond brittle document templates

AWS has published a reference design for document processing that learns how to handle new layouts instead of requiring a manually configured template for every supplier. Dated 14 October, the system uses eight specialised agents across two graph-based workflows on Amazon Bedrock AgentCore. It can classify, extract and validate invoices, purchase orders, insurance claims and other business documents, then retain successful instructions for similar files.

Template-based processing often works until a vendor moves a field, changes a logo or adds a new table. The resulting maintenance grows with every sender and document variant. AWS presents the agentic approach as a way to generate extraction instructions on demand, correct them after validation failure and reuse the validated result, reducing repeated configuration without abandoning structured rules.

Identification decides whether training is needed

Documents arrive through Amazon SES or an S3 upload. EventBridge triggers a Lambda function that creates a tracking job in DynamoDB and invokes AgentCore Runtime. An analyser uses Amazon Textract to extract text and identify the document type and sender. A matcher searches S3 Vectors for similar examples and determines whether a validated instruction set already exists.

If the matcher finds a known layout, the system can proceed directly to extraction using stored instructions. If it does not, a training workflow begins. This explicit branch is valuable because it keeps a novel format from being processed with a merely similar template. The system records novelty as a condition requiring additional work rather than hiding uncertainty inside a confidence score.

Agents generate, test and repair instructions

For an unfamiliar format, an instructions agent creates extraction prompts and an extractor converts the document into structured data. A validator checks the result against schemas and business rules held in Amazon Aurora DSQL. If validation fails, an instructions-fixer agent refines the prompt and retries. Once validation succeeds, a save-instructions agent preserves the method for future documents of that type.

This feedback loop is what makes the system self-improving in the limited operational sense described by AWS. It does not retrain a foundation model or autonomously redefine the business schema. It learns a reusable set of extraction instructions after deterministic validation. That boundary is useful because finance and operations teams can inspect the schema, the correction and the evidence that caused the workflow to accept it.

AgentCore supplies the operating controls

AgentCore Identity manages machine-to-machine credentials, while AgentCore Gateway exposes Lambda tools through Model Context Protocol interfaces. Runtime coordinates the Strands agents, and Observability plus CloudWatch provides telemetry for troubleshooting. A chat-enabled dashboard on ECS shows job status. AWS says the sample can often be deployed in under 20 minutes, though production hardening will take longer.

The design requires Amazon Nova and Anthropic Claude models, as well as access to Textract, S3 Vectors and Aurora DSQL in a supported region. Enterprises should assess where document content is stored, how credentials are scoped and which data appears in traces. Agent-level observability is valuable only when it avoids leaking the sensitive values extracted from invoices or claims.

Validation remains the centre of trust

A workflow can learn a bad instruction if its schema is incomplete or its validation rules accept the wrong value. Teams should test totals, currency, dates, supplier identity and cross-field relationships rather than checking only whether output matches a JSON shape. Human sampling remains important for rare layouts and high-value transactions, especially when a plausible extraction could trigger payment or customer action.

Useful measures include straight-through processing, field-level accuracy, correction reuse and the number of false matches between layouts. The reference architecture offers a disciplined route from novelty to a reusable method. Its success depends less on how many agents it contains than on whether validation is authoritative, exceptions are visible and every learned instruction can be reviewed, versioned and withdrawn.

Governance for learned instructions

Stored extraction instructions become a form of production configuration. They need an owner, creation timestamp, source examples and a record of the validation rules they passed. If a supplier changes its layout, the workflow should version the instructions rather than silently replacing them. That history lets auditors explain why the same field was extracted differently across two periods.

Similarity matching deserves special attention. Two invoices may look alike while using different tax conventions or placing a discount in an unexpected column. Thresholds should favour a new training path when the cost of a false match is high. Teams can monitor borderline similarity scores and use those examples to improve routing without weakening validation.

The reference system can reduce repetitive setup, but it should not learn from every human correction indiscriminately. An authorised correction workflow can distinguish a genuine layout lesson from a one-off exception or operator mistake. Approval before instructions are shared across future documents keeps local errors from becoming automated policy and preserves confidence.