PenguiFlow
A Python-native runtime for typed, steerable, bounded AI agents — and the deterministic pipelines under them.
PenguiFlow runs async node graphs where every hop validates its data, every run stays inside a budget, and the same core powers both a deterministic data pipeline and a tool-using agent. It is asyncio-only and built on Pydantic v2, with no heavy runtime dependencies.
Why PenguiFlow
Many agent and pipeline frameworks are loosely-typed loops: a node returns the wrong shape and you find out several hops later, a planner runs past its budget with no ceiling, a crash loses the run's state, and approving a risky step means not automating it. PenguiFlow treats those as the framework's responsibility, not yours:
- Typed at every boundary. Each node validates its input and output against Pydantic models, so malformed data is caught at its source instead of downstream.
- Bounded by design. Bounded queues apply real backpressure; per-trace deadlines, hop budgets, and cancellation keep loops and fan-outs from running away.
- Steerable mid-run. Pause for human approval (HITL), inject steering events, and resume — without losing the trajectory so far.
- Durable and observable. An optional
StateStorepersists events for audit and recovery; every run carries atrace_id, can stream partial output, and records its trajectory. - One runtime for agents and pipelines. The
ReactPlanner(JSON-first tool orchestration, parallel fan-out and joins, pause/resume) runs on the exact same typed, bounded core as a plain data flow.
Architecture at a glance
┌─────────────────────────────────────────────────────────────┐
│ Agents ReactPlanner · ToolNode (MCP / UTCP / HTTP) │
│ JSON tool loop · HITL pause/resume · fan-out/join│
├─────────────────────────────────────────────────────────────┤
│ Flow async node graph · bounded queues (backpressure)│
│ runtime routers · subflows · streaming │
├─────────────────────────────────────────────────────────────┤
│ Envelope Message: trace_id · deadline · hop budget · meta │
│ Reliability per-node retries / timeouts · per-trace cancel │
├─────────────────────────────────────────────────────────────┤
│ Ops StateStore (durable events) · metrics / hooks │
└─────────────────────────────────────────────────────────────┘
emit() ──► typed in/out validated at every node ──► fetch()
Concepts at a glance
- Flow: a directed graph (runtime) you
run(),emit()into, andfetch()results from. - Node: an async function plus a
NodePolicy(validation, retries, timeout). - Message (recommended for production):
Message(payload=..., headers=Headers(tenant=...), trace_id=...)enabling trace correlation, cancellation, deadlines, and streaming. - ReactPlanner (agents): a JSON-first planning loop over your tools, with pause/resume, parallel calls, and trajectory logging.
- StateStore (optional): durability, audit, and event persistence for distributed, ops-ready deployments.
Install
Requirements: Python 3.11+
pip install penguiflow
Common extras:
pip install "penguiflow[planner]" # ReactPlanner + ToolNode integrations
pip install "penguiflow[llm]" # native LLM provider SDKs
pip install "penguiflow[a2a-server]" # A2A HTTP+JSON server bindings
pip install "penguiflow[a2a-client]" # A2A client bindings
If you use uv:
uv pip install penguiflow
Quickstart
PenguiFlow has two entry points that share the same runtime: a typed pipeline you wire yourself, and an agent scaffolded from a template.
1) Typed pipeline (runtime)
from __future__ import annotations
import asyncio
from pydantic import BaseModel
from penguiflow import ModelRegistry, Node, NodePolicy, create
class In(BaseModel):
text: str
class Out(BaseModel):
upper: str
async def to_upper(msg: In, _ctx) -> Out:
return Out(upper=msg.text.upper())
async def main() -> None:
node = Node(to_upper, name="to_upper", policy=NodePolicy(validate="both"))
registry = ModelRegistry()
registry.register("to_upper", In, Out)
flow = create(node.to())
flow.run(registry=registry)
await flow.emit(In(text="hello"))
result: Out = await flow.fetch()
await flow.stop()
print(result.upper)
if __name__ == "__main__":
asyncio.run(main())
2) Agent (ReactPlanner via CLI — fastest path)
uv run penguiflow new my-agent --template react
cd my-agent
uv sync
uv run penguiflow dev --project-root .
Documentation
- Docs site (MkDocs): https://hurtener.github.io/penguiflow/
- API reference (every public symbol): https://hurtener.github.io/penguiflow/reference/api/
- Source docs in repo: docs/
Suggested starting points (in-repo sources):
- Getting started: docs/getting-started/quickstart.md
- Core runtime: docs/core/flows-and-nodes.md, docs/core/messages-and-envelopes.md
- Planner: docs/planner/overview.md
- Tool integrations: docs/tools/configuration.md
- Deployment runbooks: docs/deployment/production-deployment.md
- Observability runbooks: docs/observability/metrics-and-alerts.md
- CLI: docs/cli/overview.md
Stability, versioning, and public API
PenguiFlow is on the 3.x line and follows SemVer with a documented public API surface — additions are additive, and breaking changes are called out in the changelog.
- Changelog: CHANGELOG.md
- Versioning & deprecations: VERSIONING.md
- Public API surface: docs/reference/public-api.md
Contributing, security, and support
- Contributing: CONTRIBUTING.md
- Code of Conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
- Support: SUPPORT.md
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file penguiflow-3.11.1.tar.gz.
File metadata
- Download URL: penguiflow-3.11.1.tar.gz
- Upload date:
- Size: 4.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4643f30f5f1d0a8e8ca00f6dc1fc7bdd0f00688e7183bd5f41004caf362f998b
|
|
| MD5 |
092df72bc326584d713ab738d6beb4c7
|
|
| BLAKE2b-256 |
84a2643f83ad0c5f8c605bd412fdedd8aaccf7eb01a67e0aa5b54f02b99ff21f
|
Provenance
The following attestation bundles were made for penguiflow-3.11.1.tar.gz:
Publisher:
ci.yml on hurtener/penguiflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
penguiflow-3.11.1.tar.gz -
Subject digest:
4643f30f5f1d0a8e8ca00f6dc1fc7bdd0f00688e7183bd5f41004caf362f998b - Sigstore transparency entry: 2124253916
- Sigstore integration time:
-
Permalink:
hurtener/penguiflow@7493e49909160fa14a33470a8f115364a20c7bec -
Branch / Tag:
refs/heads/main - Owner: https://github.com/hurtener
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7493e49909160fa14a33470a8f115364a20c7bec -
Trigger Event:
push
-
Statement type:
File details
Details for the file penguiflow-3.11.1-py3-none-any.whl.
File metadata
- Download URL: penguiflow-3.11.1-py3-none-any.whl
- Upload date:
- Size: 4.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03317c68b308ad8e5cc7520128d96a89816f65cc6e4f0f984a1723eb2463e06a
|
|
| MD5 |
9381701beb3a5fd4a490225ddf37a8d2
|
|
| BLAKE2b-256 |
88b32033bacac74c7a6f1578dbc6b73b64b337663fa2cea0f7c47b221fd1f081
|
Provenance
The following attestation bundles were made for penguiflow-3.11.1-py3-none-any.whl:
Publisher:
ci.yml on hurtener/penguiflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
penguiflow-3.11.1-py3-none-any.whl -
Subject digest:
03317c68b308ad8e5cc7520128d96a89816f65cc6e4f0f984a1723eb2463e06a - Sigstore transparency entry: 2124253952
- Sigstore integration time:
-
Permalink:
hurtener/penguiflow@7493e49909160fa14a33470a8f115364a20c7bec -
Branch / Tag:
refs/heads/main - Owner: https://github.com/hurtener
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7493e49909160fa14a33470a8f115364a20c7bec -
Trigger Event:
push
-
Statement type: