# form

URL: /milo-cli/api/milo/form/
Section: milo
Description: Form fields and form reducer.

---

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

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

Share with AI

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

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

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

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

Module

#
`form`

Form fields and form reducer.

4Functions

## Functions

`form_reducer`

2

`FormState`

▼

Reducer for form state.

`def form_reducer(state: FormState | None, action: Action) -> FormState`

##### Parameters

Name
Type
Description

`state`
`FormState | None`

`action`
`Action`

##### Returns

`FormState`

`make_form_reducer`

2

`Callable`

▼

Create a form reducer pre-loaded with field specs.

The returned reducer initia…

`def make_form_reducer(*specs: FieldSpec, navigate_on_submit: bool = False) -> Callable`

Create a form reducer pre-loaded with field specs.

The returned reducer initializes with the given fields on @@INIT,
so you don't need to pass specs via action payload.

If navigate_on_submit=True, dispatches @@NAVIGATE when the form
is submitted — useful in flows where the next screen should appear
automatically after form completion.

##### Parameters

Name
Type
Description

`*specs`
`FieldSpec`

`navigate_on_submit`
`bool`

Default:`False`

##### Returns

`Callable`

`form`

3

`dict[str, Any]`

▼

Run an interactive form, return field values.

Falls back to input() if not a T…

`def form(*specs: FieldSpec, env: Any = None, timeout: float | None | Any = _UNSET) -> dict[str, Any]`

Run an interactive form, return field values.

Falls back to input() if not a TTY.

##### Parameters

Name
Type
Description

`*specs`
`FieldSpec`

`env`
`Any`

Default:`None`

`timeout`
`float | None | Any`

Maximum seconds to wait for input. Omit (or leave as default) for no limit in TTY sessions; non-TTY sessions default to 30 s to prevent CI pipelines from hanging indefinitely. Pass`None`explicitly to disable the non-TTY timeout.

Default:`_UNSET`

##### Returns

`dict[str, Any]`

`form_schema`

1

`dict[str, Any]`

▼

Return a JSON Schema describing an interactive form.

Mirrors `function_to_sche…

`def form_schema(*specs: FieldSpec) -> dict[str, Any]`

Return a JSON Schema describing an interactive form.

Mirrors`function_to_schema`() output shape so agents
can introspect form structure without running the TUI. A field is
`required` when its `FieldSpec` carries no `default`.

##### Parameters

Name
Type
Description

`*specs`
`FieldSpec`

##### Returns

`dict[str, Any]`
