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

Uploaded CPython 3.11+Windows x86-64

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

Uploaded CPython 3.11+macOS 11.0+ ARM64

pygent_ai-0.2.13-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.13.tar.gz.

File metadata

  • Download URL: pygent_ai-0.2.13.tar.gz
  • Upload date:
  • Size: 568.7 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.13.tar.gz
Algorithm Hash digest
SHA256 5d40a3ed6bb7fed7c975856abb7279fd30bbdc407ae722d64c98456530e974ef
MD5 51f533ad3b729aa6c0f14d5a9b683a34
BLAKE2b-256 14939b482c01c69ff79a8a8d114609fb998503b934efe069b4b48f4088841ff5

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pygent_ai-0.2.13-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.13-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1f5590b66517304a156ae4eceb8e550ffb75ca198632c79fbe634dee7123f459
MD5 b4d8854fdde5e4d9e2614ae8b4469cd2
BLAKE2b-256 c11b585177e9145e72fdeaf44c22b4550ae145642997acd7b008145421c5acb2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.13-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e1cb847939afc1f6010f0704bcfe3fd63b65e21d52d735f433c4913eec6ecfc5
MD5 8dca30c3ec5c52abddb0749915f64c3b
BLAKE2b-256 cce529e140a2aaafe680005db8d7682f3280401ff5f94490e55632e34ea661c9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.13-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0602a38ccfbf09bac9c062bd0fb2398c6e3296524316f7957121a35429b32f43
MD5 363734f087d6814e11415883ecc1e56b
BLAKE2b-256 8d73e7d0df20d970eb3ba808c0868b826ce30d30c7da86f9dc8dc1d6be9836ed

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.13-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e5880f0b2a85d88144bfa778723de3ecb6107717755072480712e37c6ef8d431
MD5 ff75b413881039e239e56a383d14a9b1
BLAKE2b-256 efe71b1a790da256b292a875dcdc6666c8677ab60e6f27566b1a1480f67515f0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.13-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 20b9b8fc538b640ce6f60578398b92c46e59ae049546fb3b0f1831e49f9a202f
MD5 72df3a199482e60124c5908282d44339
BLAKE2b-256 8a58b3f8d634372b7aba9d20aa2d0b25123370bc6cab7885b8c69a343f466008

See more details on using hashes here.

Provenance

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