Skip to main content

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.TopologicalSorter instead of a hand-rolled scheduler.
  • Retries: tenacity for the heavy lifting.
  • Adapters live outside the core: LLM clients (Pydantic AI, Instructor), observers (OpenTelemetry, NDJSON), persistence — all separate.

Metadata

Release files for py-agent-lib 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-agent-lib 0.1.0
File Size Uploaded Provenance Actions
py_agent_lib-0.1.0.tar.gz 23.4 kB With provenance Details for py_agent_lib-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-agent-lib 0.1.0
File Interpreter ABI Platform Actions
py_agent_lib-0.1.0-py3-none-any.whl Python 3 none any Details for py_agent_lib-0.1.0-py3-none-any.whl

Total release size: 56.5 kB

Release files / py_agent_lib-0.1.0.tar.gz

Download URL py_agent_lib-0.1.0.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2874ca914d4de98d69d659fc6bd32018078a4c033e762295251d19a1a2276ff4
BLAKE2b-256 checksum
How to use checksums
651ab1e6782c2804bd2d71e14adff2baae4c92ec362229d8d14edb6e245d1cb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 26, 2026.

Transparency log

Release files / py_agent_lib-0.1.0-py3-none-any.whl

Download URL py_agent_lib-0.1.0-py3-none-any.whl
Size 33.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b721a80d2a83759c64605b3cdc7f3f736bc868265aec3ad05b08df57b68de1b
BLAKE2b-256 checksum
How to use checksums
51adbebcd27da5af92e0760f5d544da3e5a5f64788e257d8ffa6ab1c4835fcb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 26, 2026.

Transparency log

Security for py-agent-lib 0.1.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for py_agent_lib-0.1.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 May 26, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page