Skip to content

Fix: agent template smart_customer_service_specialist.json - #15565

Merged
wangq8 merged 2 commits into
infiniflow:mainfrom
buua436:b060
Jun 3, 2026
Merged

wangq8 merged 2 commits into
infiniflow:mainfrom
buua436:b060

Conversation

@buua436

@buua436 buua436 commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

agent template smart_customer_service_specialist.json

Type of change

  • Refactoring

@coderabbitai

coderabbitai Bot commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR standardizes LLM model identifiers across 12 agent templates to a normalized @default@provider format, migrates Parser node setup schemas in 4 ingestion pipelines from keyed objects to arrays, and refactors the customer service workflow to consolidate agent outputs through a new VariableAggregator component.

Changes

LLM Model ID Standardization Across Templates

Layer / File(s) Summary
Customer Feedback and CV Analysis LLM Updates
agent/templates/customer_feedback_dispatcher.json, agent/templates/cv_analysis_and_candidate_evaluation.json
Customer feedback categorization and CV analysis agent models updated to @default@provider format; CV template sys_prompt parentheses replaced with literal full-width Chinese characters.
Data Analysis and Photo Translator LLM Updates
agent/templates/data_analysis_beginner_assistant.json, agent/templates/photo_text_translator.json
Data analysis agent updated to kimi-k2.5@default@Moonshot with expanded CodeExec capability (Python/SQL/R); photo translator agent updated to qwen-vl-plus@default@Tongyi-Qianwen with selected node state enabled.
Academic Paper and Travel Planning LLM Updates
agent/templates/reflective_academic_paper_generator.json, agent/templates/trip_planner.json
Qwen agents updated to @default@Tongyi-Qianwen format; DeepSeek trip planner agents updated to @default@DeepSeek format; academic paper knowledge-base retrieval prompts expanded with detailed decomposition, quality gates, and LaTeX requirements; Begin node greeting text updated.
Web Search, SQL, and User Interaction LLM Updates
agent/templates/web_search_assistant.json, agent/templates/text2sql_data_expert.json, agent/templates/user_interaction.json, agent/templates/your_starter_dataset_chatbot.json
Agent LLM IDs normalized to @default@provider format across all four templates; JSON serialization and formatting normalized across full template structure.

Parser Setup Schema Migration: Array Format Conversion

Layer / File(s) Summary
Parser Setup Array Conversion and Schema Change
agent/templates/advanced_ingestion_pipeline.json, agent/templates/chunk_summary.json, agent/templates/ingestion_pipeline_resume.json, agent/templates/title_chunker.json
Parser:HipSignsRhyme form.setups converted from keyed objects (e.g., {doc: {...}, docx: {...}}) to array entries with fileFormat fields; per-format suffix/vlm configuration and email-specific fields mapping removed from streamlined schema.
Downstream Extractor and Tokenizer Node Updates
agent/templates/advanced_ingestion_pipeline.json
Extractor and Tokenizer node data.form serialization updated to align with Parser setup schema change; node identities, wiring, and prompt representation adjusted to match updated template style.

Customer Service Workflow Response Assembly Refactoring

Layer / File(s) Summary
Variable Aggregator Introduction and Component Updates
agent/templates/smart_customer_service_specialist.json
New VariableAggregator:GentleLawsSneeze component introduced to collect three agent @content outputs into an answer variable; agents (DeepCoatsDress, PlentyCandiesRefuse, ShinyCooksCall) and Categorize agent model IDs updated to deepseek-v4-pro@default@DeepSeek; Retrieval node gains meta_data_filter: {}; workflow globals include sys.history: [].
Graph Edge and Node Updates for Aggregator Routing
agent/templates/smart_customer_service_specialist.json
Graph edges redirected from direct agent-to-message routing to agent-to-VariableAggregator routing; Message node output changed to reference {VariableAggregator:GentleLawsSneeze@answer}; graph node definitions updated for all affected components with revised LLM IDs, metadata filters, and measured layout dimensions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • infiniflow/ragflow#15495: Updates workflow template llm_id values to the normalized @default@ format; aligns with a MySQL migration that rewrites legacy model@provider IDs into model@default@provider.
  • infiniflow/ragflow#14036: Directly related to Parser:HipSignsRhyme form.setups schema changes in advanced_ingestion_pipeline.json (array-style per-format setups vs. keyed object structure).
  • infiniflow/ragflow#14075: Adds new ingestion pipeline templates that configure Parser setups per file format; directly relates to the schema migration in this PR.

Suggested labels

size:XXL, area:templates, type:feature, type:refactor

Suggested reviewers

  • yingfeng
  • Lynn-Inf

🐰 Hop, hop—templates unified!
LLM IDs standardized, schemas refined,
Agent outputs aggregated, workflows redesigned!
With deepseek and qwen now properly aligned,
This PR's restructuring leaves nothing undefined! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title references only one specific template file, but the changeset normalizes model IDs across 15+ template files throughout the codebase. Update the title to reflect the actual scope, e.g., 'Fix: normalize agent template model IDs across all templates' or similar phrasing that captures the broader refactoring.
Description check ❓ Inconclusive PR description lacks required detail; provides minimal context about the scope and rationale for normalizing model IDs across 16 template files. Expand description to explain: which model IDs are being normalized, why this change is necessary, and impact on existing deployments or configurations.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@buua436 buua436 added the ci Continue Integration label Jun 3, 2026
@buua436
buua436 marked this pull request as ready for review June 3, 2026 05:34
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (2)
agent/templates/smart_customer_service_specialist.json (2)

438-447: 💤 Low value

Edge styling inconsistent with sibling agent→aggregator edges.

The Agent:ShinyCooksCall → VariableAggregator edge omits markerEnd, style, type: "buttonEdge", and zIndex, while the analogous Agent:DeepCoatsDress (Lines 465-472) and Agent:PlentyCandiesRefuse (Lines 478-485) edges include them. This is purely cosmetic but will render this one edge differently in the canvas.

♻️ Align edge definition with siblings
                 {
                     "data": {
                         "isHovered": false
                     },
                     "id": "xy-edge__Agent:ShinyCooksCallstart-VariableAggregator:GentleLawsSneezeend",
+                    "markerEnd": "logo",
                     "source": "Agent:ShinyCooksCall",
                     "sourceHandle": "start",
+                    "style": {
+                        "stroke": "rgba(91, 93, 106, 1)",
+                        "strokeWidth": 1
+                    },
                     "target": "VariableAggregator:GentleLawsSneeze",
-                    "targetHandle": "end"
+                    "targetHandle": "end",
+                    "type": "buttonEdge",
+                    "zIndex": 1001
                 },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent/templates/smart_customer_service_specialist.json` around lines 438 -
447, The edge object with id
"xy-edge__Agent:ShinyCooksCallstart-VariableAggregator:GentleLawsSneezeend"
(source "Agent:ShinyCooksCall", target "VariableAggregator:GentleLawsSneeze") is
missing the visual properties present on sibling edges (e.g., the edges from
"Agent:DeepCoatsDress" and "Agent:PlentyCandiesRefuse"); update this edge to
include the same markerEnd, style, type: "buttonEdge", and zIndex properties so
it renders consistently with the other agent→aggregator edges.

295-331: 🏗️ Heavy lift

VariableAggregator won’t stall on a divergent Categorize flow; it picks the first available agent @content from the canvas.

  • VariableAggregator only sets answer when canvas.get_variable_value(<Agent...@content>) returns a truthy value, so unexecuted branches simply contribute nothing and the downstream Message can still resolve.
  • Missing meta_data_filter on Retrieval:EagerTipsFeel is runtime-neutral because Retrieval defaults meta_data_filter = {} when omitted.
  • Cosmetic: Agent:ShinyCooksCall -> VariableAggregator:GentleLawsSneeze edge lacks type: buttonEdge, markerEnd, and zIndex present on the other agent→aggregator edges.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent/templates/smart_customer_service_specialist.json` around lines 295 -
331, Ensure VariableAggregator:GentleLawsSneeze deterministically aggregates
agent outputs by checking for undefined explicitly (use
canvas.get_variable_value(...) !== undefined) so it doesn't treat falsy but
valid values as missing and continues to iterate agents in order
(Agent:PlentyCandiesRefuse, Agent:ShinyCooksCall, Agent:DeepCoatsDress) rather
than stalling or picking an unintended first truthy value; also add an explicit
meta_data_filter: {} to Retrieval:EagerTipsFeel to mirror the default behavior
and avoid implicit assumptions; finally add the missing edge attributes on the
Agent:ShinyCooksCall -> VariableAggregator:GentleLawsSneeze edge (type:
buttonEdge, markerEnd, zIndex) to match the other agent→aggregator edges so the
canvas behavior and rendering remain consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@agent/templates/data_analysis_beginner_assistant.json`:
- Around line 31-54: The runtime sys_prompt/instructions in the template still
mandates "Use `CodeExec` (Python) for all computational tasks" causing a
Python-only runtime; update the sys_prompt's <instructions> step 4 to "Use
CodeExec (Python/SQL/R) for all computational tasks" and adjust the
corresponding <constraints> entry to allow programmatic outputs from Python,
SQL, or R so the template matches the DSL graph node (dsl.components) and
supports Python/SQL/R execution.

In `@agent/templates/smart_customer_service_specialist.json`:
- Line 276: The Retrieval node for EagerTipsFeel is missing the meta_data_filter
key while Retrieval:EightyDaysHappen includes "meta_data_filter": {}, causing
inconsistent schemas; update the EagerTipsFeel Retrieval node (component named
Retrieval:EagerTipsFeel) to include meta_data_filter with the same shape (e.g.,
add "meta_data_filter": {}) so both branches follow the expected Retrieval
schema and behave consistently.

In `@agent/templates/user_interaction.json`:
- Line 53: The Planning Agent sys_prompt contains a malformed closing tag:
change the trailing "<objectives>" to the proper closing tag "</objectives>" in
the sys_prompt string(s) so the XML-like prompt structure is balanced; locate
the sys_prompt field in agent/templates/user_interaction.json (the Planning
Agent prompt instance) and replace the duplicated opening tag at the end with
"</objectives>" wherever it appears (both serialized sections referenced),
ensuring the prompt text remains otherwise identical.

In `@agent/templates/web_search_assistant.json`:
- Around line 299-304: The template contains captured runtime state (globals
like sys.conversation_turns, sys.query, sys.user_id and non-empty
history/path/retrieval) that must be removed; edit the JSON template (look for
the "globals" object and the sections referenced around functions/keys history,
path, retrieval) to clear or replace runtime values with safe defaults (e.g.,
remove the concrete sys.user_id, set sys.conversation_turns to 0 or omit it, set
sys.query to an empty string, ensure sys.files is an empty array) and purge any
non-empty history/path/retrieval entries so new instances start from a clean,
non-identifying state.
- Line 48: The prompt template currently feeds the web-search result twice by
using {Agent:WildGoatsRule@content} for both "Web search result" and "Retrieval
result"; update the second occurrence so "Retrieval result" passes the KB output
token {Agent:WarmTimesRun@formalized_content} instead of WildGoatsRule. Locate
the string in the template that defines "Web search result" and "Retrieval
result" (the JSON keys around content) and replace the duplicate
{Agent:WildGoatsRule@content} for the Retrieval result with
{Agent:WarmTimesRun@formalized_content} so the Answer Organizer receives the
actual knowledge-base retrieval.

In `@agent/templates/your_starter_dataset_chatbot.json`:
- Line 52: The sys_prompt string opens a markdown code fence (```markdown) but
never closes it, causing formatting leaks in both serialized copies of the
template; update the sys_prompt value(s) (the JSON key "sys_prompt") to append a
closing triple-backtick (```) at the end of the prompt content to properly
terminate the fenced block so the prompt is well-formed in both serialized
occurrences.

---

Nitpick comments:
In `@agent/templates/smart_customer_service_specialist.json`:
- Around line 438-447: The edge object with id
"xy-edge__Agent:ShinyCooksCallstart-VariableAggregator:GentleLawsSneezeend"
(source "Agent:ShinyCooksCall", target "VariableAggregator:GentleLawsSneeze") is
missing the visual properties present on sibling edges (e.g., the edges from
"Agent:DeepCoatsDress" and "Agent:PlentyCandiesRefuse"); update this edge to
include the same markerEnd, style, type: "buttonEdge", and zIndex properties so
it renders consistently with the other agent→aggregator edges.
- Around line 295-331: Ensure VariableAggregator:GentleLawsSneeze
deterministically aggregates agent outputs by checking for undefined explicitly
(use canvas.get_variable_value(...) !== undefined) so it doesn't treat falsy but
valid values as missing and continues to iterate agents in order
(Agent:PlentyCandiesRefuse, Agent:ShinyCooksCall, Agent:DeepCoatsDress) rather
than stalling or picking an unintended first truthy value; also add an explicit
meta_data_filter: {} to Retrieval:EagerTipsFeel to mirror the default behavior
and avoid implicit assumptions; finally add the missing edge attributes on the
Agent:ShinyCooksCall -> VariableAggregator:GentleLawsSneeze edge (type:
buttonEdge, markerEnd, zIndex) to match the other agent→aggregator edges so the
canvas behavior and rendering remain consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 28f84477-98ff-40f9-a83a-400ddb7573cb

📥 Commits

Reviewing files that changed from the base of the PR and between e1f19f6 and dd6d5b5.

📒 Files selected for processing (19)
  • agent/templates/advanced_ingestion_pipeline.json
  • agent/templates/chunk_summary.json
  • agent/templates/customer_feedback_dispatcher.json
  • agent/templates/cv_analysis_and_candidate_evaluation.json
  • agent/templates/data_analysis_beginner_assistant.json
  • agent/templates/deep_research.json
  • agent/templates/ingestion_pipeline_resume.json
  • agent/templates/market_seo_article_writer.json
  • agent/templates/photo_text_translator.json
  • agent/templates/reflective_academic_paper_generator.json
  • agent/templates/seo_article_writer.json
  • agent/templates/smart_customer_service_specialist.json
  • agent/templates/stock_market_research_assistant.json
  • agent/templates/text2sql_data_expert.json
  • agent/templates/title_chunker.json
  • agent/templates/trip_planner.json
  • agent/templates/user_interaction.json
  • agent/templates/web_search_assistant.json
  • agent/templates/your_starter_dataset_chatbot.json

"65cb5150819b11f08347047c16ec874f"
],
"keywords_similarity_weight": 0.7,
"meta_data_filter": {},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="agent/templates/smart_customer_service_specialist.json"

# Show around the referenced line numbers (small windows)
python3 - <<'PY'
import itertools,sys
file_path="agent/templates/smart_customer_service_specialist.json"
targets=[220,226,232,260,270,276,286,580,590,597,605,680,689,700,712]
with open(file_path,'r',encoding='utf-8') as f:
    lines=f.readlines()
for t in targets:
    start=max(1,t-8)
    end=min(len(lines),t+8)
    print(f"\n--- {file_path}:{start}-{end} (around {t}) ---")
    for i in range(start,end+1):
        print(f"{i:4d}:{lines[i-1].rstrip()}")
PY

# Also extract any occurrences of meta_data_filter in the file with line numbers
rg -n '"meta_data_filter"' "$FILE" || true

Repository: infiniflow/ragflow

Length of output: 12694


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE="agent/templates/smart_customer_service_specialist.json"

echo "== meta_data_filter occurrences =="
rg -n '"meta_data_filter"\s*:\s*\{\}' "$FILE" || true

echo
echo "== Blocks around Retrieval:EagerTipsFeel =="
rg -n 'Retrieval:EagerTipsFeel' "$FILE" || true

python3 - <<'PY'
import re
path="agent/templates/smart_customer_service_specialist.json"
with open(path,'r',encoding='utf-8') as f:
    lines=f.readlines()

def dump_around(idx, window=60):
    start=max(0,idx-window)
    end=min(len(lines)-1, idx+window)
    print(f"\n--- around line {idx+1} ---")
    for i in range(start,end+1):
        print(f"{i+1:4d}:{lines[i].rstrip()}")

# find all occurrences
targets=[]
for i,l in enumerate(lines):
    if 'Retrieval:EagerTipsFeel' in l:
        targets.append(i)
for t in targets:
    dump_around(t, window=70)
PY

Repository: infiniflow/ragflow

Length of output: 50374


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE="agent/templates/smart_customer_service_specialist.json"

python3 - <<'PY'
import re
path="agent/templates/smart_customer_service_specialist.json"
s=open(path,'r',encoding='utf-8').read()

def extract_block(node_id):
    # Grab from the `"id": "<node_id>"` line up to the next occurrence of `"id": "` at same nesting-ish level
    m=re.search(rf'"id"\s*:\s*"{re.escape(node_id)}"', s)
    if not m:
        return None
    start=m.start()
    # find next `"id": "` after start
    m2=re.search(r'"id"\s*:\s*"', s[start+1:])
    # above search finds next id marker but could be within strings; acceptable
    # Better: find next `"id": "` occurrence after current start
    # We'll locate the second quote pattern using regex with finditer
    ids=[m_.start() for m_ in re.finditer(r'"id"\s*:\s*"', s)]
    idx=next(i for i,x in enumerate(ids) if x>=start)
    end=ids[idx+1] if idx+1<len(ids) else len(s)
    return s[start:end]

for nid in ["Retrieval:EightyDaysHappen","Retrieval:EagerTipsFeel"]:
    block=extract_block(nid)
    has="meta_data_filter" in block if block else False
    print(f"{nid}: meta_data_filter present? {has}")
    if block:
        # print a tiny excerpt around meta_data_filter if present else around kb_ids
        if has:
            k=block.find("meta_data_filter")
            print(block[k-80:k+80].replace("\n","\\n"))
        else:
            kb=re.search(r'"kb_ids"\s*:\s*\[[^\]]*\]', block)
            if kb: 
                print("kb_ids:", kb.group(0))
PY

# Also confirm component-side params for each Retrieval node
python3 - <<'PY'
import json
path="agent/templates/smart_customer_service_specialist.json"
# Not valid JSON overall? It's a JSON file; parse.
data=json.load(open(path,'r',encoding='utf-8'))
# component graph is under likely "nodes"?? We'll just re-search by string in raw for component param blocks.
s=open(path,'r',encoding='utf-8').read()
for nid in ["Retrieval:EightyDaysHappen","Retrieval:EagerTipsFeel"]:
    # find the component entry: "Retrieval:E..": { ... "component_name":"Retrieval" ... "params": { ... }
    import re
    m=re.search(rf'"{re.escape(nid)}"\s*:\s*\{{', s)
    if not m:
        print(nid, "component not found")
        continue
    start=m.start()
    # take next top-level key at same indentation by searching for \n            "something":
    # we'll just slice until next occurrence of '\n            "Retrieval:' after start
    m2=re.search(r'\n\s+"[A-Za-z0-9_:-]+":\s*\{{', s[start+1:])  # not robust
    # simpler: just check in next 4000 chars
    chunk=s[start:start+4000]
    print(f"{nid} component params: meta_data_filter in next 4000 chars? {'meta_data_filter' in chunk}")
PY

Repository: infiniflow/ragflow

Length of output: 350


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE="agent/templates/smart_customer_service_specialist.json"

python3 - <<'PY'
import json,sys
path="agent/templates/smart_customer_service_specialist.json"
with open(path,'r',encoding='utf-8') as f:
    data=json.load(f)

targets={"Retrieval:EagerTipsFeel","Retrieval:EightyDaysHappen"}

def walk(obj, path=""):
    if isinstance(obj, dict):
        # If this dict looks like a node with id, inspect it
        node_id=obj.get("id")
        if node_id in targets:
            yield (node_id, path, obj)
        for k,v in obj.items():
            new_path=f"{path}.{k}" if path else str(k)
            yield from walk(v,new_path)
    elif isinstance(obj, list):
        for i,v in enumerate(obj):
            new_path=f"{path}[{i}]"
            yield from walk(v,new_path)

found=list(walk(data))
print("Found node dicts:", len(found))
for node_id, path, obj in found:
    print("\n---", node_id, "at", path, "---")
    # Try to find meta_data_filter in common places
    # graph node seems to have obj["data"]["form"]["meta_data_filter"]
    data_block=obj.get("data") if isinstance(obj,dict) else None
    meta=None
    places=[]
    if isinstance(data_block, dict):
        form=data_block.get("form")
        if isinstance(form, dict) and "meta_data_filter" in form:
            meta=form.get("meta_data_filter")
            places.append(f"data.form.meta_data_filter={meta!r}")
    # component params might be under obj["obj"]["params"] or obj["obj"]["component_name"] structure
    obj_block=obj.get("obj") if isinstance(obj,dict) else None
    if isinstance(obj_block, dict):
        params=obj_block.get("params")
        if isinstance(params, dict) and "meta_data_filter" in params:
            meta=params.get("meta_data_filter")
            places.append(f"obj.params.meta_data_filter={meta!r}")
    # params directly
    if "meta_data_filter" in obj:
        places.append(f"direct.meta_data_filter={obj.get('meta_data_filter')!r}")
    if places:
        for p in places:
            print(p)
    else:
        print("meta_data_filter not found in inspected locations.")
PY

Repository: infiniflow/ragflow

Length of output: 276


Align meta_data_filter across Retrieval nodes.

meta_data_filter: {} is present for Retrieval:EightyDaysHappen (e.g., around lines 276 and 597) but is missing from Retrieval:EagerTipsFeel (component around lines 232-262 / node). If the Retrieval schema expects this key, the two branches may behave differently; otherwise, this is still a consistency gap worth fixing.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent/templates/smart_customer_service_specialist.json` at line 276, The
Retrieval node for EagerTipsFeel is missing the meta_data_filter key while
Retrieval:EightyDaysHappen includes "meta_data_filter": {}, causing inconsistent
schemas; update the EagerTipsFeel Retrieval node (component named
Retrieval:EagerTipsFeel) to include meta_data_filter with the same shape (e.g.,
add "meta_data_filter": {}) so both branches follow the expected Retrieval
schema and behave consistently.

Comment thread agent/templates/user_interaction.json Outdated
"role": "user"
}
],
"sys_prompt": "<role>\nYou are the Planning Agent in a multi-agent RAG workflow.\nYour sole job is to design a crisp, executable Search Plan for the next agent. Do not search or answer the user’s question.\n</role>\n<objectives>\nUnderstand the user’s task and decompose it into evidence-seeking steps.\nProduce high-quality queries and retrieval settings tailored to the task type (fact lookup, multi-hop reasoning, comparison, statistics, how-to, etc.).\nIdentify missing information that would materially change the plan (≤3 concise questions).\nOptimize for source trustworthiness, diversity, and recency; define stopping criteria to avoid over-searching.\nAnswer in 150 words.\n<objectives>",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix malformed closing tag in Planning Agent prompt.

The final <objectives> should be a closing tag (</objectives>). The current typo is duplicated in both serialized sections and can weaken prompt structure consistency.

Suggested fix
- "sys_prompt": "...Answer in 150 words.\n<objectives>",
+ "sys_prompt": "...Answer in 150 words.\n</objectives>",

Also applies to: 309-309

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent/templates/user_interaction.json` at line 53, The Planning Agent
sys_prompt contains a malformed closing tag: change the trailing "<objectives>"
to the proper closing tag "</objectives>" in the sys_prompt string(s) so the
XML-like prompt structure is balanced; locate the sys_prompt field in
agent/templates/user_interaction.json (the Planning Agent prompt instance) and
replace the duplicated opening tag at the end with "</objectives>" wherever it
appears (both serialized sections referenced), ensuring the prompt text remains
otherwise identical.

"presence_penalty": 0.4,
"prompts": [
{
"content": "User's query:\n{sys.query}\n\nRefined question:\n{Agent:ThreePathsDecide@content}\n\nWeb search result:\n{Agent:WildGoatsRule@content}\n\nRetrieval result:\n{Agent:WildGoatsRule@content}",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Pass the actual knowledge-base retrieval output to the Answer Organizer.

Retrieval result is wired to {Agent:WildGoatsRule@content} in both copies of the prompt, so the final agent receives the web-search result twice and never sees Retrieval:WarmTimesRun@formalized_content. That breaks the template’s KB + web-search merge behavior.

Proposed fix
-                                "content": "User's query:\n{sys.query}\n\nRefined question:\n{Agent:ThreePathsDecide@content}\n\nWeb search result:\n{Agent:WildGoatsRule@content}\n\nRetrieval result:\n{Agent:WildGoatsRule@content}",
+                                "content": "User's query:\n{sys.query}\n\nRefined question:\n{Agent:ThreePathsDecide@content}\n\nWeb search result:\n{Agent:WildGoatsRule@content}\n\nRetrieval result:\n{Retrieval:WarmTimesRun@formalized_content}",

Also applies to: 668-668

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent/templates/web_search_assistant.json` at line 48, The prompt template
currently feeds the web-search result twice by using
{Agent:WildGoatsRule@content} for both "Web search result" and "Retrieval
result"; update the second occurrence so "Retrieval result" passes the KB output
token {Agent:WarmTimesRun@formalized_content} instead of WildGoatsRule. Locate
the string in the template that defines "Web search result" and "Retrieval
result" (the JSON keys around content) and replace the duplicate
{Agent:WildGoatsRule@content} for the Retrieval result with
{Agent:WarmTimesRun@formalized_content} so the Answer Organizer receives the
actual knowledge-base retrieval.

Comment on lines +299 to +304
"globals": {
"sys.conversation_turns": 1,
"sys.files": [],
"sys.query": "你好",
"sys.user_id": "d6d98fd652f911f0a8fb047c16ec874f"
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove captured runtime state from the template.

This file still contains live session data: sys.conversation_turns = 1, sys.query = "你好", a concrete sys.user_id, plus non-empty history, path, and retrieval. New template instances will start from stale state, and committing the user ID is a privacy leak.

Proposed fix
-        "globals": {
-            "sys.conversation_turns": 1,
-            "sys.files": [],
-            "sys.query": "你好",
-            "sys.user_id": "d6d98fd652f911f0a8fb047c16ec874f"
-        },
+        "globals": {
+            "sys.conversation_turns": 0,
+            "sys.files": [],
+            "sys.query": "",
+            "sys.user_id": ""
+        },
@@
-        "history": [
-            [
-                "user",
-                "你好"
-            ]
-        ],
+        "history": [],
         "memory": [],
         "messages": [],
-        "path": [
-            "begin",
-            "Agent:ThreePathsDecide"
-        ],
-        "retrieval": [
-            {
-                "chunks": [],
-                "doc_aggs": []
-            },
-            {
-                "chunks": {},
-                "doc_aggs": {}
-            }
-        ],
+        "path": [],
+        "retrieval": [],

Also applies to: 851-873

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent/templates/web_search_assistant.json` around lines 299 - 304, The
template contains captured runtime state (globals like sys.conversation_turns,
sys.query, sys.user_id and non-empty history/path/retrieval) that must be
removed; edit the JSON template (look for the "globals" object and the sections
referenced around functions/keys history, path, retrieval) to clear or replace
runtime values with safe defaults (e.g., remove the concrete sys.user_id, set
sys.conversation_turns to 0 or omit it, set sys.query to an empty string, ensure
sys.files is an empty array) and purge any non-empty history/path/retrieval
entries so new instances start from a clean, non-identifying state.

"role": "user"
}
],
"sys_prompt": "# Role\n\nYou are the **Docs QA Agent**, a specialized knowledge base assistant responsible for providing accurate answers based strictly on the connected documentation repository.\n\n# Core Principles\n\n1. **Knowledge Base Only**: Answer questions EXCLUSIVELY based on information retrieved from the connected knowledge base.\n\n2. **No Content Creation**: Never generate, infer, or create information that is not explicitly present in the retrieved documents.\n\n3. **Source Transparency**: Always indicate when information comes from the knowledge base vs. when it's unavailable.\n\n4. **Accuracy Over Completeness**: Prefer incomplete but accurate answers over complete but potentially inaccurate ones.\n\n# Response Guidelines\n\n## When Information is Available\n\n- Provide direct answers based on retrieved content\n\n- Quote relevant sections when helpful\n\n- Cite the source document/section if available\n\n- Use phrases like: \"According to the documentation...\" or \"Based on the knowledge base...\"\n\n## When Information is Unavailable\n\n- Clearly state: \"I cannot find this information in the current knowledge base.\"\n\n- Do NOT attempt to fill gaps with general knowledge\n\n- Suggest alternative questions that might be covered in the docs\n\n- Use phrases like: \"The documentation does not cover...\" or \"This information is not available in the knowledge base.\"\n\n# Response Format\n\n```markdown\n\n## Answer\n\n[Your response based strictly on knowledge base content]\n\n**Always do these:**\n\n- Use the Retrieval tool for every question\n\n- Be transparent about information availability\n\n- Stick to documented facts only\n\n- Acknowledge knowledge base limitations\n\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Close the markdown code fence in sys_prompt.

The prompt opens with ```markdown but never closes, and this is duplicated in both serialized copies. Close the fence to avoid unintended formatting carry-over.

Suggested fix
- "...- Acknowledge knowledge base limitations\n\n",
+ "...- Acknowledge knowledge base limitations\n\n```",

Also applies to: 203-203

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent/templates/your_starter_dataset_chatbot.json` at line 52, The sys_prompt
string opens a markdown code fence (```markdown) but never closes it, causing
formatting leaks in both serialized copies of the template; update the
sys_prompt value(s) (the JSON key "sys_prompt") to append a closing
triple-backtick (```) at the end of the prompt content to properly terminate the
fenced block so the prompt is well-formed in both serialized occurrences.

@codecov

codecov Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (ff59714) to head (b0ac2ff).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15565   +/-   ##
=======================================
  Coverage   93.16%   93.16%           
=======================================
  Files          10       10           
  Lines         717      717           
  Branches      118      118           
=======================================
  Hits          668      668           
  Misses         29       29           
  Partials       20       20           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@buua436 buua436 changed the title Fix: normalize agent template model ids Fix: agent template smart_customer_service_specialist.json Jun 3, 2026
@wangq8
wangq8 merged commit c0e00a7 into infiniflow:main Jun 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants