blekline-client — Python wrapper for the Blekline REST API.
Use the Python SDK when your agent pipeline is Python-based — LangChain, custom orchestrators, data pipelines — and you need masking or tool enforcement outside the MCP stdio path.
Install from the monorepo:
pip install -e packages/client-python
Quick start
import os
from blekline_client import BleklineClient
client = BleklineClient(
workspace_token=os.environ["BLEKLINE_WORKSPACE_TOKEN"],
base_url="https://app.blekline.com",
client_surface="sdk",
)
masked = client.mask(text="Email alice@corp.com my SSN 123-45-6789", platform="Python")
print(masked["maskedText"], masked.get("decision"))
tool = client.enforce_tool_call(
tool_name="write_file",
arguments={"path": "/tmp/out.txt", "content": "sk-proj-abc123"},
)
print(tool["action"], tool["entitiesMasked"])
Methods
| Method | API |
|---|---|
mask(text=, platform=) | POST /api/mask |
emit_event(...) | POST /api/events |
enforce_tool_call(...) | POST /api/mcp/enforce-tool-call |
simulate_policy(...) | POST /api/policy/simulate |
Errors
Raises BleklineApiError with .status on HTTP failures.
See also: OpenAPI spec and TypeScript SDK.
Next steps: AI Enablement Stack · Quick start · Open workspace · Report issue