Skip to main content

Pygent 0.2

Pygent is a PyTorch-like framework for composing stateless LLM agents from reusable Module graphs. Version 0.2 provides a single Execution owner for direct and managed calls, an asyncio Runtime, observable model/tool events, OpenAI-compatible adapters, portable tools and MCP adapters, ReAct, SQLite recovery, and HTTP/SSE workers.

First principles

Pygent 0.2 第一原则 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, Module, UserMessage


class Echo(Module[UserMessage, AIMessage]):
    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 the same graph to LocalRuntime when the application needs bounded concurrency, cancellation, deadlines, remote placement, durable history, or advanced Execution control. Both modes execute the same forward() graph and return (message, context); see the 0.2 Execution contract.

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygent_ai-0.2.15.tar.gz (584.8 kB view details)

Uploaded Source

Built Distributions

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

pygent_ai-0.2.15-cp311-abi3-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.11+Windows x86-64

pygent_ai-0.2.15-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

pygent_ai-0.2.15-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.7 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

pygent_ai-0.2.15-cp311-abi3-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

pygent_ai-0.2.15-cp311-abi3-macosx_10_12_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file pygent_ai-0.2.15.tar.gz.

File metadata

  • Download URL: pygent_ai-0.2.15.tar.gz
  • Upload date:
  • Size: 584.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pygent_ai-0.2.15.tar.gz
Algorithm Hash digest
SHA256 e46624610b7f872d1b30bf049ed164df2ec52506f776dcf938c002cbccd8b7a4
MD5 732779f6e7155aecb4a34578f258dd10
BLAKE2b-256 dd8efd9017982b2d4f01734c766a42eb8f112976c885775c3d5de8b8c1298c1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygent_ai-0.2.15.tar.gz:

Publisher: python-publish.yml on pygent-ai/pygent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygent_ai-0.2.15-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: pygent_ai-0.2.15-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pygent_ai-0.2.15-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 164a9eff89734d98d64b9419e9b113a3979889713b19fb2e53dfc9b9f2415309
MD5 eda7bbb463d90b5e628f1217d93867f9
BLAKE2b-256 0d2849983279048e68ba976490b8f4d0022114be45b6b7bb57958d330b78cdf4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygent_ai-0.2.15-cp311-abi3-win_amd64.whl:

Publisher: python-publish.yml on pygent-ai/pygent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygent_ai-0.2.15-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygent_ai-0.2.15-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 700789573f5d0e533c8f769912f438bda9f6b87919fea6a9f145ae98d62fbba1
MD5 236fdb81e5a1f702a3921f96784abf96
BLAKE2b-256 b5b32ecc7bc639fef63764974c86331db19df9566129ab974799d219680df53d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygent_ai-0.2.15-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-publish.yml on pygent-ai/pygent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygent_ai-0.2.15-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pygent_ai-0.2.15-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f0609484c74ddeff5e1f7eeeec7df16ec9cb9329afaa679f32c29bd09052d6fc
MD5 e37da795a5a2e9bc4740c3bc2de8d233
BLAKE2b-256 01816ddadc130b196c833744b5f2d57510713d419e37cacb6d05aa8ea8286113

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygent_ai-0.2.15-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: python-publish.yml on pygent-ai/pygent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygent_ai-0.2.15-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pygent_ai-0.2.15-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a51d9035ae48af3971376cb8393dd2816dc31ae0ae286687cec251d63c26b899
MD5 49be88f913f3f00741221cccf34b32ff
BLAKE2b-256 1e70f8f780fb21abf0a005e53d15b9f90ea1d67b19e3d917598cd50ed2f33417

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygent_ai-0.2.15-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: python-publish.yml on pygent-ai/pygent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygent_ai-0.2.15-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pygent_ai-0.2.15-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 aad6181a9e8238a5a6f3c0f7a63280d37001f00e430393bd78739288b2fea588
MD5 610a14972a5118fb9679f7a52e471c03
BLAKE2b-256 09b7ac89272c7ffa77281eeb5837880ae1c3e47e5b9a334e8132219770f521aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygent_ai-0.2.15-cp311-abi3-macosx_10_12_x86_64.whl:

Publisher: python-publish.yml on pygent-ai/pygent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page