Python SDK
User Guide
Build with the Descrybe Legal Engine Python SDK
Use Python, the dle CLI, and per-user OAuth to connect apps and agents to Descrybe
This guide explains the Descrybe Legal Engine Python SDK for developers building apps, scripts, local agents, firm tools, and coding-assistant projects.
Overview
What the Python SDK is for
The Descrybe Legal Engine Python SDK is for developers building local research agents, firm tools, scripts, and AI workflows that need authenticated access to Descrybe Legal Engine.
It includes a Python client, a command-line tool, OAuth helpers, local token storage for single-user tools, refresh-token handling, a small MCP client, coding-agent instructions, and a browser-based example app.
Core rule
Each human user should connect their own Descrybe account through OAuth. Do not build a shared app by putting one person's Descrybe token behind every user.
Quick start for a local tool
- 1
Install the package
Install the SDK with pip install descrybe-legal-engine. For local development from the repository, follow the repository README.
- 2
Connect your Descrybe account
Run dle login. The CLI opens a browser OAuth flow, stores the local token profile, and returns to the terminal when login is complete.
- 3
Check the connection
Run dle doctor to inspect local SDK configuration without printing secrets, then run dle list-tools to confirm your connected account can reach Descrybe Legal Engine.
- 4
Call the SDK from Python
For a local single-user script, create a LegalEngine client from the local token store and call the legal research method or MCP tool your app needs.
- 5
Log out when testing is done
Run dle logout when you want to remove the local token profile from that machine.
Local scripts and web apps use different token shapes
Local single-user scripts
A local script can use the token profile created by dle login. That pattern is useful for one developer, one researcher, or a local coding-agent workflow running as that user.
Multi-user web apps
A shared app should resolve the current app user, load that user's Descrybe OAuth connection, and build a client for that user only. Store refresh tokens encrypted in your own database and associate them with the app user.
What not to do
Do not pass one global Descrybe token to the client for everyone in a firm or app. That blurs access, auditability, and subscription boundaries.
Using the SDK with a coding assistant
The SDK can generate an assistant-readable instruction file for projects that should use Descrybe Legal Engine safely.
- 1
Run dle init-agent-instructions
This writes DESCRYBE_LEGAL_ENGINE.md into the project.
- 2
Give the file to the coding assistant
The generated instructions explain local-script usage, multi-user web-app usage, public tool names, OAuth boundaries, and validation checks.
- 3
Validate with real connection checks
Use dle doctor and dle list-tools as non-secret checks before treating the integration as connected.
Browser-based example app
The SDK repository includes a compact browser-based example app under examples/simple-web-app. It demonstrates per-user Descrybe connection, server-side token storage, and a single search_cases_by_concept call.
The example is meant to show the OAuth and token-storage pattern. It is not intended to replace your app's real login system, permission model, or production security review.
Open the Python SDK repository on GitHub to read the current example-app instructions.
Troubleshooting
dle doctor says Connected: no
That profile has not completed dle login yet. Run dle login for the same profile and try again.
The terminal cannot open a browser
Use dle login --no-browser and paste the printed URL into a browser manually.
dle list-tools says authentication is required
Run dle login again for the same profile, then retry dle list-tools.
A shared app seems easier with one token
Do not solve login problems by sharing one Descrybe token. Prompt the current user to connect their own Descrybe account.