mech.app
Automation

AWS Bedrock Document Analysis: How Multi-Agent Pipelines Extract Structured Data from Unstructured PDFs

Dissecting AWS's document processing pipeline: how BDA, Strands Agents, and Knowledge Bases coordinate extraction, analysis, and retrieval tasks.

Source: aws.amazon.com
AWS Bedrock Document Analysis: How Multi-Agent Pipelines Extract Structured Data from Unstructured PDFs

AWS just published a reference architecture for intelligent document processing that shows how three Bedrock services coordinate to turn unstructured PDFs into queryable insights. The pipeline combines Amazon Bedrock Data Automation (BDA) for extraction, Strands Agents on Amazon Bedrock AgentCore Runtime for orchestration, and Amazon Bedrock Knowledge Bases for cross-document retrieval. This is not a wrapper around OCR. It is a multi-agent system with task delegation boundaries, state handoffs, and failure recovery patterns.

Pipeline Architecture

The system splits document processing into three layers:

  1. Extraction layer: BDA handles document splitting, classification, and field extraction
  2. Analysis layer: Strands Agents coordinate specialized processing tasks (validation, normalization, enrichment)
  3. Retrieval layer: Knowledge Bases index structured outputs and enable semantic search across document collections

BDA receives a PDF (up to 3,000 pages, 500 MB), automatically splits it along logical boundaries, classifies each section, and routes sections to processing blueprints. A blueprint is a schema that defines which fields to extract and how to validate them. BDA returns structured JSON with confidence scores for each extracted field.

Strands Agents sit downstream. They receive BDA output and decide whether to validate extracted data, enrich it with external sources, or route it to a Knowledge Base for indexing. Each agent is a stateful process with access to tools (API calls, database queries, file operations). The AgentCore Runtime manages agent lifecycle, retries, and observability hooks.

Knowledge Bases store the final structured data as vector embeddings. When a user queries the system, the retrieval agent searches across indexed documents and returns contextually relevant answers.

Task Delegation Boundaries

The pipeline routes work based on document type and processing requirements:

TaskServiceTrigger Condition
Document splittingBDAMulti-section PDF detected
Field extractionBDABlueprint match found
Data validationStrands AgentConfidence score < 0.85
External enrichmentStrands AgentMissing required fields
Cross-document searchKnowledge BaseUser query received

BDA handles deterministic extraction. If a document matches a known blueprint (invoice, contract, medical record), BDA extracts fields and returns structured JSON. If confidence is high (> 0.85), the pipeline writes directly to the Knowledge Base. If confidence is low, a validation agent reviews the extraction and either corrects errors or flags the document for human review.

Strands Agents handle non-deterministic tasks. A contract analysis agent might extract clauses, compare them to a compliance database, and generate a risk summary. An invoice processing agent might validate line items against a purchase order API and flag discrepancies.

State Management and Context Passing

Each stage in the pipeline produces an artifact that the next stage consumes:

# BDA extraction output
# S3 artifacts stored as JSON; DynamoDB uses attribute types for metadata.
# Ensure schema versioning for backward compatibility.
extraction_result = {
    "document_id": "inv-2026-001",
    "document_type": "invoice",
    "confidence": 0.92,
    "fields": {
        "vendor": "Acme Corp",
        "total": 15420.00,
        "line_items": [...]
    },
    "metadata": {
        "page_count": 3,
        "processing_time_ms": 1240
    }
}

# Strands Agent enrichment
enriched_result = {
    **extraction_result,
    "validation_status": "approved",
    "external_data": {
        "vendor_id": "V-12345",
        "payment_terms": "Net 30",
        "tax_rate": 0.08
    },
    "agent_trace": [
        {"agent": "validator", "action": "check_totals", "result": "pass"},
        {"agent": "enricher", "action": "lookup_vendor", "result": "found"}
    ]
}

# Knowledge Base indexing
kb_entry = {
    "embedding": [...],  # Vector representation
    "source_document": "inv-2026-001",
    "structured_data": enriched_result,
    "indexed_at": "2026-06-12T14:43:11Z"
}

Context flows through S3 objects and DynamoDB state tables. BDA writes extraction results to S3. The orchestration layer (Step Functions or EventBridge) triggers a Strands Agent with the S3 path. The agent reads the extraction, performs validation, writes enriched data back to S3, and updates a DynamoDB table with processing status. The Knowledge Base indexer watches the DynamoDB stream and ingests completed documents.

This design decouples stages. If the validation agent crashes, the extraction result remains in S3. The orchestrator can retry the validation step without re-running BDA.

Failure Modes and Recovery

The pipeline handles failures at each layer:

BDA extraction failures: If a document does not match any blueprint, BDA returns an unstructured text dump with low confidence scores. The orchestrator routes these to a fallback agent that attempts generic extraction or queues the document for manual review.

Agent execution failures: If a Strands Agent times out or throws an exception, the AgentCore Runtime retries up to three times with exponential backoff. If all retries fail, the runtime writes a failure record to DynamoDB and sends an alert to CloudWatch. The orchestrator can replay failed tasks from the last known good state.

Knowledge Base indexing failures: If the embedding model is unavailable or the vector store is full, the indexer writes the document to a dead-letter queue. A separate process monitors the queue and retries indexing during off-peak hours.

The system uses idempotency tokens to prevent duplicate processing. Each document gets a unique ID at ingestion. If the same document is submitted twice, BDA checks DynamoDB for an existing extraction result and returns it instead of re-processing.

Observability and Tracing

The pipeline exposes traces at three levels:

  1. Document-level traces: Track a single document from ingestion to indexing
  2. Agent-level traces: Show tool calls, retries, and execution time for each agent
  3. System-level metrics: Aggregate throughput, error rates, and latency across all documents

AWS X-Ray captures distributed traces. Each stage in the pipeline creates a segment with metadata (document ID, processing time, confidence scores). X-Ray propagates trace IDs through EventBridge events and agent context, allowing a single query to follow a document from BDA ingestion through Knowledge Base indexing. Developers can query X-Ray to find bottlenecks or trace failures back to the source.

CloudWatch Logs Insights stores structured logs from each agent. A typical log entry includes:

{
  "timestamp": "2026-06-12T14:43:11Z",
  "document_id": "inv-2026-001",
  "agent": "validator",
  "action": "check_totals",
  "input": {"extracted_total": 15420.00, "calculated_total": 15420.00},
  "output": {"status": "pass", "confidence": 0.98},
  "duration_ms": 340
}

Developers can query logs to answer questions like “Which documents failed validation in the last 24 hours?” or “What is the average processing time for invoices over 10 pages?”

Deployment Shape

The reference architecture runs entirely on managed services:

  • BDA: Serverless API, pay per document processed
  • Strands Agents: Containers on AgentCore Runtime (Fargate or Lambda)
  • Knowledge Bases: Managed vector store (OpenSearch Serverless or Aurora Serverless)
  • Orchestration: Step Functions or EventBridge Pipes
  • State storage: DynamoDB for metadata, S3 for artifacts

A typical deployment for 10,000 documents per day costs approximately $800/month1:

  • BDA: $0.05 per document = $500
  • AgentCore Runtime: 100 agent-hours at $2/hour = $200
  • Knowledge Base storage: 50 GB at $1/GB = $50
  • Orchestration and state: $50

The pipeline scales horizontally. BDA auto-scales based on request volume. AgentCore Runtime spins up containers on demand. Knowledge Bases shard across multiple nodes as the index grows.

Security Boundaries

Each service runs in a separate security context:

  • BDA processes documents in an isolated execution environment and does not persist data beyond the API response
  • Strands Agents run in VPC-isolated containers with IAM roles scoped to specific S3 buckets and DynamoDB tables
  • Knowledge Bases encrypt embeddings at rest (KMS) and in transit (TLS 1.3)

Sensitive documents (medical records, financial statements) can be processed with additional controls:

  • Enable VPC endpoints to keep traffic off the public internet
  • Use customer-managed KMS keys for S3 and DynamoDB encryption
  • Enable CloudTrail logging for all API calls
  • Restrict agent IAM roles to least-privilege access

The pipeline does not support on-premises deployment. All processing happens in AWS regions. For air-gapped environments, consider Amazon Textract (self-hosted OCR) with custom agent orchestration.

Technical Verdict

Use this pipeline if:

  • Document volume exceeds 1,000 per month AND document schemas are stable (less than 20% variation across batches)
  • You need confidence scores and validation workflows for extracted data
  • Cross-document semantic search is a core requirement
  • Your team prefers managed infrastructure over custom extraction logic

Avoid this pipeline if:

  • Latency SLA is under 5 seconds (BDA typically takes 5-15 seconds per document)
  • Documents are free-form prose without structured fields (contracts with highly variable clause structures, research papers, unstructured reports)
  • You require on-premises or air-gapped deployment
  • Document volume is under 500 per month and custom extraction logic would cost less than $250/month

The multi-agent coordination pattern is the real value. BDA handles the hard parts of document understanding. Strands Agents add business logic. Knowledge Bases enable retrieval. The orchestration layer ties them together with retries, observability, and state management. This is production-grade document processing without building your own OCR pipeline.

Footnotes

  1. Pricing snapshot: June 2026. Verify current BDA rates ($0.05/doc), AgentCore Runtime ($2/agent-hour), and Knowledge Base storage ($1/GB) in AWS Bedrock pricing documentation before budgeting.