Minimal, domain-agnostic DAG scheduler/executor for step-based workflows.
Project description
py-agent-lib
Minimal, domain-agnostic DAG scheduler/executor for step-based workflows. It runs a plan of steps with dependencies, supports cancellation and event streaming, and stays decoupled from any specific domain (LLM, agent, etc.).
Install
pip install py-agent-lib
# or
uv add py-agent-lib
5-minute example
import asyncio
from py_agent_lib import DagExecutor, PlanBuilder, StepStatus, StepResult
builder = PlanBuilder()
builder.add_step(id="pick-files", action="pick")
builder.add_step(id="edit-files", action="edit", deps=["pick-files"])
plan = builder.build()
async def pick(step, ctx):
return StepResult(step_id=step.id, status=StepStatus.COMPLETED, output=["a.py", "b.py"])
async def edit(step, ctx):
files = ctx.get_dependency_outputs()["pick-files"]
return StepResult(step_id=step.id, status=StepStatus.COMPLETED, output={"edited": len(files)})
handlers = {"pick": pick, "edit": edit}
async def main():
executor = DagExecutor(max_parallel_steps=4)
state = await executor.execute(plan, handlers)
print(state.steps["edit-files"].output)
asyncio.run(main())
Status
Alpha. Core API stable, adapters and examples in progress.
Design
- Validation everywhere: Pydantic v2 models at every boundary.
- Structured concurrency:
asyncio.TaskGroup+graphlib.TopologicalSorterinstead of a hand-rolled scheduler. - Retries:
tenacityfor the heavy lifting. - Adapters live outside the core: LLM clients (Pydantic AI, Instructor), observers (OpenTelemetry, NDJSON), persistence — all separate.
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 py_agent_lib-0.1.0.tar.gz.
File metadata
- Download URL: py_agent_lib-0.1.0.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2874ca914d4de98d69d659fc6bd32018078a4c033e762295251d19a1a2276ff4
|
|
| MD5 |
8456daf1880602305998a81c5f7b8133
|
|
| BLAKE2b-256 |
651ab1e6782c2804bd2d71e14adff2baae4c92ec362229d8d14edb6e245d1cb2
|
Provenance
The following attestation bundles were made for py_agent_lib-0.1.0.tar.gz:
Publisher:
publish-lib.yml on gaslit-ai/py-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_agent_lib-0.1.0.tar.gz -
Subject digest:
2874ca914d4de98d69d659fc6bd32018078a4c033e762295251d19a1a2276ff4 - Sigstore transparency entry: 1635416002
- Sigstore integration time:
-
Permalink:
gaslit-ai/py-agent@74aef7aa4916654ae7345a3a27e3fd6754f2c966 -
Branch / Tag:
refs/tags/lib-v0.1.0 - Owner: https://github.com/gaslit-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-lib.yml@74aef7aa4916654ae7345a3a27e3fd6754f2c966 -
Trigger Event:
push
-
Statement type:
File details
Details for the file py_agent_lib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: py_agent_lib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.1 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 |
8b721a80d2a83759c64605b3cdc7f3f736bc868265aec3ad05b08df57b68de1b
|
|
| MD5 |
6c8658f1381945a6a6028c210c53d94a
|
|
| BLAKE2b-256 |
51adbebcd27da5af92e0760f5d544da3e5a5f64788e257d8ffa6ab1c4835fcb8
|
Provenance
The following attestation bundles were made for py_agent_lib-0.1.0-py3-none-any.whl:
Publisher:
publish-lib.yml on gaslit-ai/py-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_agent_lib-0.1.0-py3-none-any.whl -
Subject digest:
8b721a80d2a83759c64605b3cdc7f3f736bc868265aec3ad05b08df57b68de1b - Sigstore transparency entry: 1635416006
- Sigstore integration time:
-
Permalink:
gaslit-ai/py-agent@74aef7aa4916654ae7345a3a27e3fd6754f2c966 -
Branch / Tag:
refs/tags/lib-v0.1.0 - Owner: https://github.com/gaslit-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-lib.yml@74aef7aa4916654ae7345a3a27e3fd6754f2c966 -
Trigger Event:
push
-
Statement type: