# flow

URL: /milo-cli/api/milo/flow/
Section: milo
Description: Declarative screen state machine with >> operator.

---

> For a complete page index, fetch /milo-cli/llms.txt.

Open LLM text
(/milo-cli/api/milo/flow/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Fflow%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Fflow%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Fflow%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fmilo-cli%2Fapi%2Fmilo%2Fflow%2Findex.txt)

Module

#
`flow`

Declarative screen state machine with >> operator.

3Classes

## Classes

`FlowScreen`

4

▼

A screen in a flow with its template and reducer.

A screen in a flow with its template and reducer.

#### Attributes

Name
Type
Description

`name`

`str`

—

`template`

`str`

—

`reducer`

`Callable`

—

#### Methods

Internal Methods
1

▼

`__rshift__`

1

`Flow`

▼

screen_a >> screen_b creates a Flow.

`def __rshift__(self, other: FlowScreen) -> Flow`

##### Parameters

Name
Type
Description

`other`
`—`

##### Returns

`Flow`

`FlowState`

2

▼

Runtime state for a flow.

Runtime state for a flow.

#### Attributes

Name
Type
Description

`current_screen`

`str`

—

`screen_states`

`dict[str, Any]`

—

`Flow`

7

▼

Declarative multi-screen state machine.

Declarative multi-screen state machine.

#### Attributes

Name
Type
Description

`screens`

`tuple[FlowScreen, ...]`

—

`transitions`

`tuple[Transition, ...]`

—

#### Methods

`template_map`

0

`dict[str, str]`

▼

Map screen names to template names.

property

`def template_map(self) -> dict[str, str]`

##### Returns

`dict[str, str]`

`from_screens`

1

`Flow`

▼

Create a flow from an ordered sequence of screens.

classmethod

`def from_screens(cls, *screens: FlowScreen) -> Flow`

##### Parameters

Name
Type
Description

`*screens`
`—`

##### Returns

`Flow`

`with_transition`

3

`Flow`

▼

Add a custom transition.

`def with_transition(self, from_screen: str, to_screen: str, *, on: str) -> Flow`

##### Parameters

Name
Type
Description

`from_screen`
`—`

`to_screen`
`—`

`on`
`—`

##### Returns

`Flow`

`build_reducer`

0

`Callable`

▼

Build a combined reducer that routes actions to the current screen's reducer.

`def build_reducer(self) -> Callable`

##### Returns

`Callable`

Internal Methods
1

▼

`__rshift__`

1

`Flow`

▼

flow >> screen_c extends the flow.

`def __rshift__(self, other: FlowScreen) -> Flow`

##### Parameters

Name
Type
Description

`other`
`—`

##### Returns

`Flow`
