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.11.tar.gz (554.6 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.11-cp311-abi3-win_amd64.whl (2.2 MB view details)

Uploaded CPython 3.11+Windows x86-64

pygent_ai-0.2.11-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.11-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.6 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.11+macOS 11.0+ ARM64

pygent_ai-0.2.11-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.11.tar.gz.

File metadata

  • Download URL: pygent_ai-0.2.11.tar.gz
  • Upload date:
  • Size: 554.6 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.11.tar.gz
Algorithm Hash digest
SHA256 fc189b4e91c2850d664a9b66da851b7ee35389316798aaa4b5e7a70085cc5c55
MD5 ca1053e7a90cfab0c6348e14efd8ae4f
BLAKE2b-256 75743728781704b0a802796830df1091d2aa8ad9e99598f389c2b19f109b01aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygent_ai-0.2.11.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.11-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: pygent_ai-0.2.11-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.11-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 99e6656d4112baca3a18ef335c458837c76493ceeb032fd44df57527d0c8dd99
MD5 772c55bba4d07a5a2997c9579fab1933
BLAKE2b-256 1442610e85ad32ab0d27d4f864570daf5357aedc11a592d42fb048144341a9fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygent_ai-0.2.11-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.11-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pygent_ai-0.2.11-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8f8eac8626b235baf2a3f5548e2d24e6325716667c2e661019257bac70b5c951
MD5 c61f3fe3b58b50fa15a3a862545b6285
BLAKE2b-256 b6c6ae76d54d1f85024ef61b5d2dfec0e67a3070df0a304c8a94962c81a33758

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygent_ai-0.2.11-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.11-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pygent_ai-0.2.11-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a6356304d84650d890588b7d062248aaeba7b9c8990322b34825e8fa73bd66dd
MD5 dc17b82cabe28b3822997e76b22f3364
BLAKE2b-256 2ecf8d60af2ab613c4ace6e912e1137d7ac96b1fb5cd27e0383454fb45d704f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygent_ai-0.2.11-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.11-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pygent_ai-0.2.11-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 98d5996ca22948b9198644717b46b8f6445d1a8ac19db6e643659856c4305017
MD5 59f3edb2a7fa1b87b6aa837adc8845a2
BLAKE2b-256 c90b8f6f13a952fcfbe4e667221119a423cdd527ca1459af24b691b26a5d448b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygent_ai-0.2.11-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.11-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pygent_ai-0.2.11-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 29c32a8231969eff8daa201a7bba83909fc4506aa5085a0a7c66f4ae01817c4a
MD5 e796fb299285185b085acc4c34468d17
BLAKE2b-256 10d66c3e440f925b66950444b81cb759b83facd45b54b65be10c6a6d2bbe5c6d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygent_ai-0.2.11-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