Skip to main content

🧩 composables

Familiar patterns. Beautiful types. Better code.

Your next abstraction might already have a name.

Zero runtime dependencies. Every notion uses only the Python standard library.

A growing catalog of notions: recurring patterns expressed through precise Python types. Give your code a shared vocabulary that makes intent easier to read, implementations easier to compose, and changes easier to check.

Notion The pattern
Agent An ongoing exchange of observations and actions.
Policy A stream of actions from an initial observation.
Environment A factory, a live session, a typed transition.
Configurable Construction from a typed configuration.

Agent

Give every interaction a clear contract.

Agent[State, Action] names both sides of an interaction. Yield actions, receive new observations through asend, and let the types describe the exchange before anyone reads the implementation.

interact(observation: State) → AsyncGenerator[Action, State]

The agent holds static configuration. Each call owns its interaction state and actions; concurrent calls on the same agent must remain independent.

Explore the Agent notion →

Policy

Turn an intention into a typed stream of actions.

Policy[State, Action] gives action generation a reusable shape. Start with an observation and produce an asynchronous action stream, with the input and output types visible at the boundary.

run(observation: State) → AsyncIterator[Action]

The policy holds static configuration. Each run owns its execution state and actions; concurrent runs on the same policy must remain independent.

Explore the Policy notion →

Environment

Make the world your code acts on explicit.

Environment[State, Action, Reward, Context] pairs a reusable factory with EnvironmentSession[State, Action, Reward, Context]. The types name what an action changes, what it earns, and what comes back with the result.

session() → EnvironmentSession[State, Action, Reward, Context]
step(action: Action) → tuple[State, Reward, Terminated, Truncated, Context]

The environment is stateless. Each session owns its interaction state and uses async with to scope resource acquisition and cleanup.

Two distinct boolean types give episode endings their own meaning:

Type What it tells you
Terminated The episode reached a terminal state.
Truncated An external limit ended the episode.

Explore the Environment notion → · Episode types

Configurable

Give construction the same clarity as behavior.

Configurable[Configuration] binds a component to a configuration type you choose. Its factory accepts that type and returns Self, preserving the concrete subclass in the type contract.

from_configuration(configuration: Configuration) → Self

A shared construction pattern makes configuration requirements visible across implementations.

Explore the Configurable notion →

Release files for composables 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for composables 0.3.0
File Size Uploaded
composables-0.3.0.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for composables 0.3.0
File Interpreter ABI Platform
composables-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.6 kB

Release files / composables-0.3.0.tar.gz

Download URL composables-0.3.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c1e12fb577f4c28859805e345ca6fd2f4ea0a898e2d620260fd7dee2f0661b0a
BLAKE2b-256 checksum
How to use checksums
c83effc2a0afaac3dff93a171db17c4cb11c09322f10fedd7f98c9d93a3cc19f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.

Transparency log

Release files / composables-0.3.0-py3-none-any.whl

Download URL composables-0.3.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcf2e4ba81272caf866a3682f1ffb002d951b060a3f03de618953d39146be081
BLAKE2b-256 checksum
How to use checksums
044a3df14b391298932109ff2b6183eaadc1bdf5d66dc3c41eaef2a726bf0646
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.0

2 release files

0.4.0

2 release files

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page