← Back to Home

InputProcess API Reference

This document specifies the exact JSON structure required to define Processes in Juggernaut. All schemas enforce strict typing—every property must have a description field.

Root Schema: InputProcess

{
  "name": string,                    // Process identifier
  "description": string,             // Purpose and functionality
  "defaultModel": string,            // Format: "provider-model-name"
  "inputs": InputProcessInput[],     // Runtime parameter schema
  "defaultState": Record<string, any>, // Initial state values
  "pipelines": InputPipeline[]       // Execution pipelines (array order = execution order)
}

InputProcessInput

{
  "name": string,           // Variable name (camelCase)
  "type": "string" | "number" | "boolean" | "array" | "object",
  "description": string,    // Required: explains purpose to end users
  "required": boolean      // Whether input must be provided at execution
}

Pipeline Schema: InputPipeline

{
  "name": string,           // Unique identifier
  "description": string,    // Purpose of this execution phase
  "type": "sync" | "async" | "conditional",
  "steps": InputPipelineStep[],
  "conditions"?: {          // Required only if type: "conditional"
    [expression: string]: number | string,  // Target pipeline index or name
    "default": number | string              // Fallback target (required)
  }
}

Execution Flow:

  • sync/async: After completion, execution proceeds to pipelines[index + 1]
  • conditional: Evaluates expressions in key order, jumps to first match, executes target pipeline, then continues sequentially from target index
  • Termination: Process ends when last array index completes

Step Schema: InputPipelineStep

LLM Task Type

{
  "name": string,           // Step identifier (unique within pipeline)
  "outputName": string,     // State variable to store result (supports modifiers: "append:", "updateindex:")
  "type": "Standard" | "Iterative",
  "iterations"?: number | string,  // Required if Iterative. Use "@array.length" for dynamic
  "taskType": "LLM",
  "messages": InputPipelineMessage[],
  "options": {
    "outputFormat": "json" | "text",
    "outputSettings": JSONSchema,  // Required if outputFormat: "json"
    "temperature"?: number,        // 0-2, default varies by model
    "maxTokens"?: number,          // Upper bound for response length
    "webSearch"?: boolean          // Enable real-time data retrieval
  }
}

Plugin Task Type

{
  "name": string,
  "outputName": string,
  "type": "Standard",       // Plugins typically run once per pipeline
  "taskType": "Plugin",
  "plugin": string,         // Plugin nickname (e.g., "mongodb-connector")
  "operation": string,      // Operation name (e.g., "find", "insert")
  "data": Record<string, any> | string  // Operation parameters
}

Message Schema: InputPipelineMessage

{
  "name"?: string,          // Optional identifier for debugging
  "type": "system" | "user" | "assistant",
  "content": string         // Template string with {{variable}} syntax
}

Template Syntax:

  • {{variableName}} - State variable
  • {{nested.property}} - Object path
  • {{array.0.field}} - Array index
  • {{STEPLOOP(collection)}} - Current iteration item (Iterative steps)
  • {{SYSTEM:STEPINDEX}} - Current iteration number (0-based)
  • {{collection.length}} - Array size

OutputSettings JSON Schema Requirements

When outputFormat is "json", you must provide outputSettings following JSON Schema Draft 7. Every property must include a `description` field.

Example: Complex Nested Schema

{
  "outputFormat": "json",
  "outputSettings": {
    "type": "object",
    "description": "Market analysis results",
    "properties": {
      "marketSize": {
        "type": "number",
        "description": "Total addressable market size in USD millions"
      },
      "competitiveLandscape": {
        "type": "object",
        "description": "Competitor analysis breakdown",
        "properties": {
          "keyPlayers": {
            "type": "array",
            "description": "Major competitors identified",
            "items": {
              "type": "object",
              "description": "Competitor profile",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "Company name"
                },
                "marketShare": {
                  "type": "number",
                  "description": "Percentage of market controlled (0-100)"
                },
                "threatLevel": {
                  "type": "string",
                  "description": "Competitive threat assessment: low, medium, high"
                }
              }
            }
          },
          "barriersToEntry": {
            "type": "array",
            "description": "Obstacles for new market entrants",
            "items": {
              "type": "string",
              "description": "Specific barrier description (e.g., regulatory, capital)"
            }
          }
        }
      },
      "recommendation": {
        "type": "string",
        "description": "Strategic recommendation: enter, monitor, or avoid"
      }
    }
  }
}

Conditional Pipeline Expressions

Expressions use $ prefix and support comparison operators.

Syntax Rules

$variable == value          // Equality (strings without quotes)
$variable != value          // Inequality
$variable > number          // Greater than
$variable < number          // Less than
$variable >= number         // Greater than or equal
$variable <= number         // Less than or equal
$nested.property == value   // Dot notation access
$variable                   // Truthy check (exists and not false/0/null)

Example: Multi-Branch Routing

{
  "name": "Priority Router",
  "type": "conditional",
  "conditions": {
    "$riskScore > 0.8": 3,           // Jump to high-risk pipeline
    "$marketSize > 1000000": 4,       // Jump to enterprise pipeline
    "$priority == critical": "urgentPipeline", // Jump by name
    "default": 2                       // Jump to standard processing
  }
}

Evaluation Order:

  1. Checks $riskScore > 0.8
  2. If false, checks $marketSize > 1000000
  3. If false, checks $priority == critical
  4. If false, executes default

State Modifiers Deep Dive

Append Modifier

Syntax: outputName: "append:existingVariable"

Behavior by Type:

  • String: Concatenates new text to existing string
  • Object: Merges properties (newer values overwrite existing keys)
  • Array: Pushes new element to end of array

Use Case: Accumulating results across iterations or building documents piece by piece.

Update Index Modifier

Syntax: outputName: "updateindex:arrayVariable"

Behavior: Only valid for array-typed state variables. Replaces element at specific index.

Advanced Usage: Combine with {{SYSTEM:STEPINDEX}} for precision array manipulation during iterations.


Validation Checklist

Before uploading a Process JSON:

  • [ ] pipelines array has minimum 1 element
  • [ ] Pipeline type is exactly "sync", "async", or "conditional" (lowercase)
  • [ ] Step type is exactly "Standard" or "Iterative" (PascalCase)
  • [ ] iterations field present only when type: "Iterative"
  • [ ] taskType is exactly "LLM" or "Plugin" (PascalCase)
  • [ ] messages array has ≥1 item when taskType: "LLM"
  • [ ] plugin, operation, and data present when taskType: "Plugin"
  • [ ] Conditional pipelines include default key in conditions
  • [ ] Expression strings use $variable syntax (not @)
  • [ ] No quotes around string values in conditions ($type == critical not $type == "critical")
  • [ ] outputFormat matches downstream usage (json for structured data, text for content)
  • [ ] Every property in outputSettings.properties has a description field
  • [ ] Nested objects in schemas also have descriptions for all properties
  • [ ] Variable references in prompts use valid {{}} syntax (not @ syntax)