choose_your_knowledge_base_agent.json
Overview
The choose_your_knowledge_base_agent.json file defines a conversational agent workflow designed to enable users to select a knowledge base from a dropdown menu and then query that knowledge base exclusively to generate responses. This file is structured as a DSL (Domain-Specific Language) JSON specification for an "Agent" canvas type, describing components, their parameters, interactions, and flow in a knowledge retrieval system.
The primary purpose is to provide an interactive agent that retrieves information strictly from a user-selected knowledge base, ensuring accurate, transparent, and rapid answers without content fabrication or inference beyond the documented materials.
Detailed Explanation
Top-Level Structure
id: Unique identifier of the agent (19).
title: Localized titles in English ("Choose Your Knowledge Base Agent") and Chinese.
description: Localized descriptions explaining the agent’s function.
canvas_type: Specifies this as an "Agent" type.
dsl: Main DSL configuration containing components, globals, graph (nodes and edges), and other flow metadata.
avatar: Base64 encoded image representing the agent.
Components
The core functionality is implemented as interconnected components in the dsl.components section.
1. Begin Component (begin)
Type: Begin Node
Purpose: Entry point for the workflow; it presents a dropdown menu for users to select the knowledge base.
Parameters:
enablePrologue: Boolean that enables greeting message.inputs: Defines input fields. Here, a required dropdown option named "knowledge base" with three options (knowledge base 1,knowledge base 2,knowledge base 3).mode: Set to"conversational".prologue: Initial greeting prompt "Hi! I'm your retrieval assistant. What do you want to ask?"
Usage: This node starts the conversation and collects the knowledge base selection from the user.
2. Agent Component (Agent:BraveParksJoke)
Type: Agent Node
Purpose: The core QA agent that processes user queries by retrieving information exclusively from the selected knowledge base.
Parameters:
LLM Settings:
llm_id: "deepseek-chat@DeepSeek" – specifies the language model.max_retries: 3 – retry attempts on failure.max_rounds: 1 – only one round of reflection to prioritize rapid output.max_tokens: 256 – token limit for responses.temperature: 0.1 – controls randomness in generation, low for deterministic output.frequency_penalty and
presence_penalty: penalties disabled or set low to minimize repetition.
Prompts:
Uses {sys.query} from the global context as the user input.
Includes a detailed system prompt (
sys_prompt) instructing the agent to:Act as a Docs QA Agent specialized in knowledge base document retrieval.
Return results rapidly without extra reflection.
Use only retrieved knowledge base content (no hallucination).
Indicate source transparency.
Prefer accuracy over completeness.
Provide specific response guidelines and markdown format for answers.
Tools:
Integrates a Retrieval tool configured to query the selected knowledge base ("begin@knowledge base"), with parameters like:
top_k: 1024 (number of items retrieved)top_n: 8 (number of top relevant documents)similarity_threshold: 0.2keywords_similarity_weight: 0.7description:"Retrieve from the knowledge bases."
Outputs:
Produces a string output named content containing the agent's answer.
Downstream:
Connects downstream to a Message component to display the generated content.
Usage Example:
A user selects "knowledge base 2" in the dropdown, asks a question, and the agent uses the Retrieval tool to query that knowledge base. The agent returns an answer strictly based on retrieved documents, formatted as specified in the system prompt.
3. Message Component (Message:HotMelonsObey)
Type: Message Node
Purpose: Displays the final answer content generated by the Agent.
Parameters:
content: Array that includes the output from
Agent:BraveParksJoke@content.
Usage: Receives the agent’s response and presents it to the user.
4. Tool Component (Tool:TangyWolvesDream)
Type: Tool Node
Purpose: A placeholder or auxiliary agent/task tool linked downstream from the Agent.
Parameters:
description: "This is an agent for a specific task."user_prompt: "This is the order you need to send to the agent."
Note: This component is referenced in the graph edges but contains minimal information; it may represent integration with other services or extended functionality.
Globals
sys.conversation_turns: Tracks the conversation turns, initialized at 0.sys.files: Empty array for files (no files specified here).sys.query: Stores the current user query string.sys.user_id: Stores the user ID (empty here).
These globals provide shared context for components and are referenced in prompts and processing.
Graph Structure and Workflow
The graph defines nodes and their connections, representing workflow order:
Begin node → Agent:BraveParksJoke (user selects knowledge base and sends a query)
Agent:BraveParksJoke → Tool:TangyWolvesDream (tool usage, possibly for internal processing)
Agent:BraveParksJoke → Message:HotMelonsObey (final content display)
The user starts in begin, selects knowledge base, submits a query → Agent processes with retrieval → Message outputs the answer.
Important Implementation Details
Strict Knowledge Base Retrieval: Agent uses a Retrieval tool configured to query only the knowledge base selected by the user, referenced dynamically via "begin@knowledge base".
System Prompt: The agent's system prompt enforces strict rules:
No hallucination or content creation.
Immediate return of retrieval results with minimal reflection.
Transparency on availability of information.
Markdown formatting with clear "Answer" sections.
Retrieval Parameters: The retrieval component uses semantic similarity (threshold 0.2) and keyword weighting (0.7) to fetch relevant documents, with a high
top_kto ensure coverage.Multi-language Support: Titles and descriptions include English and Chinese localizations.
User Experience: The dropdown menu at the start restricts knowledge bases to predefined options, making the system robust and user-friendly.
Interaction with Other System Parts
Knowledge Bases: The agent queries knowledge bases configured elsewhere in the system, referenced here by "begin@knowledge base" indicating the input from the Begin node.
DeepSeek Language Model: Uses "deepseek-chat@DeepSeek" as the LLM backend.
Retrieval Tool: The retrieval component is tightly coupled with the knowledge base system, forming the foundation of answer generation.
UI Layer: The Message component outputs content presumably to a UI that renders the conversation.
Potential Extensions: The Tool node hints at possible extensions or integrations with additional agents or services.
Usage Scenario
User accesses the agent interface.
The agent prompts with "Hi! I'm your retrieval assistant. What do you want to ask?" and a dropdown to select a knowledge base.
User selects a knowledge base (e.g., "knowledge base 1") and enters a question.
The Agent component receives the query, invokes the Retrieval tool to fetch documents from the selected knowledge base.
Agent generates a response strictly based on retrieved content.
The Message component displays the answer to the user.
Visual Diagram
flowchart TD
Begin["Begin\n- Dropdown: Knowledge Base\n- Prologue Greeting"]
Agent["Agent:BraveParksJoke\n- Receives query & knowledge base\n- Runs Retrieval Tool\n- Enforces strict QA rules"]
Tool["Tool:TangyWolvesDream\n- Auxiliary task/tool (optional)"]
Message["Message:HotMelonsObey\n- Displays Agent's response"]
Begin --> Agent
Agent --> Tool
Agent --> Message
Summary
The choose_your_knowledge_base_agent.json file defines a specialized conversational agent workflow that ensures users select a knowledge base explicitly and receive answers generated solely from that knowledge base’s documents. It uses a retrieval-augmented language model approach with strict system prompt rules to prioritize accuracy, transparency, and rapid responses without hallucination. The workflow is modular, allowing clear extension points and integration with existing knowledge base infrastructure and language models.