customer_service.json
Overview
customer_service.json defines a multi-agent intelligent customer support system using a JSON-based Domain-Specific Language (DSL) format. This system is designed to classify user intents from incoming queries and delegate responses to specialized sub-agents based on the identified intent category. The lead (or main) agent acts as a dispatcher that routes tasks to sub-agents responsible for handling specific types of customer interactions such as casual conversation, complaints, product-related inquiries, or contact information collection.
This architecture enables scalable and context-aware automated customer service by combining multiple AI agents, each fine-tuned for distinct communication goals and expertise. The JSON file fully specifies the agents, their parameters, prompts, workflows, and interactions, providing a declarative blueprint of the multi-agent system.
Detailed Explanation
Top-Level Structure
id: 2 — Unique identifier of this configuration.
title: Localized titles for the system (English and Chinese).
description: Localized descriptions explaining the system purpose.
canvas_type: "Agent" — Indicates this is an agent-based canvas.
dsl: The core JSON DSL describing components (agents, messages, begin node), globals, and graph structure.
avatar: Base64-encoded icon/image representing the system visually.
Components
The components object describes the various nodes in the conversation flow:
1. Begin Node (begin)
Type:
BeginPurpose: Entry point of the conversation.
Params:
enablePrologue: true — Enables introductory message.mode:"conversational"— Indicates conversational mode.prologue: "Hi! I'm an official AI customer service representative. How can I help you?" — Initial greeting to the user.
Flow: Downstream leads to the main lead agent
Agent:RottenRiversDo.
2. Lead Agent (Agent:RottenRiversDo)
Type:
AgentName: Customer Server Agent (Lead agent)
Purpose: Classifies user intent and either handles contact information directly or delegates to sub-agents.
Key Parameters:
llm_id: "deepseek-chat@DeepSeek" — Language model used.max_retries: 3,max_rounds: 2 — Limit retries and conversational rounds.temperature: 0.1 — Controls response randomness (low to keep responses precise).message_history_window_size: 12 — Retains recent conversation for context.sys_prompt: Extensive system prompt defining role, categories, delegation rules, and reply templates.
Prompts:
User prompt template:
"The user query is {sys.query}"
Exception Handling:
delay_after_error: 1 second before retry.
Outputs:
content: String response content.
Tools (Sub-agents):
Casual Agent(Agent:SlowKiwisBehave)Soothe Agent(Agent:PoorTaxesRescue)Product Agent(Agent:SillyTurkeysRest)
Flow:
Upstream from begin.
Downstream to Message:PurpleCitiesSee (message node).
Downstream to multiple sub-agents as tools.
Usage Example:
When a user sends a message, the lead agent first classifies the intent into one of four categories: contact, casual, complain, or product.
If
contact, it replies immediately with one of several fixed responses.Otherwise, it routes the query to the appropriate sub-agent for further processing.
3. Sub-Agents (Tools under Lead Agent)
Each sub-agent specializes in a specific category of user intent:
a. Casual Agent (Agent:SlowKiwisBehave)
Description: Handles light, everyday conversation (small talk).
Key Parameters:
temperature: 0.5 — More relaxed, natural tone.max_retries: 1,max_rounds: 1.sys_prompt: Instructions to keep conversations friendly, positive, avoid sensitive topics.
Prompts:
Passes the user query directly.
Outputs:
Returns string content to the lead agent for forwarding verbatim.
b. Soothe Agent (Agent:PoorTaxesRescue)
Description: Handles complaints and emotional or frustrated user input.
Key Parameters: Similar to Casual Agent but with empathetic tone instructions.
Sys Prompt: Encourages warm, kind, and understanding responses focusing on emotional support rather than problem-solving.
c. Product Agent (Agent:SillyTurkeysRest)
Description: Handles product-related questions, using an external knowledge base retrieval tool.
Key Parameters:
temperature: 0.1 — Precise, factual responses.max_retries: 3,max_rounds: 2.sys_prompt: Clear rules to only answer from retrieved knowledge base passages without guessing.
Tools:
Uses a
Retrievaltool component to query product knowledge base.
Workflow:
Retrieve relevant documents for user query.
Draft reply strictly from retrieved data.
If no relevant documents, reply with a standard fallback message.
Outputs:
Returns content to lead agent for forwarding.
4. Message Node (Message:PurpleCitiesSee)
Type:
MessagePurpose: Sends the final agent response back to the user.
Params:
content: The response content from the lead agent.
Flow: Upstream from lead agent.
Globals
System-wide variables used in prompts and logic:
sys.conversation_turns: Tracks number of conversation turns.sys.files: List of files (empty here).sys.query: Current user query string.
sys.user_id: User identifier.
Graph Structure and Workflow
Conversation starts at the begin node, which sends a greeting and passes control downstream to the lead agent.
The lead agent processes the user query, classifies intent, and either:
Responds directly if intent is
contact.Calls the appropriate sub-agent (casual, complain, product) to handle the query.
The sub-agent processes the query and returns an answer.
The lead agent forwards this answer verbatim to the
Messagenode.The
Messagenode outputs the final response to the user.
Important Implementation Details and Algorithms
Intent Classification: The lead agent uses a language model prompt to classify the user query into predefined categories.
Delegation: Based on classification, the lead agent delegates to specialized sub-agents or handles simple cases itself.
Multi-Agent Collaboration: Each sub-agent specializes in a communication style or domain:
Casual Agent: Light, friendly conversation.
Soothe Agent: Emotional support and complaint handling.
Product Agent: Fact-based information retrieval from knowledge base.
Knowledge Retrieval: Product Agent integrates a retrieval tool to fetch relevant product documents and strictly bases its answers on retrieved content.
Response Control: The system uses parameters like
temperature,max_tokens, and penalties to control response quality and style.Error Handling: Agents have retry limits and delay parameters to handle errors gracefully.
Message History Window: Agents maintain a message history window of size 12 for context continuity.
Interaction with Other System Components
Language Model Backend: Agents use "llm_id": "deepseek-chat@DeepSeek" indicating connection to the DeepSeek chat LLM service.
Retrieval Tool: The Product Agent uses a retrieval tool component linked to a product knowledge base (KB), which is external to this file but integrated via parameters.
User Interface: The
Messagecomponent sends the agent's output to the user interface layer (not defined here).System Globals: The file relies on system globals like sys.query which must be populated by the host system with user input before processing.
Usage Example
Suppose a user inputs:
"I want to change my email address on file."
The lead agent receives the query, classifies it as
contactorproduct(depending on intent recognition).If classified as
contact, the lead agent replies with a canned response like:
"Okay, I've already written this down. What else can I do for you?"If classified as
product, it routes the query to the Product Agent.The Product Agent runs a retrieval on the KB, drafts a factual reply, and returns it.
The lead agent forwards this reply to the
Messagenode.The user receives the response.
Visual Diagram
flowchart TD
A[Begin Node] -->|Start| B[Lead Agent: Customer Server Agent]
B -->|Intent: contact| M1[Direct Response (Contact)]
B -->|Intent: casual| C1[Casual Agent]
B -->|Intent: complain| C2[Soothe Agent]
B -->|Intent: product| C3[Product Agent]
C3 --> R[Retrieval Tool (Product KB)]
C1 --> B
C2 --> B
C3 --> B
B --> D[Message Node (Send Response)]
D --> User[User Interface]
classDef leadAgent fill:#f9f,stroke:#333,stroke-width:2px;
class B leadAgent;
classDef subAgent fill:#bbf,stroke:#333,stroke-width:1px;
class C1,C2,C3 subAgent;
class R fill:#afa,stroke:#333,stroke-width:1px;
class A,M1,D,User fill:#eee,stroke:#333,stroke-width:1px;
Summary
The customer_service.json file defines a multi-agent AI customer service system using a hierarchical agent architecture.
A lead agent classifies and routes user queries to specialized sub-agents or handles some intents directly.
Sub-agents include Casual Agent, Soothe Agent, and Product Agent (integrated with a retrieval-based knowledge base).
The system ensures responses are appropriate to user intent, factual (for product queries), and empathetic when needed.
This JSON file encapsulates the entire multi-agent workflow, including prompts, parameters, tooling, and conversation flow.
This documentation enables developers and system integrators to understand, extend, or integrate this multi-agent customer service system within broader chatbot platforms or AI ecosystems.