Skip to main content

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

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

py_agent_lib-0.1.0.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_agent_lib-0.1.0-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

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

Hashes for py_agent_lib-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2874ca914d4de98d69d659fc6bd32018078a4c033e762295251d19a1a2276ff4
MD5 8456daf1880602305998a81c5f7b8133
BLAKE2b-256 651ab1e6782c2804bd2d71e14adff2baae4c92ec362229d8d14edb6e245d1cb2

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for py_agent_lib-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b721a80d2a83759c64605b3cdc7f3f736bc868265aec3ad05b08df57b68de1b
MD5 6c8658f1381945a6a6028c210c53d94a
BLAKE2b-256 51adbebcd27da5af92e0760f5d544da3e5a5f64788e257d8ffa6ab1c4835fcb8

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page