OptionalaffinityMarks this parameter as the affinity key of the function and states how sticky the routing must
be: every call carrying the same value is routed to the same tenant pod (and, for worker, the
same worker) for as long as it is alive. Use it for functions that keep state outside the
request. Only one string parameter of a function may declare it, and declaring it on a
parameter of any other type fails the bundle build.
A value of undefined, null or '' means no affinity at all — the call is routed normally, to
an arbitrary pod. Blank is deliberately not a key: a caller that leaves the parameter empty must
get an instance of its own rather than share one with every other caller that also left it empty.
The value is a namespace within the application, the function's SERVICE and the calling job (falling back to the conversation for callers without one): two agent requests that pick the same value are routed independently, so the value only has to be unique within one request's own calls. That matches where such values come from — a model authoring a session name is told nothing about other requests, and unrelated callers routinely land on the same word. A caller with neither a job nor a conversation gets no affinity at all rather than a namespace shared with every other such caller. Two callers cannot be routed to one instance on purpose by agreeing on a value; a function that needs genuinely shared state needs shared storage, not shared routing.
The domain is the service rather than the single function so that companion functions of one service reach each other's state — a release function must land on the worker whose interpreter its key names, or it would no-op against an empty domain of its own and report success.
The guarantee is routing, not durability: when the pod or worker goes away, so does whatever it held, and the next call lands on a fresh one. The function has to detect that itself and cope.
Description of the parameter's purpose.
OptionalenumList of possible values for the parameter, if applicable.
Name of the parameter.
Indicates if the parameter is mandatory.
Data type of the parameter.
Defines the structure of a parameter for an AI function.