Tiny Python client for the Dari workflow automation API
Project description
dari-python
dari-python is a tiny, well-typed wrapper around the Dari workflow automation API. It exposes the handful of public endpoints documented in docs/ (start workflows, list executions, resume paused runs, manage credentials, and kick off single computer-use actions) through a single Dari client.
Features
- Minimal dependency footprint (just
requests) - Friendly
Dariclient that stores your API key and handles headers/JSON boilerplate - Helpers for workflow lifecycle methods: start, list executions, inspect execution details
- Convenience methods for credential metadata, OAuth accounts, webhooks, and single-action runs
- Context-manager support plus consistent error handling via
DariError
Installation
pip install dari-python
Quickstart
from dari import Dari
client = Dari(api_key="YOUR_API_KEY")
# 1. Start a workflow
start = client.start_workflow(
workflow_id="23a45a3f-c58c-492a-8e81-0fe6b3704ad2",
input_variables={"primary_email": "avyay@mupt.ai"},
)
print("Execution ID:", start["workflow_execution_id"])
# 2. List executions for the workflow
executions = client.list_workflow_executions("23a45a3f-c58c-492a-8e81-0fe6b3704ad2")
print("Total executions:", len(executions["executions"]))
# 3. Poll execution details
execution = client.get_execution_details(
workflow_id="23a45a3f-c58c-492a-8e81-0fe6b3704ad2",
execution_id=start["workflow_execution_id"],
)
print("Execution status:", execution["status"])
# 4. Resume a paused workflow inside your webhook handler
# resume_payload = client.resume_workflow(resume_url, {"user_response": "approved"})
# 5. Manage credentials
credential = client.create_credential(
service_name="Gmail",
username_or_email="user@example.com",
password="mypassword",
totp_secret="JBSWY3DPEHPK3PXP",
)
print("Created credential:", credential["id"])
# 6. Manage phone numbers for SMS 2FA
phone_number = client.purchase_phone_number(label="Support Line")
print("Purchased phone:", phone_number["phone_e164"])
phone_numbers = client.list_phone_numbers()
print(f"Total phone numbers: {len(phone_numbers)}")
# 7. Session management - create and reuse sessions
session = client.create_session(
screen_config={"width": 1280, "height": 720},
ttl=3600, # 1 hour
metadata={"purpose": "workflow automation"}
)
print("Session ID:", session["session_id"])
# Run multiple actions on the same session
result1 = client.run_single_action(
action="Navigate to login page",
session_id=session["session_id"],
id="nav-to-login",
variables={"meeting_title": "Internal sync"},
)
result2 = client.run_single_action(
action="Fill in username and password",
session_id=session["session_id"],
id="fill-credentials"
)
print("Action result:", result2["result"])
# List all active sessions
sessions = client.list_sessions(status_filter="active", limit=50)
print(f"Active sessions: {sessions['total']}")
# Terminate session when done
client.terminate_session(session["session_id"])
# Or bring your own browser
external_session = client.create_session(
cdp_url="ws://localhost:9222/devtools/page/123",
ttl=1800
)
API Coverage
Each method maps one-to-one with the docs under docs/api-reference/endpoint/:
| Client method | HTTP call |
|---|---|
start_workflow(workflow_id, input_variables) |
POST /workflows/start/{workflow_id} |
list_workflow_executions(workflow_id) |
GET /public/workflows/{workflow_id} |
get_execution_details(workflow_id, execution_id) |
GET /public/workflows/{workflow_id}/executions/{execution_id} |
resume_workflow(resume_url, variables) |
POST {resume_workflow_url} |
list_credentials() |
GET /credentials |
create_credential(**kwargs) |
POST /credentials |
list_connected_accounts() |
GET /connected-accounts |
list_phone_numbers() |
GET /phone-numbers |
purchase_phone_number(label) |
POST /phone-numbers |
run_single_action(**kwargs) |
POST /run-action |
create_session(**kwargs) |
POST /sessions |
get_session(session_id) |
GET /sessions/{session_id} |
list_sessions(**kwargs) |
GET /sessions |
terminate_session(session_id) |
POST /sessions/{session_id}/terminate |
delete_session(session_id) |
DELETE /sessions/{session_id} |
Error handling
- Network or HTTP failures raise
dari.DariError DariError.status_codeexposes the HTTP code when available- The raw
requests.Responseobject is attached toDariError.responsefor advanced debugging
Development
Standard Python packaging layout is used (src/ tree + pyproject.toml). A simple sanity check before publishing:
pip install -e .
python -m compileall src/dari
Contributions are welcome via pull request.
Project details
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 dari_python-0.1.7.tar.gz.
File metadata
- Download URL: dari_python-0.1.7.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
321f91e8d258a467a27c87a7c898e5af1476469775888b43c3da9b4e19850063
|
|
| MD5 |
679d1fd2c945ca6d1e873c28a34dace8
|
|
| BLAKE2b-256 |
60b9882b4f1b246a1b5db0d252bd974166afc553fdec8ac8bfa07674f9a40576
|
Provenance
The following attestation bundles were made for dari_python-0.1.7.tar.gz:
Publisher:
publish.yml on mupt-ai/dari-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dari_python-0.1.7.tar.gz -
Subject digest:
321f91e8d258a467a27c87a7c898e5af1476469775888b43c3da9b4e19850063 - Sigstore transparency entry: 732203129
- Sigstore integration time:
-
Permalink:
mupt-ai/dari-python@a20f0ecc8e84a8f04fa4131237dbd8b6a9d4fd9c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mupt-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a20f0ecc8e84a8f04fa4131237dbd8b6a9d4fd9c -
Trigger Event:
push
-
Statement type:
File details
Details for the file dari_python-0.1.7-py3-none-any.whl.
File metadata
- Download URL: dari_python-0.1.7-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a35ad356d3a104a2244b7597166d3a847a1421cf3b17a56313dc0ff2488767e
|
|
| MD5 |
390baf2f7b3066fa072c6529bdd37665
|
|
| BLAKE2b-256 |
f2616950db2c069dddeae62819f2da7088c74e61765c965ffff3ba0c50daf7cc
|
Provenance
The following attestation bundles were made for dari_python-0.1.7-py3-none-any.whl:
Publisher:
publish.yml on mupt-ai/dari-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dari_python-0.1.7-py3-none-any.whl -
Subject digest:
5a35ad356d3a104a2244b7597166d3a847a1421cf3b17a56313dc0ff2488767e - Sigstore transparency entry: 732203130
- Sigstore integration time:
-
Permalink:
mupt-ai/dari-python@a20f0ecc8e84a8f04fa4131237dbd8b6a9d4fd9c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mupt-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a20f0ecc8e84a8f04fa4131237dbd8b6a9d4fd9c -
Trigger Event:
push
-
Statement type: