# Milo API Reference

URL: /milo-cli/api/milo/
Section: milo
Description: Browse Python API documentation by package.

---

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

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

Share with AI

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

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

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

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

# Milo API Reference

Browse Python API documentation by package.

3
Packages

43
Modules

## Packages

_Scaffold

Project scaffolding for `milo new`.

2 items

(/milo-cli/api/milo/_scaffold/)

Input

Input handling — key reading and escape sequence parsing.

4 items

(/milo-cli/api/milo/input/)

Testing

Public test API: assert_renders, replay, record, MCP client.

5 items

(/milo-cli/api/milo/testing/)

## Modules

_cells

Terminal display-cell width helpers.

Python string length counts code points, but terminals lay text out in...

(/milo-cli/api/milo/_cells/)

_child

Persistent child process for MCP gateway communication.

(/milo-cli/api/milo/_child/)

_cli_help

Markdown help generation for CLI command trees.

(/milo-cli/api/milo/_cli_help/)

_command_defs

Command definition types and helpers.

(/milo-cli/api/milo/_command_defs/)

_compat

Cross-platform compatibility helpers.

(/milo-cli/api/milo/_compat/)

_errors

Structured error hierarchy with format_compact() for terminal display.

(/milo-cli/api/milo/_errors/)

_jsonrpc

Shared JSON-RPC output helpers for mcp.py and gateway.py.

(/milo-cli/api/milo/_jsonrpc/)

_mcp_router

Shared MCP method dispatch for leaf servers and gateway.

(/milo-cli/api/milo/_mcp_router/)

_protocols

Protocols — stdlib/typing only, no internal imports.

(/milo-cli/api/milo/_protocols/)

_types

Frozen dataclasses, enums, and type aliases — no internal imports.

(/milo-cli/api/milo/_types/)

app

App event loop and terminal rendering.

(/milo-cli/api/milo/app/)

cli

CLI entry point — milo dev, milo replay.

(/milo-cli/api/milo/cli/)

commands

CLI application with command decorator and dispatch.

(/milo-cli/api/milo/commands/)

completions

Shell completion generation for bash, zsh, fish, and PowerShell.

(/milo-cli/api/milo/completions/)

components_cli

`milo components` — discover bundled and user-defined template components.

(/milo-cli/api/milo/components_cli/)

config

Configuration system with deep merge, environment overlays, and origin tracking.

(/milo-cli/api/milo/config/)

context

Execution context for CLI command handlers.

(/milo-cli/api/milo/context/)

dev

Hot-reload dev server with smart file watching.

(/milo-cli/api/milo/dev/)

doctor

Built-in diagnostic command for CLI health checks.

(/milo-cli/api/milo/doctor/)

flow

Declarative screen state machine with >> operator.

(/milo-cli/api/milo/flow/)

form

Form fields and form reducer.

(/milo-cli/api/milo/form/)

gateway

Milo MCP gateway — one MCP server that proxies to all registered CLIs.

(/milo-cli/api/milo/gateway/)

groups

Nestable command groups for hierarchical CLI structures.

(/milo-cli/api/milo/groups/)

help

HelpRenderer — argparse formatter_class for styled help output.

(/milo-cli/api/milo/help/)

live

Live-rendering primitives for non-event-loop use.

Re-exports from `kida.terminal`.

(/milo-cli/api/milo/live/)

llms

llms.txt generation from CLI command definitions.

(/milo-cli/api/milo/llms/)

mcp

MCP server — expose CLI commands as tools via JSON-RPC on stdin/stdout.

(/milo-cli/api/milo/mcp/)

middleware

Middleware stack for MCP and CLI call interception.

(/milo-cli/api/milo/middleware/)

milo

Milo — Template-driven CLI applications for free-threaded Python.

(/milo-cli/api/milo/milo/)

observability

Observability for MCP requests — logging, stats, correlation IDs.

(/milo-cli/api/milo/observability/)

output

Structured output formatting for CLI commands.

(/milo-cli/api/milo/output/)

pipeline

Pipeline orchestration with observable state through the Store/saga system.

(/milo-cli/api/milo/pipeline/)

plugins

Plugin system with hook registry and Store middleware integration.

(/milo-cli/api/milo/plugins/)

reducers

Composable reducer combinators for common interaction patterns.

(/milo-cli/api/milo/reducers/)

registry

Milo CLI registry — tracks installed CLIs for gateway discovery.

(/milo-cli/api/milo/registry/)

schema

Function signature → JSON Schema for MCP tool compatibility.

(/milo-cli/api/milo/schema/)

state

Store, dispatch, saga runner, combine_reducers.

(/milo-cli/api/milo/state/)

streaming

Streaming support for long-running CLI commands.

(/milo-cli/api/milo/streaming/)

templates

Built-in templates and template environment factory.

(/milo-cli/api/milo/templates/)

theme

Theme system for styled CLI output.

(/milo-cli/api/milo/theme/)

verify

Self-diagnosis for agent-built milo CLIs (`milo verify`).

Answers "is this CLI correctly built?" via six checks:

1.

(/milo-cli/api/milo/verify/)

version_check

Non-blocking version check with periodic caching.

(/milo-cli/api/milo/version_check/)
