Table of Contents

Per-function settings (llmcpp)

Per-function settings override generation policy for a single annotated definition. They are written inside the __llm__ modifier rather than changing every generated function in a compilation.

__llm__(max_attempts(2), timeout(120))
int twice(int value)
{
    Return twice value.
}

Environment variables provide defaults, command-line settings override those defaults, and function settings override the corresponding driver settings. This lets a particular function use a different model, agent, prompt file, cache policy, or generation budget.

Numeric budgets require positive integer literals, with documented exceptions such as zero cache lifetime meaning no expiry. File-backed settings resolve paths from the compiler's working directory. Their contents can affect cache identity, so changing instructions or references can require generation again.

Some combinations are rejected, including no_cache with an explicit cache key. Settings also have distinct meanings: context attaches reference material, while append_prompt adds instructions. The resolved settings are supplied to the generation session, allowing the compiler and agent to agree on the policy for that target.