AI Workforce Integration with Document Management Systems (EDI, Diadoc, SBIS)
Electronic document management systems have accumulated terabytes of business documents, but lack the ability to understand them—only store, route, and sign them. AI workforce changes this: agents connect to EDI systems and work with documents the way an experienced employee would—reading, analyzing, filling forms, making decisions.
Integration Architecture
AI workforce integration with EDI is built on an agent layer model over existing infrastructure. No replacement of Diadoc or SBIS—AI agents connect as another document workflow participant, but with automatic processing.
[EDI System (Diadoc / SBIS / 1C EDI)]
↕ REST API / SOAP / Webhook
[AI Integration Layer]
├── Document Receiver Agent
├── Classification Agent
├── Extraction Agent
├── Validation Agent
└── Action Agent (signing, rejection, routing)
↕
[Internal Systems: 1C, ERP, CRM, Database]
Diadoc: API Integration
Diadoc provides REST API with OAuth 2.0 authentication. Key endpoints for AI workforce:
-
GET /v1/GetNewEvents— get new documents (polling or webhook) -
GET /v1/GetDocument— download document body (XML for formalized, PDF/DOCX for unformalized) -
POST /v1/PostMessage— send signed document -
POST /v1/Delete— reject with comment
For document signing, AI agent uses CryptoPro DSP API or local crypto provider. The agent doesn't store keys—it calls signing via a separate secure service.
SBIS: WebAPI Integration
SBIS provides a JSONRPC-based API (SBIS WebAPI). Authentication via SID session. Main methods:
-
SBIS.WriteDocument— create and send -
SBIS.DocumentList— get filtered list -
SBIS.ReadDocument— get content
SBIS specifics: documents often arrive in SBIS-XML format requiring custom parser. For AI processing, an intermediate converter to unified JSON is needed.
Classification and Routing of Incoming Documents
The first agent in the chain is classifier. Its task: determine document type and processing route.
| Document Type | Agent Action |
|---|---|
| Invoice (SF) | Extract fields → verify against order → route for acceptance |
| UPD (invoice + bill of lading) | Full cycle: extraction + verification + accounting |
| Work Completion Act | Compare with contract → verify form compliance → sign or note |
| Contract | Route to legal module for analysis |
| Complaint | Priority routing to quality department |
Classifier is trained on company document corpus (fine-tuned BERT or prompt-based with GPT-4o). Accuracy on typical corpus: 97–99% for formalized formats, 90–95% for unformalized.
Structured Data Extraction
Formalized documents (SF, UPD) in FNS XML format are parsed deterministically—XPath/lxml without LLM. LLM is used only for:
- Unformalized documents (free PDF, Word)
- Documents with non-standard structure
- Data verification and normalization
For unformalized invoice extraction architecture:
# unstructured.io for element splitting
from unstructured.partition.pdf import partition_pdf
elements = partition_pdf(filename="invoice.pdf")
# Prompt with extracted elements → LLM → Pydantic model
class InvoiceFields(BaseModel):
seller_inn: str
buyer_inn: str
invoice_date: date
total_vat: Decimal
total_amount: Decimal
line_items: list[LineItem]
Three-Way Matching
AI workforce's key task in financial document workflow—automatic reconciliation:
- Purchase Order (from ERP)
- Bill of Lading / UPD from EDI
- Invoice from EDI
Agent verifies: items, quantities, prices, total amounts. On discrepancy > acceptable threshold—flag for manual review, on match—automatic signing and payment initiation.
Typical discrepancy thresholds:
- Amount: ±0.5% (rounding error)
- Quantity: 0% (exact match)
- Item: fuzzy matching with 85% threshold (name may differ in spelling)
1C Integration
Bidirectional synchronization via 1C REST API (oData) or COM objects:
- 1C to EDI: automatic formalization and sending of outgoing documents
- EDI to 1C: create 1C documents from accepted EDI (UPD → Goods Receipt, Act → Service Receipt)
For 1C:ERP, the "Electronic Document Exchange" subsystem is used with extension for AI validation before posting.
Exception Handling and Human Control
Not all documents process automatically. System routes exceptions:
- New counterparty (not in database) → verification via tax authority/EGRUL → manual approval
- Amount above threshold (configurable) → mandatory manual authorization
- Data discrepancy → notify responsible person + lock until resolution
- Response deadline exceeded → automatic request extension or escalation
Monitoring and SLA
Key production metrics:
- Straight-through processing rate — share of documents without manual intervention: goal 70–85%
- Processing latency — from receipt to decision: goal < 5 minutes for typical documents
- Extraction accuracy — accuracy on key fields: goal > 98% for formalized
- False positive rate — share of correct documents wrongly routed for manual review: goal < 5%
Security and Compliance
- Qualified electronic signature (QES) stored in HSM or secure crypto service
- AI agent has no direct key access—only calls signing API
- Complete audit trail for tax authorities: who made decision (human or AI), on what basis
- Compliance with Federal Law 63-FZ "On Electronic Signature"
Implementation Timeline
Weeks 1–3: Connect to Diadoc/SBIS API, basic receiver and classifier
Weeks 4–6: Extraction pipeline for priority document types (SF, UPD)
Weeks 7–9: 3-way matching, 1C integration, exception UI
Weeks 10–12: Pilot on real flows, threshold tuning, production launch







