Overview
In Julep broadly speaking there are two types of steps:Control Flow Steps
These steps control the flow of the task. They are used to create conditional logic, loops, and parallel execution.
Key-Value Steps
These steps are used to get and set values in the task.
Iteration Steps
These steps are used to iterate over a collection.
Conditional Steps
These steps are used to create conditional logic.
Other Control Flow Steps
These steps are used to control the flow of the task.
The steps defined out here are in the YAML format. You can learn more about the YAML format here.
Control Flow Steps
Prompt Step
Send messages to the AI model:YAML
When
auto_run_tools
is set to true
in a prompt step, any tools available to the agent will be automatically executed if the model decides to use them. The results are then fed back to the model to continue processing. This is particularly useful for creating autonomous workflows where the agent can gather information and make decisions without manual intervention.The
response_format
setting allows you to request structured output from the model. There are two main options:type: json_object
- Ensures the model responds with valid JSONtype: json_schema
- Enforces a specific JSON structure defined by a schema
response_format
, make sure to instruct the model to produce JSON in your prompt (via system or user message) for best results. Response format support varies by model provider - check the supported models documentation for compatibility.In the prompt step we offer a bunch of Python functions to help you manipulate data. Here is a list of the functions you can use:
-
Standard library modules:
re
: Regular expressions (safe against ReDoS)json
: JSON encoding/decodingyaml
: YAML parsing/dumpingstring
: String constants and operationsdatetime
: Date and time operationsmath
: Mathematical functionsstatistics
: Statistical operationsbase64
: Base64 encoding/decodingurllib
: URL parsing operationsrandom
: Random number generationtime
: Time operations
-
Constants:
NEWLINE
: Newline charactertrue
: Boolean truefalse
: Boolean falsenull
: None value
Tool Call Step
Execute tools defined in the task:YAML
Evaluate Step
Perform calculations or data manipulation:YAML
In the evaluate step we offer a bunch of Python functions to help you manipulate data. Check out the Python Expressions for more information.
Wait for Input Step
Pause workflow for user input:YAML
Subworkflow Step
Executing a subworkflow from a main workflow:YAML
- The
arguments
passed from the main workflow to the subworkflow are available in thesteps[0].input
of the subworkflow. - The
result
of the subworkflow is available in thesteps[1].output.result
of the main workflow. - The
Input/Output Data References
between steps is exclusive to the workflow they are defined in. A workflow cannot reference theinput
oroutput
of another workflow between the steps. To learn more aboutInput/Output Data References
click here.
Self recursion is allowed in a subworkflow but not in a main workflow.
Key-Value Steps
Get Step
Retrieve values from storage:YAML
Set Step
Store values for later use:YAML
state
object, which can be accessed anywhere in the workflow using state.variable_name
. For example:
YAML
Each subworkflow has its own isolated
state
object. Values set in one subworkflow are not accessible from other subworkflows or the parent workflow.Label Step
Label a step to make it easier to identify and access those values later in any step:YAML
$ steps['label_name'].input.attribute_name
or $ steps['label_name'].output.attribute_name
syntax. For example:
YAML
Iteration Steps
Foreach Step
Iterate over a collection:YAML
Map-Reduce Step
Process collections in parallel:YAML
- By default the
parallelism
if not mentioned is 100. If mentioned, it is the maximum number of steps that can run in parallel concurrently. - When using
over
step, themap
step is executed for each value in the collection. - The
reduce
step is executed after themap
step.
Conditional Steps
If-Else Step
Conditional execution:YAML
Switch Step
Multiple condition handling:YAML
Other Control Flow
Sleep Step
Pause execution:YAML
Return Step
Return values from workflow:YAML
Log Step
Log messages or specific values:YAML
Error Step
Handle errors by specifying an error message:YAML
Example: Complex Workflow
Hereβs an example combining various step types:YAML
Best Practices
Step Organization
- Group related steps logically
- Use comments to explain complex steps
- Keep step chains focused and manageable
Error Handling
- Use if-else for error conditions
- Provide fallback options
- Log important state changes
Performance
- Use parallel execution when possible
- Optimize data passing between steps
- Cache frequently used values
Support
If you need help with further questions in Julep:- Join our Discord community
- Check the GitHub repository
- Contact support at hey@julep.ai