Skip to content

AI tool ​

Exposes a branch of the flow as a tool (function) that an LLM chat client can call. The model decides when to call it, the arguments are sent to the components on Output, and whatever comes back on Input is returned to the model as the tool result.

Pins ​

PinKindTypesDescription
RegisterregisterViaducta.Plugins.Llm.Types.LlmToolRegistrationRequestConnect to the Register pin of one LLM chat client.
Outputoutputtype of the output connectionThe tool call: an object of the connection's type filled with the arguments chosen by the model.
Inputinputtype of the input connectionThe tool result. Connect the last component of the tool branch here.

Configuration ​

FieldTypeDefaultDescription
NamestringemptyTool name the model sees, e.g. order_status (use letters, digits, _; unique per chat client).
Instructionsmulti-line textemptyTool description for the model: what it does, when to use it, what the arguments mean.
Timeoutinteger seconds30Maximum time for the branch to deliver a result; 0 means 24 hours.

Behaviour ​

  • When the flow starts, the tool registers with every chat client its Register pin is connected to.
  • Arguments schema: generated from the type on the Output connection - its public properties become the tool's parameters (strings, numbers, booleans, dates as strings, enums as strings, lists as arrays, nested types as objects). Result schema: generated from the type on the Input connection.
  • On a tool call, a new object of the Output type is created, each argument is converted to the property type and set (unknown arguments are skipped with a warning), and the object is emitted on Output with new metadata containing LlmToolInvokeData (ToolInvokeRequestId, LlmToolRegistryKey).
  • When a message arrives on Input, the metadata identifies the pending call and the message is returned to the model as the result. The chat client waits at most Timeout seconds; then the model gets an error text instead.

Notes ​

  • Keep the metadata: the branch between Output and Input must pass on the metadata it received (normal plugins do). A result without LlmToolInvokeData raises "The Llm tool metadata is null".
  • Every call must produce exactly one message on Input; a filtered or failed branch makes the model wait for the timeout. Exceptions in the branch are returned to the model as an error.
  • Both Output and Input must be connected before the flow starts; without an Output connection a tool call fails ("has no connected Output pin").
  • Connect a tool to one chat client only: when connected to several, each call is emitted on Output once per connected client.
  • The model only sees Name, Instructions and the property names/types; name properties clearly (OrderNo, not P1).

Example ​

json
{ "Name": "order_status", "Instructions": "Returns the status and delivery date of an order. Call it when the user asks about an order. Argument OrderNo is the order number, e.g. 2024-0001.", "Timeout": 20 }

LLM chat client ← (Register) AI tool → (Output, type OrderQuery) Database reader → Data mapper (type OrderStatus) → AI tool (Input)

Viaducta documentation