yr.app

app(
    fn: Callable | None = None,
    name: str | None = None,
    description: str | None = None,
    model: LLMContext | None = None,
    sys_prompt: str | None = None,
) → AppFunctionWrapper | Callable[[Callable], AppFunctionWrapper]

Decorator that turns a Python function into a Yera app.

Usable bare (@app) or with keyword arguments (@app(name=..., model=..., sys_prompt=...)). The wrapped function's signature is validated against Yera's supported type system at decoration time; arguments and return values are coerced at call time.

Parameters

fn
type: Callable | None = None

The function being decorated when used bare. Left as None when the decorator is invoked with arguments.

name
type: str | None = None

Display name for the app. Defaults to the function's __name__.

description
type: str | None = None

Optional human-readable description recorded in the app metadata.

model
type: LLMContext | None = None

Optional LLMContext entered for the duration of each run. Falls back to the active profile's default model if omitted.

sys_prompt
type: str | None = None

Optional system prompt emitted once the model context is entered.

Returns

type: AppFunctionWrapper | Callable[[Callable], AppFunctionWrapper]

An AppFunctionWrapper callable that runs the function under the Yera event-stream runtime when invoked. When called with arguments (fn is None), returns a decorator that produces the wrapper.