Since Tensorlake is built with a code-first philosophy, the data you extract is structured and can be easily integrated into your existing workflows.
Here is an example of how to use the Tensorlake Python SDK to parse a real estate purchase agreement and extract the buyer and seller signatures, names, and signature dates.
First, define the schema:
{
"properties": {
"buyer": {
"properties": {
"buyer_name": {
"type": "string"
},
"buyer_signature_date": {
"description": "Date and time (if both are available) that the buyer signed.",
"type": "string"
},
"buyer_signed": {
"description": "Determine if the buyer signed the agreement",
"type": "boolean"
}
},
"type": "object"
},
"seller": {
"properties": {
"seller_name": {
"type": "string"
},
"seller_signature_date": {
"description": "Date and time (if both are available) that the seller signed.",
"type": "string"
},
"seller_signed": {
"description": "Determine if the seller signed the agreement",
"type": "boolean"
}
},
"type": "object"
}
},
"title": "leasing_agreement",
"type": "object"
}
And here is the Python snippet that uses the Tensorlake SDK:
from tensorlake.documentai import DocumentAI
from tensorlake.documentai.parse import (
ParsingOptions,
ExtractionOptions
)
import time
import os
import json
import os
from pathlib import Path
# Initialize the client and add your API Key
doc_ai = DocumentAI(api_key="YOUR_API_KEY")
# Upload the document
document_id = doc_ai.upload(path="data/real-estate-purchase-all-signed.pdf")
# Load schema from file
with open("schemas/real-estate-schema.json", "r") as f:
schema_json = json.load(f)
# Convert to JSON string
schema_string = json.dumps(schema_json)
# Configure parsing options
options = ParsingOptions(
page_range="10", # Only parse the final page
extraction_options=ExtractionOptions(
schema=schema_string
),
detect_signature=True,
)
# Parse the document
job_id = doc_ai.parse(document_id, options)
# Get the result
result = doc_ai.get_job(job_id)
while True:
if result.status in ["pending", "processing"]:
print("waiting 5s...")
time.sleep(5)
result = doc_ai.get_job(job_id)
print(f"job status: {result.status}")
else:
if result.status == "successful":
print("Successully parsed the document!")
# Save to a pretty-printed JSON file
os.makedirs(os.path.dirname("output/real-estate-output.json"), exist_ok=True)
with open("output/real-estate-output.json", "w") as f:
json.dump(result.model_dump(), f, indent=2)
print(f"\n✅ Extracted data saved to {"output/real-estate-output.json"}")
break
As output, you will get a JSON file with the extracted data, including the buyer and seller names, signature dates, and whether they signed the agreement.:
{
"pages": [
{
"page_number": 0,
"json_result": {
"buyer": {
"buyer_name": "Nova Ellison",
"buyer_signature_date": "September 10, 2025",
"buyer_signed": true
},
"seller": {
"seller_name": "Juno Vega",
"seller_signature_date": "September 10, 2025",
"seller_signed": true
}
}
}
]
}
With this output you have precision and automation with very little code—and can be extended with webhooks, LangGraph agents, or even downstream CRM updates.