> ## Documentation Index
> Fetch the complete documentation index at: https://docs.generalrobotics.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# program

> Capture a restricted Python function into a staged IR

```python theme={null}
from grid_nexus_program import program
```

```python Signature theme={null}
program(
    fn: Callable[..., Any] | None = None,
    *,
    validate_models: bool = True,
) -> ZenohProgram | Callable[[Callable[..., Any]], ZenohProgram]
```

Capture a restricted Python function into a staged IR.

`Robot` and `Cortex` annotations identify handles that the compiler
understands. They remain ordinary, explicit Python parameters and may
appear anywhere in the signature. All other parameters become program
inputs; annotations on those parameters are optional.
A leading function docstring is preserved on the returned `ZenohProgram`
and is not lowered as an executable statement.

<ParamField body="validate_models" default="True">
  If True (default), every `cortex.run("name", ...)` call is checked against the `grid_cortex_client` registry at compile time — unknown model names, unknown/misspelled keyword arguments, and missing required arguments all raise `ProgramCaptureError`.  Set False for tests that use placeholder model names to exercise graph/codegen mechanics.
</ParamField>


## Related topics

- [Your first skill](/get-started/first-skill.md)
- [Get started](/get-started/installation.md)
- [Your first session](/get-started/first-session.md)
- [The Intelligence Grid for Physical AI](/introduction.md)
