Input Data in Agent Catalyst Workflows
Agent Catalyst workflows can leverage input data in two main ways to process and generate meaningful outputs:
Static Data: Predefined and embedded directly in the workflow.
User Input: Dynamically provided by the user at runtime.
Static Data
Static data is defined in the workflow’s frontmatter metadata using the data
field. These values are accessible throughout the workflow during execution.
Example: Static Data
yaml ---
data:
quote: "The only limit to our realization of tomorrow is our doubts of today."
langs:
- Spanish
- Italian
- German
- French
---
<Loop
as="translations"
until={$.index === langs.length}
provide={{ langs, quote }}>
Translate "{quote}" into {langs[$.index]}.
<GenText as="translation" model="openai:gpt-4o" />
</Loop>
Accessing Data: Reference static data fields like
quote
orlangs
using{}
syntax, e.g.,{quote}
or{langs}
.Complex Structures: Data can include simple strings, nested objects, or arrays.
User Input
User inputs allow workflows to be reusable by prompting for specific input values during execution. Inputs are defined using the input
field in the frontmatter metadata.
Example: User Input
yaml ---
data:
langs:
- Spanish
- Italian
- German
- French
input:
quote:
type: text
message: "Enter a quote you'd like to translate:"
---
<Loop
as="translations"
until={$.index === langs.length}
provide={{ langs, quote }}>
Translate "{quote}" into {langs[$.index]}.
<GenText as="translation" model="openai:gpt-4o" />
</Loop>
Dynamic Prompts: The user is prompted to input a quote during execution.
Reusability: The workflow adapts to different inputs without modification.
Input Types
Agent Catalyst supports diverse input types for flexible user interaction. Inputs are specified as key-value pairs under the input
field.
1. Text Input
Prompts the user for a single-line or multi-line text.
Field
Type
Description
Required
type
string
Must be "text"
.
✅
message
string
Prompt displayed to the user.
✅
multiline
boolean
Allows multi-line input (default: false
).
❌
Example:
yaml quote:
type: text
message: "Enter your favorite quote:"
multiline: false
2. Select Input
Prompts the user to choose from a list of options.
Field
Type
Description
Required
type
string
Must be "select"
.
✅
options
array
List of options (strings or objects).
✅
Example:
yaml language:
type: select
message: "Select a language for translation:"
options:
- Spanish
- French
- German
3. File Input
Prompts the user to upload a file or specify a file path.
Field
Type
Description
Required
type
string
Must be "file"
.
✅
fileType
string
File type ("text"
or "image"
).
✅
Example:
yaml upload:
type: file
fileType: text
message: "Upload a text file for processing:"
4. Array Input
Prompts the user to enter multiple text values, which are returned as an array.
Field
Type
Description
Required
type
string
Must be "array"
.
✅
multiline
boolean
Allows multi-line input.
❌
Example:
yaml languages:
type: array
message: "Enter a list of languages for translation:"
multiline: true
Variable Naming Rules
Uniqueness: All variable names (from inputs or actions) must be unique within the workflow. Duplicate names will cause a compilation error.
Nested Scopes: Variables can be reused within nested scopes (e.g., within
<Loop />
or<Cond />
).
Example of Block Scoping:
yaml <Loop
as="outer"
until={$.index === items.length}
provide={{ item: items[$.index] }}>
Item: {item.name}
<Loop
as="inner"
until={$.index === item.subitems.length}
provide={{ subitem: item.subitems[$.index] }}>
Subitem: {subitem.name}
</Loop>
</Loop>
In this example:
item
andsubitem
are scoped to their respective loops.Parent variables must be explicitly passed using
provide
.
Last updated