Skip to main content

Pygent

Pygent is a PyTorch-like framework for composing LLM agents with no hidden per-call state from reusable Module graphs. It provides a single Execution owner for direct and managed calls, an asyncio Runtime, observable model/tool events, OpenAI-compatible and Anthropic Messages adapters, portable tools and MCP adapters, ReAct, SQLite recovery, and HTTP/SSE workers. The documentation contract is versioned 0.3 independently of the package version (see pyproject.toml).

Resource benchmark

Pygent 0.3.10 had the highest composite score among qualifying durable-runtime configurations at both tested loads. It recorded the lowest run time, P95, process-tree CPU, and peak RSS in each table.

Concurrent requests Durable rank Run P95 CPU Peak RSS Disk writes
200 1 of 4 3.828 s 3.758 s 4.906 s 102.2 MB 95.958 MB
1,000 1 of 3 23.070 s 22.603 s 23.453 s 211.1 MB 718.838 MB

This is not an all-metrics win: Pygent wrote 95.958 MB and 718.838 MB, respectively—74.2% and 156.8% more than LangGraph. The benchmark measures framework overhead on Windows with a local OpenAI-compatible mock, not model quality or production capacity, and the durable semantics are not identical. See the full methodology, tables, qualification rules, limitations, and optimization targets.

First principles

Pygent 0.3 第一原则 is the repository's highest authority. Module-specific first principles, SDK contracts, tests, examples, and code derive from it.

Quickstart

from pygent import AIMessage, Context, RecurrentModule, UserMessage


class Echo(RecurrentModule):
    async def forward(self, message, context):
        output = AIMessage(content=message.content.upper())
        return output, context + message + output


message, context = await Echo().invoke(UserMessage(content="hello"), Context())

Direct invoke(), stream(), and start() need no Runtime. Bind a Module to LocalRuntime when its call contract is supported and the application needs bounded concurrency, cancellation, deadlines, remote placement, durable history, or advanced Execution control. This standard recurrent example returns (message, context); ordinary Module inputs and results are user-defined. See the Execution contract.

Install pygent-ai[video] to enable PyAV-backed video inspection and normalization in the standard read tool. The base package does not install PyAV; an independently installed av package or system ffmpeg/ffprobe is detected automatically.

Documentation

Development

uv sync --all-extras
uv run pytest -q
uv run ruff check src tests examples benchmarks
uv run mypy src benchmarks
uv build
python -m examples.service.main
uv run --extra performance python -m benchmarks run synthetic-smoke

Python 3.11+ is required. Apache-2.0; see LICENSE.

Metadata

Release files for pygent-ai 0.6.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pygent-ai 0.6.8
File Size Uploaded Provenance Actions
pygent_ai-0.6.8.tar.gz 1.4 MB With provenance Details for pygent_ai-0.6.8.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pygent-ai 0.6.8
File Actions
pygent_ai-0.6.8-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for pygent_ai-0.6.8-cp311-abi3-win_amd64.whl
pygent_ai-0.6.8-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for pygent_ai-0.6.8-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pygent_ai-0.6.8-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for pygent_ai-0.6.8-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
pygent_ai-0.6.8-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for pygent_ai-0.6.8-cp311-abi3-macosx_11_0_arm64.whl
pygent_ai-0.6.8-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for pygent_ai-0.6.8-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 16.0 MB

Release files / pygent_ai-0.6.8.tar.gz

Download URL pygent_ai-0.6.8.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
02c8e73e8e7645d8ed4b5f9090ae55b8fd1722ae7c723e326d6318a7fc440b70
BLAKE2b-256 checksum
How to use checksums
c43e89ae730d01f7b2e0a3243060290f0fcc1b9b01eed039f97f8f9ee2f14467
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / pygent_ai-0.6.8-cp311-abi3-win_amd64.whl

Download URL pygent_ai-0.6.8-cp311-abi3-win_amd64.whl
Size 2.7 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
8afddf26d03ff09b4c7db0041b989512354c2cf5127331d197827d2364f5eb05
BLAKE2b-256 checksum
How to use checksums
a096d410daa055a85e7e4dda8fd1711de7c16266cf7056fe38cda2c739af736b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / pygent_ai-0.6.8-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pygent_ai-0.6.8-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 3.1 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
46e2e5b54d788bda242ac2468fb6033020b0ba06f61208d386a4aa7fefffc651
BLAKE2b-256 checksum
How to use checksums
fa8cd96b5cef873ccec0c190fa74dd0733bb0fcf76b0f6f5a81bbfc24421f823
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / pygent_ai-0.6.8-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL pygent_ai-0.6.8-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 3.1 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
a6d4427168c5ed71ad220687608eb41c84e80ee3382cb8519dd162a8830da7e6
BLAKE2b-256 checksum
How to use checksums
13b5028cdf99d1268e564e385d4d81a4c9710980629b923372812d2d16c92197
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / pygent_ai-0.6.8-cp311-abi3-macosx_11_0_arm64.whl

Download URL pygent_ai-0.6.8-cp311-abi3-macosx_11_0_arm64.whl
Size 2.8 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8c42b3a1c534093012e8dd7bb4a7e2ee075a75f15a1b720809948e3c4411bb29
BLAKE2b-256 checksum
How to use checksums
ca3c9d45da39b7ec9084c4c16a725f6ace95257cefc8d4be7b8a3cf30813b5c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / pygent_ai-0.6.8-cp311-abi3-macosx_10_12_x86_64.whl

Download URL pygent_ai-0.6.8-cp311-abi3-macosx_10_12_x86_64.whl
Size 2.9 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
7f867cd7cd198247edc273fc415d16f5494889ebe31cd45f124068e9ca797763
BLAKE2b-256 checksum
How to use checksums
480fe4d3b2b289a81a487f8bbb0aa0e09c4c66db171bb1b36a57e09f36cc9216
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for pygent-ai 0.6.8

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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for pygent_ai-0.6.8.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.6.8 This release

6 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page