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

Uploaded CPython 3.11+Windows x86-64

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

Uploaded CPython 3.11+macOS 11.0+ ARM64

pygent_ai-0.2.14-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.14.tar.gz.

File metadata

  • Download URL: pygent_ai-0.2.14.tar.gz
  • Upload date:
  • Size: 570.4 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.14.tar.gz
Algorithm Hash digest
SHA256 627355d8aa65e58ce3d8b1e286d1ffa1d4b91d381387fe473a8262d4bfff0ad6
MD5 53b290a59d4925be937286f98f4e35da
BLAKE2b-256 5afd983f0a47c94e2d2187ac08524adece69dcb9d371a996cd4621e3c1579101

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pygent_ai-0.2.14-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.14-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 845feb5bd30c27bff8b6a8640e7db1539cc97ea496a432ab0fdfda3b6f85856a
MD5 c2f889528dbf000486923945eab88b32
BLAKE2b-256 f6b234020e3bfe1e7890f5a0b9b6c8b7e95bf092dae9f6020cf6c8e41e25e5a5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.14-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b8ae12c4802a251c76cd30dd2d940573c1137e82a1ee73951352bde3090a989b
MD5 f83170153a0ef7cf6b304863517de5aa
BLAKE2b-256 83823f5207fce2a0f6ada4bdc61dc29a4cd23dd617bbe3f0aa8ec93b81a06a41

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.14-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e347d0196a817bdad419ed98abfaaf666b5cd581f858fe95c3d3711ee3556870
MD5 6ecf53eeb02681e69c14d6756a06df17
BLAKE2b-256 3c151b77a1eada53c32d1d01840ad62fb9ade49c7eebaed8e8a8c1895ba9580b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.14-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 91e9549e4a1da47754809706cf73e59251bb6e2c339ebca9e7579fa62a1f5e8e
MD5 58a686334551cc07102845deb173d10a
BLAKE2b-256 3216a0b640b6a7cff4e350dff90e5b68254f499933761a4c4aa42200aff676b7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.14-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 621329e7df1a7845bea5dfb46f799023906bfb32529518ba44589d785b5c15c7
MD5 eb256a1795431e4c0e43c2f7f0c6b2a8
BLAKE2b-256 614c59ffa7a8e7f760eb2e50e886ccbdeed9dc15fad777a5ce9b8b90c566abeb

See more details on using hashes here.

Provenance

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