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]
await 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. Await each session.step(action) call to obtain its transition result.

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.4.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.4.0
File Size Uploaded
composables-0.4.0.tar.gz 4.2 kB Details

Built distribution (wheel)

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

Total release size: 11.7 kB

Release files / composables-0.4.0.tar.gz

Download URL composables-0.4.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
21fc72dc72bd32a5543e0ef7cbc14386f548c7040c26fc402ba9777cda2db042
BLAKE2b-256 checksum
How to use checksums
aa8f756336ed3def280c30a3ab05558b92a77c94ff1952e4092032d6fc38222b
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.4.0-py3-none-any.whl

Download URL composables-0.4.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07122cf15708c57790a7bd74b16a406eda9781fcd3cdd139e060f59dbff8b1ec
BLAKE2b-256 checksum
How to use checksums
43a2020b232985bbcddf2b3f28f98b51fad941c5b5057298a4d1e674c2cef976
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

This release

0.4.0 This release

2 release files

0.3.0

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