iteration.json


Overview

iteration.json defines a structured workflow configuration for an intelligent research assistant system. The file orchestrates a multi-step pipeline that:

  1. Starts with a greeting component.

  2. Uses a language model (LLM) agent to decompose a user query into meaningful sub-topics.

  3. Iterates over each sub-topic to perform targeted internet searches.

  4. Generates detailed reports on each sub-topic based exclusively on retrieved online information.

  5. Aggregates and delivers the final responses to the user.

This JSON-based configuration describes components, their parameters, and how data flows between them (upstream/downstream relationships), enabling a modular, iterative, and extensible research assistant pipeline.


Detailed Explanation of Components

The file is structured under a top-level "components" object, where each key identifies a component instance by a unique ID. Each component includes:

Component Breakdown


1. Begin

Type: Begin

Purpose: Entry point of the workflow; initializes the conversation with a greeting.

Parameters:

Parameter

Type

Description

prologue

String

Initial greeting message.

Usage Example:

{
  "component_name": "Begin",
  "params": {
    "prologue": "Hi there!"
  }
}

Data Flow:


2. generate:0

Type: Agent

Purpose: Uses an LLM (language model) to decompose the user’s query (sys.query) into sub-topics.

Parameters:

Parameter

Type

Description

llm_id

String

Identifier of the LLM model to use (deepseek-chat).

sys_prompt

String

System prompt instructing the agent to decompose the query into meaningful sub-topics.

temperature

Number

Sampling temperature controlling randomness (0.2 = low randomness).

cite

Boolean

Whether to cite sources in output (false here).

output_structure

Array

Expected output format: list of sub-topic strings.

Prompt Details:

The system prompt instructs the LLM to strictly output a string array of sub-topics without redundant information.

Data Flow:


3. iteration:0

Type: Iteration

Purpose: Iterates over the list of sub-topics produced by generate:0.

Parameters:

Parameter

Type

Description

items_ref

String

Reference to the array of sub-topics to iterate over (generate:0@structured_content).

Data Flow:


4. iterationitem:0

Type: IterationItem

Purpose: Represents a single iteration over a sub-topic in the iteration component.

Parameters: None

Parent: "iteration:0"

Data Flow:


5. tavily:0

Type: TavilySearch

Purpose: Performs an internet search query based on the current sub-topic.

Parameters:

Parameter

Type

Description

api_key

String

API key for authenticating with the Tavily search service.

query

String

Search query, dynamically set to the current iteration item’s result (iterationitem:0@result).

Parent: "iteration:0"

Data Flow:


6. generate:1

Type: Agent

Purpose: Uses the LLM to generate a detailed report answering the current sub-topic based exclusively on the internet search results.

Parameters:

Parameter

Type

Description

llm_id

String

LLM model identifier (deepseek-chat).

sys_prompt

String

System prompt instructing the agent to generate a detailed, structured, and cited report only based on the provided search results.

temperature

Number

Sampling temperature (0.9 = higher creativity).

cite

Boolean

Whether to cite sources in output (false here).

System Prompt Highlights:

Parent: "iteration:0"

Data Flow:


7. message:0

Type: Message

Purpose: Aggregates the final output messages from the iteration component and delivers them.

Parameters:

Parameter

Type

Description

content

Array

An array referencing the generated reports from iteration ({iteration:0@generate:1}).

Data Flow:


Workflow Summary

  1. Begin — Starts with a greeting.

  2. generate:0 (Agent) — Decomposes the query into sub-topics.

  3. iteration:0 (Iteration) — Loops over sub-topics.

  4. For each sub-topic:

    • iterationitem:0 — Represents the current sub-topic.

    • tavily:0 (TavilySearch) — Searches the internet for information.

    • generate:1 (Agent) — Generates a detailed report using search results only.

  5. message:0 (Message) — Collects all reports and outputs them.


Important Implementation Details


Interaction with Other System Parts


Usage Example

Suppose a user query is set in the global variable:

{
  "sys.query": "Climate change impacts"
}

The pipeline would:


Visual Diagram

flowchart TD
    Begin["Begin\n(prologue)"]
    Generate0["Agent: generate:0\n(decompose query)"]
    Iteration0["Iteration: iteration:0\n(loop over sub-topics)"]
    IterationItem0["IterationItem: iterationitem:0\n(single sub-topic)"]
    Tavily0["TavilySearch: tavily:0\n(search sub-topic)"]
    Generate1["Agent: generate:1\n(generate report)"]
    Message0["Message: message:0\n(final output)"]

    Begin --> Generate0
    Generate0 --> Iteration0
    Iteration0 --> Message0

    Iteration0 --> IterationItem0
    IterationItem0 --> Tavily0
    Tavily0 --> Generate1
    Generate1 --> IterationItem0

Summary

iteration.json configures a multi-component, iterative research assistant workflow that decomposes queries, searches the internet for each sub-topic, and generates detailed reports based strictly on retrieved data. It leverages modular components, dynamic data referencing, and strict prompt engineering to ensure robust and reliable output in a conversational AI context.