Return Response

The terminal node that ends an execution as completed and answers the caller — with what the model said, the input, a fixed object or the output of a node.

3 min read

Return Response ends a path with an answer. The execution that reaches it is completed, and the caller gets the answer the node is set to give in output.

Node
Return Response
Type
return_response
Category
Output
Ports
None
Ends the path
Yes

What it does

The node takes its answer from its source, makes it the output of the execution, and ends the execution as completed. Nothing runs after it.

Answer withThe answer
Last model outputThe last answer on the path: what the last AI Model answered, or the stored answer of a Cache Lookup that hit, whichever came later. With neither on the path, an empty object
Request inputThe input of the request, as it came
Fixed valueAn object stored in the node
Output of a nodeThe whole output of the node you choose — most often what a Transform built

When the answer is the stored one of a Cache Lookup that hit, the execution carries cache.hit set to true. An answer from a model called after the hit is a paid one, and cache.hit is false.

When to use it

Every path that answers the caller ends here. A path that refuses ends at Reject Request instead. A flow may have several of each: one for each way it ends.

Settings

SettingWhat it is for
sourceWhere the answer comes from — last_model_output, the last answer of a model on the path; input, the input of the request; literal, the object in value; node, the output of the node in node_key. A node without a source answers with the last model output.
valueThe object to answer with when the source is literal. It is written through the API.
node_keyThe key of the node whose whole output is the answer when the source is node — another node of the flow, not a terminal one.

In the builder the setting is Answer with. A new node answers with the last model output. A fixed value is written through the API: the builder does not edit it. With the source Output of a node the node names the other node by its key:

JSON
{ "source": "node", "node_key": "build" }

Ports

The node has no ports: it ends the path. Ports and branching says why every path ends at a terminal node.

Output

The answer is the output of the execution — what Send a request reads. An answer with no keys reaches the caller as {}.

Errors

The node raises no error. When it answers with the output of a node the execution did not pass, the answer is an empty object, and a warning event of the trace names the path.

JSON
{ "type": "warning", "node_key": "answer", "payload": { "reason": "unknown_path", "paths": ["nodes.build.output"] } }

The setting is checked when the flow is validated and when it is published: the source is one of the four, a fixed value is an object, and a named node is another node of the flow that is not a terminal one.

In the API an entry of issues names such a check in params.detail; its code is invalid_node_config.

CheckMessage in the builder
return_unsupported_source“{node}” answers with a source that does not exist.
return_literal_not_object“{node}” answers with a fixed value, and that value must be an object.
return_needs_node“{node}” answers with the output of a node and has to name another node of the flow.
return_unknown_node“{node}” answers with the output of “{ref}”, but the flow has no node “{ref}”.
return_terminal_node“{node}” answers with the output of “{ref}”, but “{ref}” ends the flow itself and never runs before this answer. Name a node that runs earlier.

Example

  • Request — Default → AI Model
  • AI Model — Success → Return Response
  • AI Model — Deny → Reject Request

Return Response answers with what the model said, and the execution is completed. A refused call goes to Reject Request, and that execution is rejected.

Built from openapi b070e1f, sdk contract 5cc7055, php ae4a53b, node 84bc62d