Skip to main content

Python-first agent harness framework with Markdown skills, sessions, sandboxes, and pluggable backends.

Project description

PyFlue

CI Docs Landing Page PyPI Python License

PyFlue is the agent harness framework for Python. It gives you Markdown skills, stateful sessions, sandboxed filesystem and shell access, typed Pydantic outputs, streaming events, file-based webhook routes, and deployment-ready project structure.

PyFlue adapts the agent harness model for Python teams.

Warning: Active Development

PyFlue is under active development. The API may change. Pin your dependencies and review changelogs before updating.

Use it to build coding agents, issue triage agents, data analysis agents, support agents, and workflow agents that need controlled access to files, commands, tools, and structured outputs.

Documentation: https://superagenticai.github.io/pyflue/

Landing page: https://super-agentic.ai/pyflue

Install

With uv:

uv add pyflue

With pip:

pip install pyflue

Optional extras:

uv add "pyflue[monty]"
uv add "pyflue[sandboxes]"
pip install "pyflue[monty]"
pip install "pyflue[sandboxes]"

Quick Start

pyflue init my-agent
cd my-agent
pyflue run --prompt "Review this project"

Run a local server/client smoke demo without a model key:

uv run python examples/server_client/run_smoke.py

Python API

from pydantic import BaseModel
from pyflue import init


class FixResult(BaseModel):
    fix_applied: bool
    summary: str


async def main():
    agent = await init(
        model="openai:gpt-5.5",
        sandbox="virtual",
        allow_write=True,
        allow_shell=True,
        allowed_commands=["git"],
    )
    session = await agent.session("fix-123")
    result = await session.skill(
        "triage",
        args={"issue_number": 123},
        result=FixResult,
    )
    if result.fix_applied:
        await session.shell("git status --short")

What PyFlue Gives You

Capability What it means
Markdown skills Put reusable workflows in .agents/skills/*.md.
Project instructions Use AGENTS.md for global behavior and context.
Roles Scope behavior with .agents/roles/*.md.
Sessions Resume agent state with stable session IDs.
Tasks Run focused child tasks with isolated history and shared sandbox.
Sandbox Read, write, edit, grep, glob, and shell behind explicit policies.
Secret grants Keep secrets out of prompts and grant them only per call.
Typed outputs Validate results with Pydantic, extract JSON from text, and repair invalid JSON automatically.
Streaming Use session.stream(...), pyflue run --stream, or SSE.
Abort Cancel active prompt, stream, task, and shell operations with session.abort().
Structured commands Expose reusable shell or callable commands with PyFlueCommand.
Python client Call deployed PyFlue servers with PyFlueClient.
Webhooks Expose agents/*.py as /agents/{name}/{agent_id}.
Python code backend Use pyflue[monty] for safe host-side Python snippets.
Remote sandboxes Use Daytona, E2B, Modal, or Runloop with optional extras.
Connector guides Use pyflue add to print agent-readable setup guides for sandbox providers.
Deployment Generate Docker/FastAPI, CI, Railway, Render, Fly.io, Vercel, Netlify, and Cloudflare Containers starter files.

Project Layout

AGENTS.md
pyflue.toml
.agents/
  roles/
    coder.md
  skills/
    triage.md
agents/
  default.py

File-Based Agent

triggers = {"webhook": True}


async def default(context):
    agent = await context.init()
    session = await agent.session(context.agent_id)
    result = await session.prompt(context.payload["prompt"])
    return {"text": result.text}

Run it locally:

pyflue dev --port 2024

Call it:

curl http://127.0.0.1:2024/agents/default/demo \
  -H "Content-Type: application/json" \
  -d '{"payload": {"prompt": "Review this repository"}}'

Streaming

pyflue run --stream --prompt "Review this project"
async for event in session.stream("Review this project"):
    print(event.type, event.data)

Connector Guides

List available guides:

pyflue add

Print a guide for a known sandbox provider:

pyflue add daytona --print

Start from any provider documentation URL:

pyflue add https://e2b.dev/docs --category sandbox --print | codex

Security Model

PyFlue starts with safe defaults:

  • writes are disabled until allow_write=True
  • shell execution is disabled until allow_shell=True
  • compound shell syntax is blocked by default
  • command allowlists are supported with allowed_commands
  • secrets are not injected into prompts
  • secrets are mounted into sandbox calls only when requested with secrets=[...]

Deployment

Generate deployment files:

pyflue build --target docker
pyflue build --target railway
pyflue build --target fly
pyflue build --target vercel
pyflue build --target netlify
pyflue build --target cloudflare

Deploy with a supported provider CLI:

pyflue deploy --target fly

Development

uv sync --extra dev --extra docs
uv run --extra dev ruff check .
uv run --extra dev pytest
uv run --extra docs mkdocs build --strict
uv build

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

pyflue-0.1.3.tar.gz (399.2 kB view details)

Uploaded Source

Built Distribution

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

pyflue-0.1.3-py3-none-any.whl (89.6 kB view details)

Uploaded Python 3

File details

Details for the file pyflue-0.1.3.tar.gz.

File metadata

  • Download URL: pyflue-0.1.3.tar.gz
  • Upload date:
  • Size: 399.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for pyflue-0.1.3.tar.gz
Algorithm Hash digest
SHA256 9e9daf01c7683404b7bb7ecc957c7f95b140f5ddffb7c15888fe6ca5783e3c9f
MD5 2b786047fa0018df3e0e86cd0177553c
BLAKE2b-256 cb86ef6f78705da07e69f8411a7deb71489c9a600fc5053ce400c11fe4e34278

See more details on using hashes here.

File details

Details for the file pyflue-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pyflue-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 89.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for pyflue-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d8049f444265af011bd7dae11bb246e07cb2e3b24d950cd849df19249f938658
MD5 0ec70aee2ea7b837b089fb6d818a883b
BLAKE2b-256 0ead699e310b2089b351a649f2231b7de96bb6e37a5ac5e96156b0187c63072a

See more details on using hashes here.

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