# Simple prompt- prompt: What is your name?# Multi-message prompt- prompt: - role: system content: You are a helpful assistant - role: user content: "Hello!"# Prompt with settings- prompt: - role: user content: Generate a creative story settings: model: "claude-3.5-sonnet" temperature: 0.8
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:
# Subworkflowsubworkflow:- evaluate: main_workflow_input: $ _.content # you can use steps[0].input.content to access the input of the subworkflow- return: result: "This is the subworkflow"# Main workflowmain:# Step 0: Evaluate step- evaluate: result: "This is the main workflow"# Step 1: Call the subworkflow- workflow: subworkflow # name of the subworkflow arguments: # input to the subworkflow content: $ _.result # you can use steps[0].output.result to access the result of the previous step# Step 2: Evaluate step- evaluate: subworkflow_result: $ steps[1].output.result # this will be the result of the subworkflow
The arguments passed from the main workflow to the subworkflow are available in the steps[0].input of the subworkflow.
The result of the subworkflow is available in the steps[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 the input or output of another workflow between the steps. To learn more about Input/Output Data Referencesclick here.
Self recursion is allowed in a subworkflow but not in a main workflow.
# Set a single value- set: user_name: John# Set multiple values- set: count: $ len(_.results) has_data: $ _.count > 0
Values stored using the set step are added to the workflow’s global state object, which can be accessed anywhere in the workflow using state.variable_name. For example:
Label a step to make it easier to identify and access those values later in any step:
YAML
# Step 0: Set a single value- set: user_name: John label: get_user_name# Step 1: Set multiple values- set: count: $ len(_.results) has_data: $ _.count > 0 label: get_count_and_has_data
In any steps following the label step, you can access the values set in the label step using the $ steps['label_name'].input.attribute_name or $ steps['label_name'].output.attribute_name syntax. For example:
# yaml-language-server: $schema=https://raw.githubusercontent.com/julep-ai/julep/refs/heads/dev/schemas/create_task_request.jsonname: Multi-Step Task Demonstrationdescription: A demonstration of multi-step task processing with research and summarization capabilities.############################################################################################################# INPUT SCHEMA #####################################################################################################################input_schema: type: object properties: topic: type: string description: The topic to research and summarize.############################################################################################################# TOOLS ############################################################################################################################# Describing the tools that will be used in the workflowtools:- name: web_search type: integration integration: provider: brave setup: api_key: "YOUR_BRAVE_API_KEY"############################################################################################################# MAIN WORKFLOW ####################################################################################################################main:# Step 0: Generate initial research questions- prompt: - role: system content: >- $ f''' You are a research assistant. Your task is to formulate three specific research questions about the given topic: {steps[0].input.topic}''' unwrap: true# Step 1: Web search for each question- foreach: in: $ _.split('\\n') do: tool: web_search arguments: query: $ _# Step 2: Extract relevant information- evaluate: relevant_info: $ [output for output in _]# Step 3: Process and summarize information- if: $ len(_.relevant_info) >= 3 then: prompt: - role: system content: >- $ f''' Summarize the following information about {steps[0].input.topic}: {_.relevant_info}''' unwrap: true else: prompt: - role: system content: >- $ f''' Not enough information gathered. Please provide a brief overview of {steps[0].input.topic} based on your knowledge.''' unwrap: true# Step 4: Record the summary- log: >- $ f''' Summary for {steps[0].input.topic}: {_}'''# Step 5: Prepare final output- return: summary: $ _ topic: $ steps[0].input.topic