Building a Multi‑Agent Bookmark Assistant Bot with Coze: From File Upload to AI‑Powered Search
This tutorial walks through creating a Coze bot that uses multi‑agent orchestration, memory variables, triggers, and large‑language‑model integration to upload bookmark files, extract and clean data, classify sites, generate importable HTML bookmarks, and provide AI‑driven search functionality, complete with Python code examples and deployment tips.
1. Introduction – The author explores recent updates to the Coze platform, focusing on the new Multi‑Agents mode that allows combining multiple bots for more complex tasks.
1.1. Multi‑Agents Mode – Agents can be individual bots or collaborative bot groups. The orchestration page lets you switch between single‑agent and multi‑agent scopes, add nodes such as Agent nodes, Bot nodes, and global jump conditions, and configure up to five conditional nodes per bot.
1.2. Memory – Variables – Variables store temporary data (e.g., sys_uuid , city ) that can be edited in the orchestration page and accessed during preview and debugging.
1.3. Memory – Long‑Term Memory – Enables automatic conversation summarisation and recall to provide personalised responses, with toggles on the orchestration page.
1.4. Skills – Triggers – Configure time‑based or event‑based triggers (including webhook URLs) to execute tasks without writing code.
1.5. Dialogue Experience – Quick Commands – Add buttons above the input box for preset commands, supporting direct text or plugin/workflow invocation.
1.6. Dialogue Experience – Background Image – Upload background images for the bot store preview.
1.7. Dialogue Experience – Markdown Intro – Use the Markdown editor to craft the bot’s opening message with live preview.
1.8. LLM Model Update – The "云雀" model renamed to "豆包" now supports the Moonshot model with various context lengths (e.g., 8k tokens).
1.9. Workflow – Message Node – Choose between non‑streaming (batch) and streaming (typewriter) output modes for large‑model responses.
1.10. Skill – Image Flow – Upcoming visual image processing pipeline (currently unavailable).
2. Practice Process
2.1. File Upload – Export browser bookmarks as bookmarks_YYYY_MM_DD.html . Coze does not support direct HTML uploads, so the author uses Qiniu Cloud for storage. Example upload code:
from qiniu import Auth, put_file, etag
access_key = 'access_key'
secret_key = 'secret_key'
bucket_name = 'bucket_name'
base_url = "http://xxx.com/{}"
q = Auth(access_key, secret_key)
def upload_file(file_path):
file_name = file_path.split('/')[-1]
token = q.upload_token(bucket_name, file_name)
ret, info = put_file(token, file_name, file_path, version='v2')
if ret['key'] == file_name and ret['hash'] == etag(file_path):
return base_url.format(file_name)A simple PySimpleGUI front‑end wraps the upload function into an executable .exe using pyinstaller :
pyinstaller --onefile --noconsole --name "七牛云文件上传助手" app.py2.2. Bookmark Extraction – Parse the exported HTML using a regular expression to capture HREF , ADD_DATE , ICON , and title. The extracted items are stored as BookmarkItem objects and serialized to JSON.
bookmark_item_pattern = re.compile(r'A HREF="(.+?)" ADD_DATE="(\d+)" ICON="(.*?)">(.*?)
')
# ... parsing logic ...
bookmark_json = json.dumps(bookmark_item_list, default=lambda obj: obj.__dict__, ensure_ascii=False)2.3. Data Cleaning – Missing titles are fetched asynchronously using aiohttp with a proxy service (e.g., 亮数据) to speed up requests:
import aiohttp, asyncio, re
proxy = 'http://proxy:port'
title_pattern = re.compile(r'>([^<]*)
')
async def fetch(bookmark):
async with aiohttp.ClientSession() as session:
async with session.get(bookmark['url'], proxy=proxy, ssl=False) as resp:
bookmark['title'] = title_pattern.search(await resp.text()).group(1)
return bookmark
# gather tasks ...2.4. Simple Classification – Domain names are extracted and sent to a Moonshot LLM with a prompt asking for a single‑category label per site. Results are merged back into the bookmark JSON.
2.5. Generate Bookmark File – Convert the classified JSON into a Netscape‑compatible HTML bookmark file, grouping by category and adding timestamps. The file is saved locally and uploaded to Qiniu:
def gen_bookmark_file_content(json_content):
result_content = """
..."""
# build groups and
entries
return result_content2.6. AI Bookmark Retrieval – Build a prompt that lists all titles and asks the LLM to return the top 20 most relevant to a user keyword. The response is parsed and formatted as markdown links.
prompt_str = f"请从下面的列表中选择与 {keyword} 相关度最高的20个,以字符串数组的形式返回:"
# append titles, call LLM, parse output2.7. Bot Assembly – Combine the workflows into a Coze bot exposing two commands: /tidy <bookmark_html_url> for automatic classification and /search <bookmark_html_url> <keyword> for AI‑driven search.
3. Summary
The project demonstrates end‑to‑end development of a Coze bot that handles file upload, bookmark extraction, cleaning, classification, HTML generation, and AI‑augmented search, highlighting practical tips such as adding error handling, managing write permissions, and leveraging multi‑agent architecture for modularity.
Tips
Wrap plugin code in try‑except blocks and expose error messages in the metadata for easier debugging.
Plugins can write files, but workflow nodes may lack write permissions; use a writable directory detection utility when needed.
Consider separating concerns with multiple agents or persisting parsed data in a database for faster subsequent queries.
Rare Earth Juejin Tech Community
Juejin, a tech community that helps developers grow.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.