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.3.tar.gz (154.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygent_ai-0.2.3-py3-none-any.whl (188.0 kB view details)

Uploaded Python 3

File details

Details for the file pygent_ai-0.2.3.tar.gz.

File metadata

  • Download URL: pygent_ai-0.2.3.tar.gz
  • Upload date:
  • Size: 154.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.3.tar.gz
Algorithm Hash digest
SHA256 370a7e04cb962619669d2831f57056baa5ed7c5804cad662b5eb3fcce6d226a0
MD5 2d8c5be82120ac771e6e74fbe80cdfc6
BLAKE2b-256 5347919dfc9f2b8df1131bfd37f9cf3f303d98586bb1e6a7bd49513021757575

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygent_ai-0.2.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: pygent_ai-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 188.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pygent_ai-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d414d2a0783baf8aa43f6a7cdc1a1fda4cc936e445bc8c5085012c88651a5d6d
MD5 09e4ab91855653c05c7c3f43b7a4c4f4
BLAKE2b-256 f3469a6f7dc7dc0291074061c5048d994deb3ab7344e36b0c66846aadb16f807

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygent_ai-0.2.3-py3-none-any.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 Pingdom Monitoring Sentry Error logging StatusPage Status page