Files
app/docs/concepts/values.md
T
stroblmeandClaude Opus 5.5 f5be932df3 Flow inputs carry an origin hint, run or panel
The Inputs editor and the canvas label show it, and the run forms leave
panel inputs out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WgBfkm4rCmtd1T4vHWjEPx
2026-10-15 10:08:46 +02:00

63 lines
2.3 KiB
Markdown

# Where a node's values come from
Function nodes receive values as named arguments. Each comes from a message
port, a node setting or a Python default.
## Ports: what the graph carries
A port binds to a message name and reads its current value. Declare inputs
`reading` and `setpoint`, and output `heat`:
```python
def process(reading, setpoint):
return {"heat": reading < setpoint}
```
Matching message names connect nodes. A port can have a different name from
its message: bind port `reading` to `house.temperature`, for example.
## Settings: constants of this node
Use settings for values that stay fixed while the flow runs: units, retries,
thresholds. Add them in the Function node's **Settings** section; they are
stored with the flow and passed beside the ports:
```python
def process(reading, unit="C"):
return {"shown": reading if unit == "C" else reading * 1.8 + 32}
```
With a `unit` setting, its configured value is passed to the function. Without
one, the Python default applies. A setting cannot share a name with a port.
Changing a setting edits the flow draft, so publish it to apply the change.
For a value that should change at runtime, use a message. To share a constant
between nodes, publish it from one node and let the others consume it.
## Flow inputs: what arrives from outside
Dashboard controls, the API and batch runs can supply messages without a
producer node. Declare them as **Inputs** in the flow settings:
```json
{"inputs": [{"spec": {"name": "setpoint", "dtype": "float"}, "initial": 21.0}]}
```
The initial value seeds an unset live message. Later publications take over;
changing the starting value does not overwrite a value already in state.
Use **Publish this value now** in the input row to send it immediately.
The canvas draws flow inputs as labelled endpoints, marked `run` or `panel`
by what writes them. A panel input is one a dashboard or panel control writes,
and the run form does not ask for it. Without a producer or declared input, a
consuming node reports `unconnected_input`.
A batch flow's inputs are run parameters. Its **Result** section selects the
messages returned when the run finishes. See [Runs](runs.md).
## See also
- [Flows, nodes and messages](flows.md)
- [Keeping state in a flow](state.md)
- [Writing node code](../code/nodes.md)