Interface: IGatewayRunInput<TStructured>
Defined in: types.ts:551
Input of run(): an agent run with tools (D104). Everything of IGatewayAskInput, plus the tools of this call.
Extends
IGatewayAskInput<TStructured>
Type Parameters
TStructured
TStructured = unknown
Properties
abortSignal?
optionalabortSignal?:AbortSignal
Defined in: types.ts:524
Stops the call when it is aborted: the user pressed "stop", the HTTP request closed, the app gave up.
One signal ends the model call in flight, the agent loop and the tools, and the tenant stops paying.
The call returns FAILED with the reason "The call was aborted" and one ERROR issue with the code call_aborted; nothing is
thrown. A signal of AbortSignal.timeout counts as a deadline: "The call timed out", call_timed_out. What the call stored
before the stop stays: the user turn, and in a run the steps that completed (the tools did run; a tool call the abort cut
gets an error result); no answer is stored, an aborted run never pauses. Combined with timeoutMs when both are given: the
first one that fires wins.
An abort is cooperative for a tool: the gateway aborts the tool's abortSignal and stops waiting; a tool that ignores it
runs to its end, and an abort never undoes what a tool already did.
Examples
controller.signal - an `AbortController` the UI aborts on its "stop" button
signalOfTheRequest - the signal of the incoming HTTP request, so a closed tab ends the call
Inherited from
activeTools?
optionalactiveTools?:string[]
Defined in: types.ts:556
The tools this call offers the model, by name — narrows what the profile and the user's permissions allow, never widens it
(a name outside that set is a 400). Omit for all of them; [] for none (D48).
additionalTools?
optionaladditionalTools?:IToolDef<unknown,unknown>[]
Defined in: types.ts:563
Tools added for this call, on top of the registry's (D66). The app passes them, so they are allowed without the
profile's allowedTools; permissions, the tool's policy (D87), the profile's approvals, timeout and output cap apply as
for every tool. A name that exists in the registry, or twice here, is a 400. A run that pauses stores their names only:
resume() must receive the same additionalTools again.
context?
optionalcontext?:string
Defined in: types.ts:450
Data of the app about the situation of this call, placed in the system prompt after instructions.
Shows the model what the user is looking at, which it cannot see otherwise.
Use it for the open record, the selection or the step of a wizard. Rendered under a "data, not instructions" label, like
memory and knowledge base, because it often carries user-typed values. Not for documents (knowledge base) or for lasting
facts about the user (memory). Same lifetime as instructions.
Examples
"Invoice 4711, customer Nordwind GmbH, status OVERDUE, due 2026-09-30, open amount 1 250 EUR" - the invoice on screen
"Wizard 'New order', step 2 of 4: delivery address" - where the user is in a flow
See
docs/60-architecture/40-system-prompt-production-layers.md
Inherited from
debug?
optionaldebug?:boolean
Defined in: types.ts:547
Attach the model-side transcript to the answer (IAnswerResponse.debug) for debugging. It carries the system prompt
and every tool output, so it is large and sensitive; never pass it through to an end user.
Default
false
Inherited from
files?
optionalfiles?:IFileRef[]
Defined in: types.ts:466
Already stored through uploadFile().
Inherited from
instructions?
optionalinstructions?:string
Defined in: types.ts:435
Instructions of the app for this call, placed in the system prompt after the profile's promptAddendum.
Lets one screen, button or user role steer the model without a profile per case.
Use it for a rule that holds for this call only. A rule for every call of a tenant belongs in IAIProfile.promptAddendum;
the user's own words belong in prompt. Given to the model as instructions: the app is trusted code.
Not stored: a paused run keeps its system prompt, so resume() takes none; pass it again on the next call that needs it.
Examples
"Summarise the invoice in three bullet points." - the "Summarise" button of the invoice screen
"The user is an administrator: you may mention internal notes." - the same screen, opened by an admin
See
docs/60-architecture/40-system-prompt-production-layers.md
Inherited from
kbFilters
kbFilters:
IChunkFilters
Defined in: types.ts:495
The knowledge-base scope of the call: the libraries and books it may search. Required: the caller decides it on every call.
No KB for this call: {libraryIds: [], bookIds: []}. Every library of the tenant: {libraryIds: "all", bookIds: []}.
Inherited from
kbRetrieval?
optionalkbRetrieval?:IKbRetrievalOptions
Defined in: types.ts:507
Per-call overrides of the retriever's k and minScore (IKbRetrieverConfig), for a question that needs more or fewer
chunks than the gateway's default.
kbFilterssays where to search; this says how much of what is found reaches the prompt.
Omit it for the config's values. Not read on a resume: a resumed run keeps the chunks of its first step (D36).
Examples
{k: 10} - a question that spans several documents
{minScore: 0.7} - a sensitive use case: a wrong chunk in the prompt is worse than "not in the knowledge base"
Inherited from
outputFormat?
optionaloutputFormat?:EOutputFormat
Defined in: types.ts:474
How the text answer is formatted. Ignored when outputSchema is given: the schema fixes the shape (D42).
Default
EOutputFormat.MARKDOWN
Inherited from
outputSchema?
optionaloutputSchema?:ZodType<TStructured,unknown,$ZodTypeInternals<TStructured,unknown>>
Defined in: types.ts:468
Zod schema for a structured answer.
Inherited from
profileId
profileId:
string
Defined in: types.ts:418
The profile this call runs on: its model, tools, approvals and limits (D46, D103).
Chosen per call, never stored on the thread, so the next call of the same thread may run on another profile. The application resolves the user's choice, or its own fallback when the user picked none, to an id before the call: the gateway knows no default profile.
Example
"claude" - the profile the user picked in the model menu
Inherited from
prompt
prompt:
string
Defined in: types.ts:420
The user's own words: the message of this turn, stored as the user turn and sent to the model.
Inherited from
skills?
optionalskills?:ISkill[]
Defined in: types.ts:464
Instructions the model may load for this call, on top of the profile's skills (D124).
What one screen or flow knows and the model should read only when the task needs it.
run(): listed by name and description in the system prompt with the profile's; the model loads a body with the built-in
dyna_aigw_load_skill tool (one model step per load, under maxStepsPerRun). ask(): the bodies are inlined in the prompt; no
tool. A name that is also in the profile's skills, or twice here, is a 400 before anything is stored. A run that pauses
stores them: resume() takes none. Not for a rule of every call (IAIProfile.skills, promptAddendum), nor for the
rule of this one call that the model must always read (instructions).
Example
[{name: "export_wizard", description: "How the CSV export works and its limits", body: "…"}] - the help text of the screen the user is on
Inherited from
temperature?
optionaltemperature?:number
Defined in: types.ts:490
Sampling temperature of the main model call; omit for the provider's default.
Scales the randomness of each token draw: 0 = the most likely token every time (repeatable, fewest inventions),
higher = more varied and more creative. Not a knowledge knob: a wrong answer at 0 is still wrong, only consistent.
Valid range is the provider's (OpenAI 0–2, Anthropic 0–1); a value outside it fails the call at the provider.
Only on a model whose registry entry has caps.temperature: the call is refused (400) before anything is stored when the
profile's model does not accept one (D82). The OpenAI reasoning models (GPT-5 family) do not.
| Call | Temperature |
|---|---|
| Extraction, classification | 0 |
| Factual answer over KB chunks | 0 – 0.3 |
| Open conversation | 0.5 – 0.7 |
| Creative drafts, brainstorming | 0.8 – 1.0 |
Inherited from
threadId?
optionalthreadId?:string
Defined in: types.ts:408
Existing thread of the calling user, or omit to create one. A thread of another user of the tenant is a 404, like an unknown one.
Inherited from
timeoutMs?
optionaltimeoutMs?:number
Defined in: types.ts:540
Deadline of the whole call in milliseconds, model calls and tools included.
A call that does not answer in time is stopped, not left running at the tenant's cost.
Past it the call returns FAILED with the reason "The call timed out after N ms" and one ERROR issue with the code
call_timed_out; everything in flight is aborted as with abortSignal. Independent of the per-model-call timeout
(ILLMClientConfig.timeoutMs) and the per-tool timeout (IToolDef.timeoutMs): those cap one call or one tool, this caps
the sum. Two waits do not take the signal yet and overrun it: the knowledge-base search (query rewrite, embedding) and a
tool's policy predicate; a deadline that passes during them is seen when they return. Must be a positive integer up to
2 147 483 647 (Node's largest timer); the call is refused with a 400 before anything is stored otherwise.
Examples
30_000 - a chat answer the user is waiting for on screen
240_000 - an agent run with several tools, under the thread lease (`IThreadStoreConfig.leaseMs`, 300 000 by default)
Inherited from
userContext
userContext:
IUserContext
Defined in: types.ts:406
Who is asking; scopes every read and write of the call.