Colab examples are coming soon. This page describes the workflow you will implement.
For Agents SDK usage and tool patterns, see the OpenAI Agents SDK docs.
Inputs and output
- Inputs: invoice PDF, MSA PDF
- Output: validation decision JSON, list of issues, citations to source locations in the documents
Step 1: Define schemas
Keep schemas small and version them in code. The goal is a stable interface for downstream validation logic.Invoice fields
MSA terms
Step 2: Define document ingestion tools
Define tool functions that call Tensorlake extraction and return structured fields plus citations. Your agent will call these tools as needed.Step 3: Validate deterministically
Write validations as code. Keep them explicit and testable. Common checks:- Vendor and customer match the MSA
- Currency matches the contract
- Billing period dates are within the contract term
- PO number present when required
- Totals are consistent with subtotal and tax
- Line items and rates match the rate card rules you enforce
Step 4: Orchestrate with OpenAI Agents SDK
Register the ingestion tools and validation logic as agent tools. Provide the agent with clear instructions and let it decide what it needs to call.Citations and auditability
Tensorlake returns layout information that includes page numbers and bounding boxes for extracted content. Use citations to show evidence for extracted fields, attach source references to audit logs, and speed up exception review.Need help building your first agent workflow? Join our Slack Community.