Chandrasekharan M 0c0c8c1034 UN-2793 [FEAT] Add retry logic with exponential backoff to SDK1 (#1564)
* UN-2793 [FEAT] Add retry logic with exponential backoff to SDK1

Implemented automatic retry logic for platform and prompt service calls
with configurable exponential backoff, comprehensive test coverage, and
CI integration.

Features:
- Exponential backoff with jitter for transient failures
- Configurable via environment variables (MAX_RETRIES, MAX_TIME, BASE_DELAY, etc.)
- Retries ConnectionError, Timeout, HTTPError (502/503/504), OSError
- 67 tests with 100% pass rate
- CI integration with test reporting

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* [SECURITY] Use full commit SHA for sticky-pull-request-comment action

Replace tag reference with full commit SHA for better security:
- marocchino/sticky-pull-request-comment@v2 → @7737449 (v2.9.4)

This prevents potential supply chain attacks where tags could be moved
to point to malicious code. Commit SHAs are immutable.

Fixes SonarQube security hotspot for external GitHub action.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* [FIX] Allow retryable HTTP errors (502/503/504) to propagate for retry

Fixed HTTPError handling in _get_adapter_configuration to check status
codes and re-raise retryable errors (502, 503, 504) so the retry
decorator can handle them. Non-retryable errors are still converted
to SdkError as before.

Changes:
- Check HTTPError status code before converting to SdkError
- Re-raise HTTPError for 502/503/504 to allow retry decorator to retry
- Added parametrized test for all retryable status codes (502, 503, 504)
- All 12 platform tests pass

This fixes a bug where 502/503/504 errors were not being retried
because they were converted to SdkError before the retry decorator
could see them.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* [FIX] Use pytest.approx() for floating point comparisons in tests

Replaced direct equality comparisons (==) with pytest.approx() for
floating point values to avoid precision issues and satisfy SonarQube
code quality check (python:S1244).

Changes in test_retry_utils.py:
- test_exponential_backoff_without_jitter: Use pytest.approx() for 1.0, 2.0, 4.0, 8.0
- test_max_delay_cap: Use pytest.approx() for 5.0

This is the proper way to compare floating point values in tests,
accounting for floating point precision limitations.

All 4 TestCalculateDelay tests pass.

Fixes SonarQube: python:S1244 - Do not perform equality checks with
floating point values.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* minor: Addressed code smells, ruff fixes

* misc: Fixed tox config for sdk1 tests

* misc: Ruff issues fixed

* misc: tox tests fixed

* prompt service lock file for venv

* updated lock files for backend and prompt-service

* UN-2793 [FEAT] Update to unstract-sdk v0.78.0 with retry logic support (#1567)

[FEAT] Update unstract-sdk to v0.78.0 across all services and tools

- Updated unstract-sdk dependency from v0.77.3 to v0.78.0 in all pyproject.toml files
  - Main repository, backend, workers, platform-service, prompt-service
  - filesystem and tool-registry modules
- Updated tool requirements.txt files (structure, classifier, text_extractor)
- Bumped tool versions in properties.json:
  - Structure tool: 0.0.88 → 0.0.89
  - Classifier tool: 0.0.68 → 0.0.69
  - Text extractor tool: 0.0.64 → 0.0.65
- Updated tool versions in backend/sample.env and public_tools.json
- Regenerated all uv.lock files with new SDK version

This update brings in the retry logic with exponential backoff from unstract-sdk v0.78.0

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>

---------

Signed-off-by: Chandrasekharan M <117059509+chandrasekharan-zipstack@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-10-09 10:48:19 +05:30
2025-04-01 13:33:21 +05:30
2024-02-25 16:19:36 +05:30
2025-04-24 16:07:02 +05:30
2025-04-24 16:07:02 +05:30
2024-03-20 14:24:20 +05:30
2025-09-25 12:57:53 +05:30
2024-04-03 14:01:00 +05:30

Unstract

The Data Layer for your Agentic Workflows—Automate Document-based workflows with close to 100% accuracy!

Python Version from PEP 621 TOML uv GitHub License Docker Pulls CLA assistant pre-commit.ci status Quality Gate Status Bugs Code Smells Coverage Duplicated Lines (%)

🤖 Prompt Studio

Prompt Studio is a purpose-built environment that supercharges your schema definition efforts. Compare outputs from different LLMs side-by-side, keep tab on costs while you develop generic prompts that work across wide-ranging document variations. And when you're ready, launch extraction APIs with a single click.

img Prompt Studio

🔌 Integrations that suit your environment

Once you've used Prompt Studio to define your schema, Unstract makes it easy to integrate into your existing workflows. Simply choose the integration type that best fits your environment:

Integration Type Description Best For Documentation
🖥️ MCP Servers Run Unstract as an MCP Server to provide structured data extraction to Agents or LLMs in your ecosystem. Developers building Agentic/LLM apps/tools that speak MCP. Unstract MCP Server Docs
🌐 API Deployments Turn any document into JSON with an API call. Deploy any Prompt Studio project as a REST API endpoint with a single click. Teams needing programmatic access in apps, services, or custom tooling. API Deployment Docs
⚙️ ETL Pipelines Embed Unstract directly into your ETL jobs to transform unstructured data before loading it into your warehouse / database. Engineering and Data engineering teams that need to batch process documents into clean JSON. ETL Pipelines Docs
🧩 n8n Nodes Use Unstract as ready-made nodes in n8n workflows for drag-and-drop automation. Low-code users and ops teams automating workflows. Unstract n8n Nodes Docs

☁️ Getting Started (Cloud / Enterprise)

The easy-peasy way to try Unstract is to sign up for a 14-day free trial. Give Unstract a spin now!

Unstract Cloud also comes with some really awesome features that give serious accuracy boosts to agentic/LLM-powered document-centric workflows in the enterprise.

Feature Description Documentation
🧪 LLMChallenge Uses two Large Language Models to ensure trustworthy output. You either get the right response or no response at all. Docs
SinglePass Extraction Reduces LLM token usage by up to 8x, dramatically cutting costs. Docs
📉 SummarizedExtraction Reduces LLM token usage by up to 6x, saving costs while keeping accuracy. Docs
👀 Human-In-The-Loop Side-by-side comparison of extracted value and source document, with highlighting for human review and tweaking. Docs
🔐 SSO Support Enterprise-ready authentication options for seamless onboarding and off-boarding. Docs

Quick Start Guide

Unstract comes well documented. You can get introduced to the basics of Unstract, and learn how to connect various systems like LLMs, Vector Databases, Embedding Models and Text Extractors to it. The easiest way to wet your feet is to go through our Quick Start Guide where you actually get to do some prompt engineering in Prompt Studio and launch an API to structure varied credit card statements!

🚀 Getting started (self-hosted)

System Requirements

  • 8GB RAM (minimum)

Prerequisites

  • Linux or MacOS (Intel or M-series)
  • Docker
  • Docker Compose (if you need to install it separately)
  • Git

Next, either download a release or clone this repo and do the following:

./run-platform.sh
Now visit http://frontend.unstract.localhost in your browser
Use username and password unstract to login

That's all there is to it!

Follow these steps to change the default username and password. See user guide for more details on managing the platform.

Another really quick way to experience Unstract is by signing up for our hosted version. It comes with a 14 day free trial!

📄 Supported File Types

Unstract supports a wide range of file formats for document processing:

Category Format Description
Word Processing DOCX Microsoft Word Open XML
DOC Microsoft Word
ODT OpenDocument Text
Presentation PPTX Microsoft PowerPoint Open XML
PPT Microsoft PowerPoint
ODP OpenDocument Presentation
Spreadsheet XLSX Microsoft Excel Open XML
XLS Microsoft Excel
ODS OpenDocument Spreadsheet
Document & Text PDF Portable Document Format
TXT Plain Text
CSV Comma-Separated Values
JSON JavaScript Object Notation
Image BMP Bitmap Image
GIF Graphics Interchange Format
JPEG Joint Photographic Experts Group
JPG Joint Photographic Experts Group
PNG Portable Network Graphics
TIF Tagged Image File Format
TIFF Tagged Image File Format
WEBP Web Picture Format

🤝 Ecosystem support

LLM Providers

Provider Status
OpenAI Working
Google VertexAI, Gemini Pro Working
Azure OpenAI Working
Anthropic Working
Ollama Working
Bedrock Working
Google PaLM Working
Anyscale Working
Mistral AI Working

Vector Databases

Provider Status
Qdrant Working
Weaviate Working
Pinecone Working
PostgreSQL Working
Milvus Working

Embeddings

Provider Status
OpenAI Working
Azure OpenAI Working
Google PaLM Working
Ollama Working
VertexAI Working
Bedrock Working

Text Extractors

Provider Status
Unstract LLMWhisperer V2 Working
Unstructured.io Community Working
Unstructured.io Enterprise Working
LlamaIndex Parse Working

ETL Sources

Provider Status
AWS S3 Working
MinIO Working
Google Cloud Storage Working
Azure Cloud Storage Working
Google Drive Working
Dropbox Working
SFTP Working

ETL Destinations

Provider Status
Snowflake Working
Amazon Redshift Working
Google BigQuery Working
PostgreSQL Working
MySQL Working
MariaDB Working
Microsoft SQL Server Working
Oracle Working

🙌 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for further details to get started easily.

👋 Join the LLM-powered automation community

🚨 Backup encryption key

Do copy the value of ENCRYPTION_KEY config in either backend/.env or platform-service/.env file to a secure location.

Adapter credentials are encrypted by the platform using this key. Its loss or change will make all existing adapters inaccessible!

📊 A note on analytics

In full disclosure, Unstract integrates Posthog to track usage analytics. As you can inspect the relevant code here, we collect the minimum possible metrics. Posthog can be disabled if desired by setting REACT_APP_ENABLE_POSTHOG to false in the frontend's .env file.

Description
No description provided
Readme 32 MiB
Languages
Python 81.3%
JavaScript 15.5%
Shell 1.4%
CSS 1.3%
Dockerfile 0.4%