Products :: PAGI :: Overview

Async Perl. Real-time protocols. One interface.

PAGI

PAGI (Perl Asynchronous Gateway Interface) is an async-first standard interface between Perl servers, frameworks, and applications. It is the spiritual successor to PSGI, designed for streaming and long-lived connections where classic request/response is not enough.

PAGI unifies multiple protocol types under one application model: an async handler receives a scope plus receive/send functions, and all IO is explicit via Futures. Core interface stability is the goal; higher-level convenience layers continue to evolve.

Key capabilities of PAGI include:

  • One interface for HTTP, WebSocket, SSE, and lifespan (startup/shutdown)
  • Event-based messaging for streaming responses and real-time apps
  • Explicit backpressure via Futures, for predictable performance under load
  • Reference server plus routers, middleware, and bundled apps
  • Bridge for legacy sync applications via WrapPSGI

The PAGI distribution ships a full reference stack: 36 middleware modules, 17 bundled apps, plus extensive tests and examples to help teams start building quickly.

The included compliance report documents concrete results as of December 2025: 10/10 HTTP/1.1 compliance tests passed, 49/49 protocol fuzzing tests passed, and 215/301 WebSocket Autobahn cases passed (71% overall).

Products :: PAGI :: Code

Async in Perl - explicit IO, explicit backpressure.

PAGI Code

A PAGI application is a simple async handler: it receives $scope, $receive, and $send. Both $receive and $send return Futures, so you can await and naturally apply backpressure instead of buffering unbounded data.

The screenshot links to the Raw PAGI example with explicit UTF-8 handling from the PAGI POD. The same model applies across http, websocket, and sse scope types.

Developer-focused docs:

Deep-dive MetaCPAN documentation:

Products :: PAGI :: Web Log Output

Reference server - documented compliance and real-world controls.

PAGI Server Running Output

PAGI includes PAGI::Server, an IO::Async-based reference server implementation for HTTP/1.1, WebSocket, and SSE, with optional TLS support. It is designed to be clear, testable, and practical - and it is often deployed behind a reverse proxy for production.

Operational highlights:

  • HTTP/1.1 keepalive, streaming responses, and resource limits
  • WebSocket and SSE support for real-time applications
  • Multi-worker mode with graceful restarts and signal control
  • Explicit backpressure on send/receive paths via Futures
  • Security-focused middleware such as SecurityHeaders