Official Python SDK for the EigenPal API
Project description
EigenPal Python SDK
Official Python SDK for the EigenPal API.
pip install eigenpal
import os
from pathlib import Path
from eigenpal import Eigenpal
client = Eigenpal(api_key=os.environ["EIGENPAL_API_KEY"])
# Pass a Path / file handle / { content, filename, mime_type }. The SDK
# uploads the request as multipart/form-data, no base64 needed.
result = client.executions.run_and_wait(
"extract-invoice",
input={"contract_document": Path("contract.pdf")},
)
print(result["status"], result["result"])
Authentication
Generate an API key from the dashboard under Settings → API Keys, then pass it explicitly:
client = Eigenpal(api_key=os.environ["EIGENPAL_API_KEY"])
The api_key argument always wins. If you omit it, the SDK falls back to EIGENPAL_API_KEY for convenience, handy in scripts where you'd be writing exactly the line above.
Self-hosted
Point the SDK at your own deployment via base_url:
client = Eigenpal(
api_key=os.environ["EIGENPAL_API_KEY"],
base_url=os.environ.get("EIGENPAL_BASE_URL", "https://eigenpal.acme.internal"),
)
base_url likewise wins over the EIGENPAL_BASE_URL env fallback. Defaults to https://app.eigenpal.com (the hosted cloud).
Triggering workflows
client.workflows.run(workflow_id, input=None, **options) enqueues a workflow execution.
from pathlib import Path
# Async: returns immediately with { execution_id }.
result = client.workflows.run(
"extract-invoice",
input={"contract_document": Path("contract.pdf")},
)
print(result.execution_id)
# Sync: server holds the connection up to 60 seconds.
result = client.workflows.run(
"extract-invoice",
input={"contract_document": Path("contract.pdf")},
wait_for_completion=60,
)
print(result.status, result.result)
# Long-running: client-side polling (default 5min cap).
final = client.executions.run_and_wait(
"extract-invoice",
input={"contract_document": Path("contract.pdf")},
)
print(final["status"])
The input argument is the workflow input map keyed by input name (as declared in the workflow). Omit it for inputs-less workflows. Other keyword args: version, overrides, wait_for_completion.
File inputs
Pass a pathlib.Path, an open file handle, or an explicit {"content": bytes, "filename": str, "mime_type": str} descriptor. The SDK auto-detects files and uploads as multipart/form-data (the same shape as curl -F):
from pathlib import Path
# Path: filename + mime type inferred.
client.workflows.run("extract-invoice", input={
"contract_document": Path("contract.pdf"),
})
# File handle: filename inferred from .name.
with open("contract.pdf", "rb") as f:
client.workflows.run("extract-invoice", input={"contract_document": f})
# Explicit dict: required for raw bytes.
client.workflows.run("extract-invoice", input={
"contract_document": {
"content": data,
"filename": "contract.pdf",
"mime_type": "application/pdf",
},
})
Don't base64-encode files yourself. The SDK is multipart-first; base64 doubles the payload size and skips the optimised upload path.
Execution polling
status = client.executions.get(execution_id)
# ExecutionStatusResponse(execution_id=..., status=..., result=..., ...)
executions = client.executions.list(
workflow_id="extract-invoice",
status="failed",
from_date="now()-7d",
limit=50,
)
client.executions.cancel(execution_id)
Workflows
client.workflows.list(search="invoice", limit=20)
client.workflows.get("extract-invoice")
client.workflows.versions("extract-invoice")
Errors
Every non-2xx response raises a typed subclass of EigenpalError:
| HTTP | Class | Notes |
|---|---|---|
| 400 | EigenpalValidationError |
.issues carries the per-field problems |
| 401 | EigenpalAuthError |
Bad / missing API key |
| 403 | EigenpalForbiddenError |
API trigger disabled, scope mismatch |
| 404 | EigenpalNotFoundError |
Workflow / execution doesn't exist |
| 429 | EigenpalRateLimitError |
.retry_after is the server-suggested wait (seconds) |
| 5xx | EigenpalServerError |
|
| timeout | EigenpalTimeoutError |
from eigenpal import Eigenpal, EigenpalValidationError
try:
client.workflows.run("extract-invoice")
except EigenpalValidationError as e:
for issue in e.issues:
print(f"{issue['field']}: {issue['message']}")
raise
Configuration
client = Eigenpal(
api_key="eg_…", # or EIGENPAL_API_KEY
base_url="https://app.eigenpal.com", # or EIGENPAL_BASE_URL
timeout_seconds=60.0, # per-request timeout
verify_ssl=True,
)
Use as a context manager to ensure the underlying HTTP connection pool is closed:
with Eigenpal() as client:
client.workflows.run("extract-invoice")
License
Apache-2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file eigenpal-0.4.10.tar.gz.
File metadata
- Download URL: eigenpal-0.4.10.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6e5ab7f3d39cfb7e9a30ffbb02ba1e5cfbf40ab772d0f99f464f2d1b85eb685
|
|
| MD5 |
3f703298598a65e03e412991d1bda722
|
|
| BLAKE2b-256 |
bdea900af1df50f9b7d95ca58eae496a07ddc897bc7389d1b7463f1d40138fee
|
Provenance
The following attestation bundles were made for eigenpal-0.4.10.tar.gz:
Publisher:
release.yml on eigenpal/eigenpal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eigenpal-0.4.10.tar.gz -
Subject digest:
d6e5ab7f3d39cfb7e9a30ffbb02ba1e5cfbf40ab772d0f99f464f2d1b85eb685 - Sigstore transparency entry: 1476842446
- Sigstore integration time:
-
Permalink:
eigenpal/eigenpal@4137eb8be55f6de7a58404c991c7b0eae152e706 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/eigenpal
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4137eb8be55f6de7a58404c991c7b0eae152e706 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file eigenpal-0.4.10-py3-none-any.whl.
File metadata
- Download URL: eigenpal-0.4.10-py3-none-any.whl
- Upload date:
- Size: 51.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3553e05274c2c6f1411c86a7143352f0d815f7321cf11493d7aa2c687c84a0b5
|
|
| MD5 |
d0c8d9c2842868ca2a51f09367d4b2c2
|
|
| BLAKE2b-256 |
0c270f380f188aa76f5c10297d673cd492f132589eb905b96d20bc9d45a0d495
|
Provenance
The following attestation bundles were made for eigenpal-0.4.10-py3-none-any.whl:
Publisher:
release.yml on eigenpal/eigenpal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
eigenpal-0.4.10-py3-none-any.whl -
Subject digest:
3553e05274c2c6f1411c86a7143352f0d815f7321cf11493d7aa2c687c84a0b5 - Sigstore transparency entry: 1476842656
- Sigstore integration time:
-
Permalink:
eigenpal/eigenpal@4137eb8be55f6de7a58404c991c7b0eae152e706 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/eigenpal
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4137eb8be55f6de7a58404c991c7b0eae152e706 -
Trigger Event:
workflow_dispatch
-
Statement type: