Since Tensorlake is built with a code-first philosophy, the data you extract is structured and can be easily integrated into your existing workflows.

Make sure to have the Tensorlake Python SDK installed. You can install it using pip: pip install tensorlake

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.

1

Define the schema

The Python snippet below will assume you have this schema in a file called real-estate-schema.json in a folder called schema.

real-estate-schema.json
{
  "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"
}
2

Parse the document with the Python SDK

This snippet assumes you have a PDF in a data folder called real-estate-purcahse-all-signed.pdf. You can use this file as a sample.

signature-detection.py
import time
import os
import json
from pathlib import Path

from tensorlake.documentai import DocumentAI
from tensorlake.documentai.models import ParseStatus
from tensorlake.documentai.models.options import (
    ParsingOptions,
    StructuredExtractionOptions,
)

# 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")
print(f"Document uploaded with ID: {document_id}")

# Load schema from file
with open("schemas/real-estate-schema.json", "r") as f:
    schema_json = json.load(f)


real_state_extraction = StructuredExtractionOptions(
    schema_name="real-estate-schema", json_schema=schema_json
)

# Configure parsing options
parsing_options = ParsingOptions(signature_detection=True)

parse_id = doc_ai.parse(
    file=document_id,
    parsing_options=parsing_options,
    page_range="10",
    structured_extraction_options=[real_state_extraction],
)

print(f"Parse job submitted with ID: {parse_id}")

# Get the result
result = doc_ai.get_parsed_result(parse_id=parse_id)

while result.status in [ParseStatus.PENDING, ParseStatus.PROCESSING]:
    print("waiting 5s...")
    time.sleep(5)
    result = doc_ai.get_parsed_result(parse_id=parse_id)
    print(f"Parse status: {result.status.name}")

if( result.status == ParseStatus.FAILURE ):
    print(f"Parse job {parse_id} failed. Exiting")
    exit(1)

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", encoding="utf-8") as f:
    json.dump(result.model_dump(), f, indent=2)

print(f"\n✅ Extracted data saved to {"output/real-estate-output.json"}")
3

Review the output

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. You will find the data in output/real-estate-output.json.

output.json
{
  "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.