Metadata-Version: 2.4
Name: duanflow
Version: 0.1.0
Summary: DuanFlow Python SDK and CLI for cloud GPU/NPU tasks
Author: DuanFlow
License-Expression: LicenseRef-DuanFlow-Proprietary
Project-URL: Homepage, https://duanflow.zeabur.app
Project-URL: Documentation, https://duanflow.zeabur.app/docs.html
Project-URL: Examples, https://duanflow.zeabur.app/examples.html
Keywords: duanflow,gpu,npu,cloud,sdk,agent,machine-learning
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28.0
Dynamic: license-file

# DuanFlow

DuanFlow is a Python SDK and CLI for submitting Python functions and existing repository commands to DuanFlow cloud GPU/NPU compute.

It is designed for developers and coding agents that need GPU/NPU acceleration, isolated execution, long-running jobs, structured logs, and artifacts.

## Install

```bash
pip install duanflow
```

## Login

Use browser/link login. Do not paste passwords, API keys, or tokens into an agent chat.

```bash
duanflow auth login --api-base https://duanflow.zeabur.app
duanflow whoami
```

## Run a Cloud Function

```python
import subprocess
import duanflow as df

app = df.App("repo-eval")

@app.function(gpu="L40S", timeout=3600, artifacts=["reports/"])
def run_eval():
    subprocess.run(
        "pytest evals/ --json-report --json-report-file reports/eval.json",
        shell=True,
        check=True,
    )
    return {"report": "reports/eval.json"}

print(run_eval.remote(_duanflow_wait=True, _duanflow_stream_logs=True))
```

## Agent Usage

Agents should first decide whether a task can benefit from GPU/NPU or cloud execution. Good fits include model training, inference, evals, embeddings, reranking, image/audio/video processing, simulations, tensor-heavy workloads, and large data processing that can use CuPy, cuDF, RAPIDS, PyTorch, JAX, TensorFlow, torch-npu, or vendor NPU runtimes.

Before submitting a billable cloud job, agents should:

1. Explain the acceleration or isolation reason.
2. Run `duanflow whoami`.
3. Estimate runtime and cost.
4. Check balance or organization credit.
5. Ask for explicit confirmation.
6. Report job id, logs, cost, and artifacts after completion.

## Documentation

- Docs: https://duanflow.zeabur.app/docs.html
- Examples: https://duanflow.zeabur.app/examples.html
- Hosted agent skill: https://duanflow.zeabur.app/skills/duanflow-cloud-exec/SKILL.md
