semcod/flowguard
Autonomous bounded concurrent dispatch and flow governor for Heyasa and Planfile.
Overview
Just as Hostguard protects hardware from resource exhaustion (CPU, RAM, storage, runaway daemons), Flowguard protects the task pipeline from:
- Head-of-Line (HoL) Blocking: isolating deterministic failures (
*_DEPENDENCY_PIN_MISMATCH, rate limits) to allow independent branches to progress. - Serial Bottlenecks: executing independent task DAGs concurrently within dynamic host and API limits rather than sequentially.
- Resource Saturation: dynamically scaling worker slots using an Additive Increase / Multiplicative Decrease (AIMD) algorithm backed by host telemetry.
Architecture
FlowGovernor: Monitors/proc/loadavgand/proc/meminfoand throttles slot allocation when CPU or memory pressure rises.TaskDAG: Direct Acyclic Graph scheduler where upstream task failure only skips downstream dependents, leaving orthogonal branches unblocked.QuarantineManager: Fast-fails and segregates known failure signatures into quarantine receipts without stalling the run loop.FlowEngine: Asynchronous orchestration engine dispatching ready nodes across available slots.
Install
pip install semcod-flowguard # imports as `flowguard`
Quickstart
import asyncio
from flowguard import FlowEngine, TaskDAG, FlowGovernor
async def main():
dag = TaskDAG()
dag.add_task("task_a", lambda: asyncio.sleep(0.1))
dag.add_task("task_b", lambda: asyncio.sleep(0.1))
engine = FlowEngine()
receipts = await engine.execute_dag(dag)
for r in receipts:
print(f"{r.task_id}: {r.status}")
if __name__ == "__main__":
asyncio.run(main())
Resources, providers and blocking tasks
dag.add_task("edit", run_edit, resources={"writer:paxlet-com/heyasa/ticket-144": 1})
dag.add_task("ask", ask_llm, provider="llm:openrouter")
dag.add_task("willman", submit, resources={"engine:willman": 1}, blocking=True)
limits = ResourceLimits.from_mapping({
"max_concurrent_slots": 8,
"resource_capacity": {"engine:willman": 2},
})
writer:*resources are exclusive (capacity 1): one writer per worktree.- Other named resources are bounded by
resource_capacity; unnamed ones are unbounded. - A task raising
RateLimited(retry_after=..)(or a 429 message) backs off only its provider and is requeued up tomax_rate_limit_retries; other providers keep running. blocking=Trueruns a synchronous callable in a worker thread.resource_type="io"marks remote/I/O-bound work: it usesmax_io_slots, is not throttled by host CPU load, and still drops to the minimum when RAM is critical.- Flowguard schedules admitted work only; it grants no execution authority.
Testing
pytest -v tests/
Metadata
Release files for semcod-flowguard 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| semcod_flowguard-0.2.0.tar.gz | 16.8 kB | Without provenance | Details for semcod_flowguard-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| semcod_flowguard-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for semcod_flowguard-0.2.0-py3-none-any.whl |
Total release size: 31.7 kB
Release files / semcod_flowguard-0.2.0.tar.gz
| Download URL | semcod_flowguard-0.2.0.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5aabf293529e65a1b7871fb374d9e92fb9f45e3b1013871af69fd4c1fb1d633d
|
|
BLAKE2b-256 checksum How to use checksums |
bc290bd2f9eea447da087e5e093d91533ac8b21a39ebeb729a225074808a5abe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Release files / semcod_flowguard-0.2.0-py3-none-any.whl
| Download URL | semcod_flowguard-0.2.0-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5cec11d782892c4f5b03e03d1a5425d594b6e21f6d42bd575e0415bddbb9266
|
|
BLAKE2b-256 checksum How to use checksums |
0ba0c8c3dd8eda49dbc8042463a3bc766b5fd0a51a797dabfaa9140ce25fc8a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.12
|
Security for semcod-flowguard 0.2.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.