Skip to main content
The code panel. Edit the entire flow directly as a YAML manifest

The code panel. Edit the entire flow directly as a YAML manifest

How It Works

Direct coding creation gives you complete control over your flows by writing YAML manifests directly. This method offers:
  • Full control over every aspect of your flow
  • Ability to create complex workflows
  • Integration with custom tools and APIs
  • Precise control over execution order and conditions
  • Advanced features like conditional execution and loops

Writing Your Own Manifest

To create a manifest:
  1. Define an id and name for each step.
  2. Choose the appropriate tool, such as INPUT_JSON or PYTHON_SANDBOX.
  3. Specify input values under input.
  4. List dependencies using needs to ensure correct execution order.
By following this structure, you can build a clear, modular workflow for processing data efficiently.

Step Components

Each step in a Jinba Flow manifest is composed of several key components that define its behavior and relationship with other steps. Here’s a detailed breakdown:

1. Basic Step Structure

Each field serves a specific purpose:
  • id: Required unique identifier for referencing the step
  • tool: Required name of the tool to execute (must be one of the available tools)
  • input: Required list of input parameters specific to the tool
  • config: Optional tool-specific configuration (e.g., API tokens, temperature for LLM)
  • needs: Optional list of step IDs that must complete before this step runs
  • when: Optional condition that must evaluate to true for the step to execute
  • forEach: Optional field to execute the step multiple times over a collection

2. Configuration

Used to set tool-specific settings:
Example:

3. Dependencies

Specify which steps must complete before this step can run:
Example:

4. Conditional Execution

Control whether a step should run based on conditions:
Examples:

5. Loop Execution

Execute a step for each item in a collection:
Example:

6. Result Reference

Reference results from previous steps:

Important Notes

  • Step IDs: Must be unique within the workflow
  • Dependencies:
    • Create an implicit execution order
    • Can form complex graphs (including diamond patterns)
    • Circular dependencies are not allowed
  • Conditions:
    • Support basic comparisons and logical operators
    • Can reference results from previous steps
    • Evaluated before step execution
  • Variable References:
    • Use {{steps.step_id.result}} to access previous step results
    • Use {{secrets.SECRET_NAME}} to access configured secrets
    • Use {{item}} in forEach loops to access the current item
  • YAML Syntax:
    • Use | for a multi-line string until the indentation ends.

Jinja2 Template Syntax

Jinba Flow supports Jinja2 templating for dynamic value generation and complex logic in manifest files. This powerful feature allows you to create more flexible and reusable workflows. When using templates, you have access to:
  • steps: Results from previous steps
  • item: Current item in forEach loops
  • secrets: Configured secrets
  • Built-in functions like zip(), range(), etc.
Use {%- and -%} to control whitespace in the output, where the - removes whitespace before or after the block.

Basic Syntax

  1. Variable Interpolation
  1. Control Structures
  1. Accessing Step Results

Common Use Cases

  1. Processing Lists
  1. Conditional Logic
  1. Combining Multiple Lists

Common Patterns

  1. Filtering Lists
  1. Setting Default Values
  1. String Manipulation

Example Manifest

Below is an example manifest that processes numerical data through multiple steps:

Breakdown of Each Step

1. Input Data (input_data)

  • Uses the INPUT_JSON tool to define an array of numbers [1, 2, 3, 4, 5].

2. Branch A1 (branch_a1)

  • Uses PYTHON_SANDBOX to compute the sum of even numbers from input_data.
  • Depends on input_data.

3. Branch A2 (branch_a2)

  • Doubles the result from branch_a1.
  • Depends on branch_a1.

4. Branch B1 (branch_b1)

  • Computes the sum of odd numbers from input_data.
  • Depends on input_data.