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

Uploaded CPython 3.11+Windows x86-64

pygent_ai-0.2.17-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.17-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.17-cp311-abi3-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

pygent_ai-0.2.17-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.17.tar.gz.

File metadata

  • Download URL: pygent_ai-0.2.17.tar.gz
  • Upload date:
  • Size: 593.5 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.17.tar.gz
Algorithm Hash digest
SHA256 2fd411c3a6800b78c80cfaa3b0283c8bab953c22f0501c821ca2976c750f7924
MD5 853e58ce98853497137d6d4600695cd9
BLAKE2b-256 5f0b7753bad1cce81cd42aa7155e14339297e1ee235f9fcb7bad14216cb56e0b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pygent_ai-0.2.17-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.17-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1adfe4ac2573cd88d655d90d0e664d3ab4e9cfc5a07158c6bac4afe6909aec07
MD5 7dd1f2da6668f3a8c971725e7cb0b63b
BLAKE2b-256 01ef51184c6df8e58cb65d6699fac3085f51526ada8fa24ecf32cf885f1aa79e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.17-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 352219efe589f1635bc4bf978971308d49647473c36cb8e05c0f10b825008f41
MD5 e7b9724c5c2ee44b1da4d7a5bd613032
BLAKE2b-256 a46d6c219065180fab7b4dbc109dd449e7c483a1f88f347bc2b763c5868f2277

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.17-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 604506dbb7702e884a48939dd021cf2c1c5bdb89d81fda7f353dc88c5fa6d04f
MD5 0efa33be33f10c054c0f0b2db251aa43
BLAKE2b-256 6b1e725f3b8d85f716f808c3ccbb1bbf68c589b813e5d897ec9d3ce9272d0402

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.17-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bc979164e43ec135e5761a2f8d15d52813e57417977432a52b5695f48bd177f5
MD5 53a58136c10353611764331f3c9e339d
BLAKE2b-256 5309092e52801ac45f6529ca6b4a8ec3be21a506d4e2d0e5087455ce1d66077d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.17-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 879acfe181a0e57c328ce3826c134a2c4b3ca8679afb7925b3886b2a7d555527
MD5 6fc5992fca3c7bd41e0904db3f4585e5
BLAKE2b-256 004d9c288f0ab7b373599861ef02a8b0088a2f8914be31e682afce223d519b8e

See more details on using hashes here.

Provenance

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