🧩 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.
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.
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.
Release files for composables 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| composables-0.2.0.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| composables-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.5 kB
Release files / composables-0.2.0.tar.gz
| Download URL | composables-0.2.0.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15a0a115f8e4bc432b490cc3fa05a0a303b0085ae408e2b790e4193cf7d7e078
|
|
BLAKE2b-256 checksum How to use checksums |
918270e0e4c9f59cba63f6854dc7ed6d50f2a4a991462402be3737b468f07a12
|
| 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 12, 2026.
Transparency logRelease files / composables-0.2.0-py3-none-any.whl
| Download URL | composables-0.2.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
168a7bc5d1aaadd1234b02e21130591801b35d5279495fd69fb05d82cc32ed19
|
|
BLAKE2b-256 checksum How to use checksums |
c2107eb03a31a7a0e7d03e8b26bd37a934f24b7781657e12398f77d056485c77
|
| 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 12, 2026.
Transparency log