Skip to content

Ask options — timeouts, params, system message

Set a timeout for provider requests, attach provider-specific parameters to an intent, or add system text to every prompt. This page covers each option and where it takes effect.

nola.config.ts
import { openai } from "@nola-lang/providers";
import { defineConfig } from "@nola-lang/runtime";
export default defineConfig({
model: openai({ model: "gpt-5-mini" }),
ask: { timeoutMs: 60_000 }, // per-invocation; 0 disables
});
  • ask.timeoutMs is the default per-invocation timeout (60 000 ms when unset). It is the root frame’s abort signal: when it elapses, every provider call in that invocation receives the signal. 0 disables it.
  • .withTimeout(ms) on the intent an infer function returns overrides it for that invocation. On a single ask inside a body — ask (..…: T).withTimeout(ms) — it bounds just that ask, next to the invocation’s clock: whichever fires first wins. See Intent methods.
  • The timeout bounds provider round trips only. Once a call intent’s arguments are filled, the callee’s own promise runs to completion, the same as a plain await fn() in your code.

Attach request parameters with .withParams():

tuned.tsi
export infer function tagline(.product: string) {
return ask (..`a creative tagline`: string).withParams({
temperature: 0.9,
maxOutputTokens: 200,
providerOptions: { reasoning: { effort: "low" } }, // passed through to the provider untouched
});
}
  • temperature and maxOutputTokens are typed fields. Use providerOptions for other JSON-serializable options; Nola passes them to the provider’s complete() method unchanged.
  • Chaining .withParams() merges fields, with later values taking precedence. providerOptions merges by key. The same rule applies across nested frames: the nearest value wins.
  • Params are part of the ask fingerprint. Changing them creates a different replay entry. See Record and replay.

The built-in openai, anthropic and google providers currently ignore these params when making requests. With those providers, .withParams({ temperature: 0.9 }) changes the fingerprint but does not change the response settings. A custom provider can read them from request.params. For an Anthropic output limit, use the factory’s maxOutputTokens option instead; see Providers.

nola.config.ts
import { openai } from "@nola-lang/providers";
import { defineConfig } from "@nola-lang/runtime";
export default defineConfig({
model: openai({ model: "gpt-5-mini" }),
system: { message: "Answer in British English." },
});

system.message replaces Nola’s default system text on every ask; import DEFAULT_SYSTEM from @nola-lang/providers to keep it and add to it. Use it for guidance that applies throughout the app, such as tone or policy. Put guidance for a particular function or ask in its instruction.

Next: Environments and secrets