Skip to main content

Embedded async pipeline engine for FastAPI

Project description

Pipely

Pipely is a small embedded async pipeline engine for FastAPI services. It is for long in-process workflows such as OCR, document processing, meeting protocol generation, indexing, LLM agents, and report generation where Airflow or Prefect would be too heavy.

MVP scope:

  • linear async pipelines;
  • Postgres persistence through SQLAlchemy 2 async;
  • automatic table creation;
  • in-process execution;
  • retries, resume, retry failed, restart from step, cancel;
  • FastAPI REST API and a small built-in HTML UI.

Install

pip install -e ".[test]"

For production use, provide a Postgres URL:

postgresql+asyncpg://user:password@host:5432/database

Usage

from fastapi import FastAPI
from pipely import PipelineContext, Pipely, step

app = FastAPI()

pipely = Pipely(database_url=settings.DATABASE_URL, ui_path="/_pipely")
pipely.mount(app)


@pipely.pipeline("meeting_protocol")
class MeetingProtocolPipeline:
    @step(retries=3)
    async def transcribe(self, ctx: PipelineContext) -> None:
        transcript = await transcribe_audio(ctx.input["audio_url"])
        ctx.set("transcript", transcript)

    @step(retries=2)
    async def clean_transcript(self, ctx: PipelineContext) -> None:
        clean = await clean_text(ctx.get("transcript"))
        ctx.set("clean_transcript", clean)

    @step(retries=2)
    async def extract_tasks(self, ctx: PipelineContext) -> None:
        tasks = await extract_tasks(ctx.get("clean_transcript"))
        ctx.set("tasks", tasks)

Start and control runs:

run = await pipely.start("meeting_protocol", input={"audio_url": "s3://bucket/audio.mp3"})

await pipely.retry_failed(run.id)
await pipely.resume(run.id)
await pipely.restart_from_step(run.id, "extract_tasks")
await pipely.cancel(run.id)

Mounted endpoints:

  • GET /_pipely
  • GET /_pipely/api/runs
  • GET /_pipely/api/runs/{run_id}
  • POST /_pipely/api/runs
  • POST /_pipely/api/runs/{run_id}/retry
  • POST /_pipely/api/runs/{run_id}/resume
  • POST /_pipely/api/runs/{run_id}/restart-from-step
  • POST /_pipely/api/runs/{run_id}/cancel

Architecture

  • Pipely registers pipelines and mounts FastAPI routes.
  • PipelineContext exposes input, persistent state, get, set, flush, and log.
  • Storage owns SQLAlchemy async persistence and creates tables from metadata.
  • InProcessExecutor executes steps sequentially, skips successful steps on resume, records attempts/errors/tracebacks, and marks stale running steps failed before resume.
  • ui.py serves a dependency-free HTML/JS developer UI.

Next Steps

  • background execution mode for REST starts;
  • real migration integration with Alembic;
  • graph transitions after the linear MVP stabilizes;
  • cron/queue/distributed workers;
  • richer metrics export.

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

pipely_core-0.1.0.tar.gz (6.0 MB view details)

Uploaded Source

Built Distribution

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

pipely_core-0.1.0-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

Details for the file pipely_core-0.1.0.tar.gz.

File metadata

  • Download URL: pipely_core-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for pipely_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 03752d9532bca3f9d86b50199b604aaaed8ba659427b6facf5f2148d00213c45
MD5 64a1b466f9bbe180d74f85ce6be8eac6
BLAKE2b-256 2ba56905d7ad12dc2f7e7c10880116a4b16932f4189a89dee1cbc35b98bec200

See more details on using hashes here.

File details

Details for the file pipely_core-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pipely_core-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for pipely_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c20d7af58bf42eb79977bcbb016ab59d6a17d56025a265e3d2ec07f195db67e
MD5 d2aa89dd524e53792eb490712644c800
BLAKE2b-256 984aec121e86d493feb6ab51fb8bbc8f4d974558b5b3b6108e68faccd59bc125

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