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

Uploaded CPython 3.11+Windows x86-64

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

Uploaded CPython 3.11+macOS 11.0+ ARM64

pygent_ai-0.2.12-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.12.tar.gz.

File metadata

  • Download URL: pygent_ai-0.2.12.tar.gz
  • Upload date:
  • Size: 566.9 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.12.tar.gz
Algorithm Hash digest
SHA256 add875781f085155242476922399ea0c6db55f3f349af921f7e7a93cef20ed2c
MD5 2116734d2ff29ed03138304897cffdf8
BLAKE2b-256 ed4e04f9525536234ae8bb5db53b755cf55f0f72a20103e49fd90e4855ae5614

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pygent_ai-0.2.12-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.12-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ee81fee0de51a0db7123f16e0371c2893a52ff96a6a5144d2b01c85cf9ce3670
MD5 9417dfb2727735308e0ca7976fb1bd6b
BLAKE2b-256 7dec0215f6097cc6cc505a4aca688ac48c2b97e58c7473c159d9224583f06838

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.12-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea885dfec709acaeb24f0b0f06ab13b4a48079d0006de63c0c8ef887e4446c73
MD5 6b592f547b732b7e8cb83ade5c05007c
BLAKE2b-256 d2454e7a0fb3a3897da947ba0ac4e6cb295d6df591a0a47a18b51df5cf1a11b7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.12-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fbe7abaaa9cf161abd3067188a8b75c8808da17666ceac4270206396f6bbecee
MD5 501ff9994be2f9e52a8edd28ef33afab
BLAKE2b-256 ea6af27b0e4fade8cf5ac847058a155360141af985934e9a414adb92de701ac1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.12-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3a4f59d0f8554c3bc31351470aaa5b7f9442e1ea3e672a22fd658b62e1bdbac6
MD5 50baaa77631737579b8c04206c3dae9d
BLAKE2b-256 d15047401ee4634aa4070b6a67042d2d41f1026b34bfb1e68a9f5e53d414d33a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.12-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8fd4e8f1d63d8099b4c035758fbc746c554df87ff39cfa103fa0e4bf4af3cc56
MD5 eda74ebd719155b431d3401b21ed2aa8
BLAKE2b-256 00352508029dce443159564a77cac9d0b6b3443eaf3efa6db30069664af1c30a

See more details on using hashes here.

Provenance

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