gds.blocks¶
Base¶
Bases: Tagged, ABC
Abstract base for all Blocks — both atomic and composite.
Every block has a name and an interface describing its boundary
ports. Composition operators (>>, |, .feedback(), .loop())
build composite blocks from simpler ones.
Source code in packages/gds-framework/gds/blocks/base.py
flatten()
abstractmethod
¶
__rshift__(other)
¶
a >> b — stack (sequential) composition.
Source code in packages/gds-framework/gds/blocks/base.py
__or__(other)
¶
a | b — parallel composition.
Source code in packages/gds-framework/gds/blocks/base.py
feedback(wiring)
¶
Wrap with backward feedback within a single timestep.
Source code in packages/gds-framework/gds/blocks/base.py
loop(wiring, exit_condition='')
¶
Wrap with forward temporal iteration across timesteps.
Source code in packages/gds-framework/gds/blocks/base.py
Bases: Block
Base class for non-decomposable (leaf) blocks.
Domain packages subclass this to define their own atomic block types.
Source code in packages/gds-framework/gds/blocks/base.py
Composition¶
Bases: Block
a >> b — stack (sequential) composition.
Output of the first block feeds input of the second. If no explicit
wiring is provided, the validator checks that forward_out tokens
overlap with forward_in tokens.
Source code in packages/gds-framework/gds/blocks/composition.py
Bases: Block
a | b — parallel composition: blocks run independently.
Source code in packages/gds-framework/gds/blocks/composition.py
Bases: Block
Backward feedback within a single timestep (backward_out -> backward_in).
Source code in packages/gds-framework/gds/blocks/composition.py
Bases: Block
Forward temporal iteration across timesteps (forward_out -> forward_in).
All temporal wiring must be covariant direction.
Source code in packages/gds-framework/gds/blocks/composition.py
Bases: BaseModel
An explicit connection between two blocks.
Covariant wirings (the default) carry data forward; contravariant wirings carry feedback backward.
Source code in packages/gds-framework/gds/blocks/composition.py
Roles¶
Bases: AtomicBlock
Exogenous input — enters the system from outside.
In GDS terms: part of the admissible input set U. Boundary actions model external agents, oracles, user inputs, environmental signals — anything the system doesn't control.
Enforces forward_in = () since boundary actions receive no
internal forward signals.
Source code in packages/gds-framework/gds/blocks/roles.py
Bases: AtomicBlock
Decision logic — maps signals to mechanism inputs.
Policies select from feasible actions. Named options support scenario analysis and A/B testing.
In GDS terms: policies implement the decision mapping within the admissibility constraint.
Source code in packages/gds-framework/gds/blocks/roles.py
Bases: AtomicBlock
Endogenous control — reads state, emits control signals.
These are internal feedback loops: the system observing itself and generating signals that influence downstream policy/mechanism blocks.
Source code in packages/gds-framework/gds/blocks/roles.py
Bases: AtomicBlock
State update — the only block type that writes to state.
Mechanisms are the atomic state transitions that compose into h. They have no backward ports (state writes don't propagate signals).
updates lists (entity_name, variable_name) pairs specifying
which state variables this mechanism modifies.