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

Uploaded CPython 3.11+Windows x86-64

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

Uploaded CPython 3.11+macOS 11.0+ ARM64

pygent_ai-0.2.16-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.16.tar.gz.

File metadata

  • Download URL: pygent_ai-0.2.16.tar.gz
  • Upload date:
  • Size: 589.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.16.tar.gz
Algorithm Hash digest
SHA256 b902f7e7117bc650fb675dd0160d2df0ecf300cf3ea3873eacc71aed91e0c84a
MD5 bd2b615388d503ed8d314c7fced26733
BLAKE2b-256 19cf7051ed316270eaff35cf44dc2b5d5888de9410243815b078ebf5e242e878

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pygent_ai-0.2.16-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.16-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b997ecbbe4103584238cbbf585d973d2c7b6d862f25a48d304284c0fb688f535
MD5 13fb2cc30c6182f3cbf393030e3f23f1
BLAKE2b-256 8d5e8e59f26cb56afd162ca5705e1d3509f675b61033810245f7ef6ebc6efbe8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.16-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5f01f07a2bf10a77200e973f5947d69b32007f4a4b09f9984aec6ece9fc641bd
MD5 f4de37ace42665ce043addebadf27c51
BLAKE2b-256 2fc6285a8b988764344a7a5fb1143a9f00bfa2029153b63c65ae7f53d8ff69d1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.16-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 00a73b2298e358074dd32a86e3741e79dba7baa9f29034a4f83ac4f272c14ac7
MD5 7b3189bda31f33cb0ef56c1f98e0d86e
BLAKE2b-256 bc6db39d9437d6d60a909e9b9c11b7efb0b32533223f2525a359f9a5cb1d15c4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.16-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 610ce4dca49a03903214d126fbbede93b18e291826b6e3b93cb199148b03c411
MD5 d861bce93305596fda5f7b355bcbfae6
BLAKE2b-256 bfffcd5239cd096ff9587e630e1c6715c0fa49cb2a7d33e752f319410ba62846

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pygent_ai-0.2.16-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 01299a88620c542a7a33794c1eeb9102e12472f9fa829c057e76b1e2e34f3f9f
MD5 4fb8bff7da34793b539744673654bea8
BLAKE2b-256 a55509971ba52bee3e2e3e7fb01e8245c1d3864f72a295b811b10c21737f36ad

See more details on using hashes here.

Provenance

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