Artificial Intelligence 18 min read

Engineering Practices of JD Advertising Agent: JDZunTong Intelligent Assistant

JD’s advertising R&D team created the JDZunTong Intelligent Assistant by engineering a modular Agent platform that combines advanced Retrieval‑Augmented Generation (RAG 1.0 → 2.0) and Function‑Call capabilities, a visual designer, custom tool registration, and a native Python workflow engine to deliver intelligent customer service, data queries, and ad creation for merchants.

JD Retail Technology
JD Retail Technology
JD Retail Technology
Engineering Practices of JD Advertising Agent: JDZunTong Intelligent Assistant

ChatGPT's emergence has sparked global attention on large language model (LLM) technology. In the best‑practice deployment of large models, the Agent architecture shows great potential and has become a common consensus in the industry. Major companies are launching Agent verification projects.

Against this backdrop, JD's advertising R&D team explored Agent applications and built the JDZunTong Intelligent Assistant. The assistant, after multiple version iterations, now supports intelligent customer service, data query, ad creation and other AI capabilities, becoming a super‑assistant for advertisers. This article details the construction process and the key technical practices and innovative methodologies of AI engineering capabilities.

1.1 Application Scenarios of Agent in JD Advertising

The team identified two main scenarios for Agent deployment in JD advertising:

1.2 Engineering Capabilities Implementation

Based on the clarified application scenarios, the engineering layer focuses on building two core capabilities: Retrieval‑Augmented Generation (RAG) and Function Call, providing technical support for intelligent customer service and command execution.

1.2.1 Evolution of RAG Capability

RAG has undergone multiple upgrades, mainly RAG1.0 and RAG2.0.

RAG1.0

RAG1.0 consists of two parts: offline knowledge construction and online inference engine.

Offline Knowledge Construction

The core work is to convert knowledge into vectors and store them. The steps are:

Product/operation teams organize business knowledge into documents (Markdown, Excel, etc.).

Content is split into chunks according to format and segmentation rules.

Embedding models vectorize the chunks.

Vectors are stored in JD's Vearch vector database.

Online Inference Engine

The engine provides real‑time services, retrieving relevant knowledge and invoking the large model to answer queries. Main steps:

Receive user query and embed it to obtain a vector.

Search the vector store for related knowledge.

Compose a prompt for the model.

Call the large model API and return the result.

[
    {
        "_score": 0.7526149153709412, // relevance score
        "_source": {
            "title": "搜索快车-定向设置-关键词定向-功能入口",
            "content": "搜索快车->新增/编辑快车推广单元->添加关键词...",
            "status": 1,
            // more fields...
        }
    },
    // more knowledge...
]

Prompt composition example (simplified):

// Here we omit the real business prompt. Rough idea:
请根据信息
"""
搜索快车-搜索快车投放要素-定向设置-关键词定向-功能入口
- 搜索快车->新增/编辑快车推广单元->添加关键词;
// more knowledge...
"""
回答问题
"""
搜索快车关键词设置
"""

RAG2.0

RAG2.0 adds multi‑path vector recall, Elasticsearch retrieval, and re‑ranking to improve recall quality and quantity.

Vector Multi‑Path Recall

Issue: Some useful content has low relevance and cannot be recalled.

Solution: Store two vectors for each knowledge chunk – a short “summary” vector (high density) and a full‑content vector. During recall, retrieve both paths and deduplicate, boosting recall rate.

Elasticsearch Retrieval

Issue: Queries about “smart plans” were often answered with unrelated “smart bidding” knowledge.

Solution: Add an ES retrieval path with custom tokenizers (synonyms, specialized terms, stop words) to retrieve the correct knowledge.

Re‑ranking

Issue: Increased recall introduced irrelevant knowledge that misleads the model.

Solution: Introduce a ReRank model to reorder retrieved knowledge and filter out irrelevant items.

1.2.2 Building Function Call Capability

Function Call enables intelligent commands such as “query plans with ROI > 10”. The model returns a function name and arguments, which are then invoked to render a report.

It consists of two parts: tool registration and online inference engine.

Tool Registration

Tools are described with model‑perceived information (name, description, parameters), backend information (API endpoint, success criteria), and frontend rendering info.

{
    "type": "function",
    "function": {
        "name": "query_xxxx_data",
        "description": "根据ROI、时间....查询广告计划数据" + "这是一个查询计划数据的工具,可以根据..." + "示例指令:\n- 查询今天ROI > 10的计划数据\n- 查询上周...",
        "parameters": {
            "type": "object",
            "properties": {
                "startTime": {"type": "string", "description": "开始时间,格式yyyy-mm-dd"},
                "endTime": {"type": "string", "description": "结束时间,格式yyyy-mm-dd"},
                "roi": {"type": "string", "description": "ROI查询条件,如: \"ge|3\" 表示大于等于3"}
                // ...
            }
        }
    }
}

Backend info includes URL, success condition, response fields, and error handling.

{
    "url": "http://xxx.jd.local/xxx",
    "success": {"condition": {"from": "code", "operator": 1, "target": 1}, "data": "data"},
    "params": [
        {"key": "code", "type": "integer", "description": "code码"},
        {"key": "msg", "type": "string", "description": "错误信息"},
        {"key": "data", "type": "string", "description": "返回给前端数据"}
    ],
    "error": {"msgType": 1, "msgKey": "msg", "msgContent": ""}
}

Frontend info may include component configuration for rendering results, e.g., a data table component.

{
    "pageData": [
        {
            "name": "数据表格",
            "componentName": "jad_ReportTable",
            "jsUrl": "jadfe/xxx/ReportTable.6a3493f4.js",
            "options": [
                {"key": "columns", "type": "list", "name": "列设置", "options": [{"key":"title","name":"列名称","type":"input"}, ...],
                 "value": [{"title":"计划名称","key":"campaignName","width":110}, ...]}
            ]
        }
    ]
}

Online Inference Engine

Steps:

Receive user query and load tool definitions from the database.

Assemble a prompt with tool info and call the large model.

If the model returns a Function Call, locate the corresponding tool and invoke its backend API.

Render the result according to the tool’s frontend configuration (e.g., load a component CDN and display a table).

1.2.3 Full Engineering Capability Overview

The overall architecture integrates RAG, Function Call, and workflow orchestration, with LangChain used only for selective utilities.

2.1 Agent Designer

The designer provides visual construction of agents, knowledge bases, tool libraries, and workflow orchestration. Teams can manage knowledge vectors, configure tool metadata, and drag‑and‑drop workflow nodes (recall strategies, model prompts, etc.).

2.2 Agent Engine

The engine handles model interaction and is the performance‑critical core. Initially built on LangChain, the team found the heavy abstraction reduced flexibility and added latency. They replaced LangChain with native Python implementations, keeping only convenient utilities like document splitting.

A workflow scheduler initializes per request, orchestrating nodes such as recall, prompt generation, model inference, tool invocation, and code execution.

To date, the Agent platform powers multiple Agent applications, accelerating workflow‑driven iterations and significantly improving development efficiency.

3. Summary

The engineering practices described—building RAG, Function Call, tool registration, and a modular workflow engine—provide AI super‑powers for JDZunTong Intelligent Assistant and empower merchants. Future work includes multi‑Agent architecture upgrades to broaden the ecosystem of intelligent assistants.

AIRAGagentlarge language modelFunction CallJD Advertising
JD Retail Technology
Written by

JD Retail Technology

Official platform of JD Retail Technology, delivering insightful R&D news and a deep look into the lives and work of technologists.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.