Skip to main content

motosan-agent-workflow (Python)

A general-purpose DAG-based agent workflow engine for orchestrating LLM agents.

PyPI License: MIT

Installation

pip install motosan-agent-workflow

# Optional YAML support:
pip install "motosan-agent-workflow[yaml]"

Quick Start

import asyncio
from motosan_agent_workflow import (
    Workflow, Node, Runtime, LlmClient, LlmResponse,
)


class MyLlm(LlmClient):
    async def call(self, system_prompt: str, input_data: dict, tools: list[str]) -> LlmResponse:
        return LlmResponse(content={"answer": "..."}, input_tokens=100, output_tokens=50)


async def main():
    workflow = (
        Workflow.builder("my-pipeline")
        .node(Node.agent("researcher", system_prompt="Find key facts about the topic."))
        .node(Node.agent("writer", system_prompt="Write a report.", input_from=["researcher"]))
        .edge("researcher", "writer")
        .build()
    )

    runtime = Runtime(MyLlm())
    result = await runtime.execute(workflow, {"topic": "Python in 2026"})
    print(result.node_output("writer").content)


asyncio.run(main())

YAML Workflow

from motosan_agent_workflow import load_workflow, load_workflow_from_str, Format

# From file
workflow = load_workflow("my-workflow.yaml")

# From string
workflow = load_workflow_from_str(yaml_str, Format.YAML)

Node Types

Type Description LLM
Node.agent() LLM-powered agent Yes
Node.human() Human-in-the-loop gate No
Node.transform() Pure function transform No
Node.condition() Conditional branching No
Node.loop_node() Iterative loop Depends
Node.sub_workflow() Nested sub-workflow Depends

Features

  • Parallel execution — Nodes in the same DAG layer run concurrently via asyncio.gather
  • Output schema validation — JSON Schema with auto self-correction
  • Retry policies — Per-node exponential backoff with Skip/Abort/Fallback modes
  • Human-in-the-loop — Gates with timeout and default action
  • Event streaming — WorkflowEvent via async callback
  • Token tracking — Per-node and total, with budget enforcement
  • Cost estimation — Pre-execution cost estimates with configurable pricing
  • YAML/JSON loader — load_workflow() and load_workflow_from_str()
  • 8 built-in templates — code-review, research, brainstorm, report, playlist, content, architecture-review, sprint-planning

Requirements

  • Python >= 3.10
  • Optional: pyyaml >= 6.0 for YAML support

Publishing

git tag python-v0.3.0
git push origin python-v0.3.0
# → triggers publish-python.yml → PyPI

Metadata

Release files for motosan-agent-workflow 0.3.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 motosan-agent-workflow 0.3.0
File Size Uploaded Provenance
motosan_agent_workflow-0.3.0.tar.gz 22.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for motosan-agent-workflow 0.3.0
File Interpreter ABI Platform
motosan_agent_workflow-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.5 kB

Release files / motosan_agent_workflow-0.3.0.tar.gz

Download URL motosan_agent_workflow-0.3.0.tar.gz
Size 22.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b4fdb824fc9faef4cf58d42d301e23c957b1c6debdf753db6511f537b18230db
BLAKE2b-256 checksum
How to use checksums
069870fd8d0bf746a32f799501422e9d047354e21d700851e7821af8389d2916
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / motosan_agent_workflow-0.3.0-py3-none-any.whl

Download URL motosan_agent_workflow-0.3.0-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
462fc6b50069f986aba81bc00d89d48abf80950ce34acf929de2f7ec5070de88
BLAKE2b-256 checksum
How to use checksums
3c2225840b047f2e6792d114c786cd2131f49e5c89bb30a4e65ab91ffc90e02a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for motosan-agent-workflow 0.3.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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