hush-icore
Core workflow engine for Hush — async DAG execution with built-in tracing and type-safe state management.
Installation
pip install hush-icore
Quick Start
import asyncio
from hush.core import Hush, GraphOp, op, START, END, PARENT
@op
def double(x: int):
return {"result": x * 2}
async def main():
with GraphOp(name="workflow") as graph:
step = double(x=PARENT["x"])
START >> step >> END
result = await Hush(graph).run(inputs={"x": 5})
print(result["result"]) # 10
asyncio.run(main())
Key Concepts
Ops
@op— Turn any function into a workflow nodeGraphOp— Container for nested workflowsBranchOp— Conditional routing (if_(...).else_(...))@graph— Reusable workflow factory with auto-naming
@graph — Reusable Workflow Factory
from hush.core import graph, op, START, END, PARENT, GraphOp, Hush
# fetch
# / \
# summarize translate (parallel)
# \ /
# merge_results
@op
def fetch(url: str):
return {"data": f"content from {url}"}
@op
def summarize(text: str):
return {"summary": text[:50] + "..."}
@op
def translate(text: str):
return {"translated": f"[VI] {text}"}
@op
def merge_results(summary: str, translated: str):
return {"report": f"{summary}\n{translated}"}
@graph
def process_url(url):
f = fetch(url=url)
s = summarize(text=f["data"])
t = translate(text=f["data"])
m = merge_results(summary=s["summary"], translated=t["translated"])
START >> f >> [s, t] >> m >> END
@op
def publish(report: str):
return {"status": f"published: {report[:30]}..."}
# Use in a parent graph — auto-named from variable
async def main():
with GraphOp(name="pipeline") as pipeline:
p = process_url(url=PARENT["url"])
pub = publish(report=p["report"])
START >> p >> pub >> END
result = await Hush(pipeline).run(inputs={"url": "https://example.com"})
print(result["status"])
Flow Control
# Sequential
START >> a >> b >> c >> END
# Parallel (fork + join)
START >> [a, b, c] >> merge >> END
# Generator (streaming iteration)
@op
def each_item(items: list):
for item in items:
yield {"value": item}
# Loop (feedback loop with condition)
with GraphOp.loop(until="count >= 5") as loop:
inc = increment(counter=PARENT["count"])
inc["counter"] >> PARENT["count"]
START >> inc >> END
State References
# PARENT["key"] — external inputs from engine.run()
step = double(x=PARENT["input"])
# op["key"] — output from sibling op
upper = to_upper(text=greet["greeting"])
# Output mapping
step["result"] >> PARENT["answer"]
Tracing
from hush.core.tracing import LocalTracer
engine = Hush(graph, tracer=LocalTracer(tags=["dev"]))
result = await engine.run(inputs={...})
# Traces written to ~/.hush/traces/{request_id}.json
For external backends (Langfuse, OpenTelemetry), see hush-telemetry.
Rust Backend
hush-icore has a companion Rust crate for high-performance execution (~8x faster on pure-compute). Use via hush-serve:
engine = Hush(graph)
engine.serve(port=8000, backend="rust")
Related Packages
| Package | Description |
|---|---|
| hush-providers | LLM, embedding, reranking integrations |
| hush-telemetry | Langfuse, OpenTelemetry tracing |
| hush-serve | HTTP API server (Python + Rust backends) |
License
Apache 2.0
Metadata
Release files for hush-icore 0.5.5
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 |
|---|---|---|---|---|
| hush_icore-0.5.5.tar.gz | 112.1 kB | Without provenance | Details for hush_icore-0.5.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hush_icore-0.5.5-py3-none-any.whl | Python 3 | none | any | Details for hush_icore-0.5.5-py3-none-any.whl |
Total release size: 253.7 kB
Release files / hush_icore-0.5.5.tar.gz
| Download URL | hush_icore-0.5.5.tar.gz |
|---|---|
| Size | 112.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f498e0508b436852eca67b9a34cee2cfb4a345ea49c67042ed87519e07ab04b0
|
|
BLAKE2b-256 checksum How to use checksums |
c3af26d5409df86ce69f28c18a1666b1d01b5fb2b965669bf573d7a5fe964e52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / hush_icore-0.5.5-py3-none-any.whl
| Download URL | hush_icore-0.5.5-py3-none-any.whl |
|---|---|
| Size | 141.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0fd5d00c5dfc9125fe486d9ff837e42b05dfdd2eea4acb1faa346a2921d3eec0
|
|
BLAKE2b-256 checksum How to use checksums |
efe3edec3e2a43bdece88e330cc3edbd152515e969ec8fc5ae5c364ab88afdfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for hush-icore 0.5.5
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.