Duale AI Python SDK
Use dualeai to submit Tasks, validate results, and expose Python functions as Tools.
Duale AI runs the Tasks; your async Python application runs its registered Tools.
Status: Public preview. Interfaces can change before a stable release.
Install
Use CPython 3.10 through 3.14 on Linux or macOS:
python -m pip install dualeai
Run the first live Task
Ask your administrator for an API token and access to a configured model; the SDK creates neither. Use synthetic, non-sensitive input: live requests can consume metered or limited service resources. Set your provisioned token in the current shell:
export DUALEAI_TOKEN=dualeai_your_provisioned_token_here
Save this as quickstart.py:
import asyncio
from pydantic import BaseModel
from dualeai import ask, create_sdk
class SupportDecision(BaseModel):
next_action: str
reason: str
async def main() -> None:
async with create_sdk() as sdk:
response = await ask(
instruction="Review this synthetic support case and return the next safe action.",
res=SupportDecision,
sdk=sdk,
)
print(response.task_id)
decision = await response.model()
print(decision.next_action)
asyncio.run(main())
Run python quickstart.py. A successful run prints the Task ID, then the validated next_action; values depend on the model.
ask() returns a response handle. await response.model() waits for the final Task result and validates it against
SupportDecision.
Before retrying a failure, use Errors and reliability to identify its cause.
Configuration
DUALEAI_TOKEN is required for live requests. Set the other values only when your workflow needs them:
| Setting | When to use it |
|---|---|
DUALEAI_ENDPOINT |
A different API environment; the default is https://api.beta.duale.ai |
DUALEAI_AGENT_ID |
Hosting Tools or uploading Task attachments |
DUALEAI_TENANT_ID |
Managing Libraries or uploading Task attachments |
DUALEAI_OBSERVABILITY__TOKEN |
Exporting telemetry, with a separate telemetry token |
Attachment uploads also accept agent_id= in place of DUALEAI_AGENT_ID.
dualeai[telemetry] adds automatic instrumentation; configuration is still required to enable it.
See the configuration example for all settings.
Examples and next steps
The examples guide lists setup and permissions. Arrange Dashboard cleanup before running document examples: they leave stored Libraries.
For application tests without a live connection, use the MockSDK reference.
Integrate into an application
- Results: streamed text is a live view of the answer and can arrive out of order. Order it by
generationandsequenceas the examples guide shows, and useawait response.model()for the validated result. - Stopping: cancelling
response.taskstops local observation. Useawait response.stop(reason)to request a Platform Stop. The response confirms acceptance of the Stop request, not that the Task has stopped. A Stop without the permission is refused at once withDualeAIAuthError. A permitted Stop is accepted even when the Task has already ended or the Platform does not know it. Keepresponse.task_idfor diagnosis; the SDK cannot reattach to a Task using only its saved ID. - Tools: calls execute on Task streams opened by the same SDK instance that registered the functions. Protect
side effects with durable duplicate detection and redact exception text with
error_transform. The inventory example demonstrates redaction and explains where your application must record side effects durably. - Logging and telemetry: SDK initialization replaces the process's root logging handlers; cleanup does not restore them. Optional telemetry instrumentation also acts across the process. Coordinate these settings with your host application.
Project links
- SDK documentation
- Release notes
- Issues
- Contributing
- Security policy — report suspected vulnerabilities through the private routes there, not through a public issue
- Apache-2.0 license
Metadata
Release files for dualeai 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dualeai-0.2.0.tar.gz | 145.3 kB | With provenance | Details for dualeai-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dualeai-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for dualeai-0.2.0-py3-none-any.whl |
Total release size: 315.9 kB
Release files / dualeai-0.2.0.tar.gz
| Download URL | dualeai-0.2.0.tar.gz |
|---|---|
| Size | 145.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2030bb44cb4d179c61a87cf42ff2e6019a483d5af92a894c673116c99097466
|
|
BLAKE2b-256 checksum How to use checksums |
39fe42095d2e0cecee13ec0667d668533dc98883f1ce630b5baf488d5c9d9b86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logRelease files / dualeai-0.2.0-py3-none-any.whl
| Download URL | dualeai-0.2.0-py3-none-any.whl |
|---|---|
| Size | 170.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1cd8fd3a533093ba198b788ede10a1b9cf26d1f541910573d5ec1c465956b980
|
|
BLAKE2b-256 checksum How to use checksums |
bfe172beb93f722090cbac6ec38a055b878bdc02fc11ba1769522362ab8260c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logSecurity for dualeai 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for dualeai-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.