Value Declarations
In AI JSON, inputs to actions can be:
- links to other actions’ outputs (
link
) - external variables (
var
) - jinja templates (
text
) - lambda functions (
lambda
) - environment variables (
env
)
Link: link
A way to reference the output of another action.
Linked actions will always run before the action that references them.
If the output of an action is a pydantic model, you can reference its attributes:
Variable: var
A way to pass external values directly to action inputs.
When running the flow in code, you can pass the value of my_variable
as a keyword argument:
Text: text
A way to evaluate jinja templates.
If a template variable ({{ name }}
above) corresponds to another action’s output, it is treated as a link. Otherwise, it is treated as a variable.
If an action’s input is a string, you may omit the text
declaration; it will be evaluated as a jinja string by default:
Note, AI JSON jinja templates are evaluated in a native jinja environment.
Lambda: lambda
A way to evaluate a python expression.
If a variable (x
above) corresponds to another action’s output, it is treated as a link. Otherwise, it is treated as a variable.
Environment: env
A way to reference environment variable values.