Xianyu AutoAgent: An AI Sales Agent That Haggles on Xianyu Around the Clock
智能闲鱼客服机器人系统:专为闲鱼平台打造的AI值守解决方案,实现闲鱼平台7×24小时自动化值守,支持多专家协同决策、智能议价和上下文感知对话。
At a glance
- What is it?
- This GPL-3.0 Python project automates customer service on the Xianyu second-hand marketplace, using LLM-driven experts for pricing, tech support, and default replies. It works, but its reliance on raw cookies and a single-maintainer future makes it a hobby tool, not a business dependency.
- Who is it for?
- Adopt Xianyu AutoAgent if you are a Xianyu seller comfortable with Python, willing to handle your own cookies and API keys, and prepared to maintain your own prompt files. Do not adopt it if you need a stable, supported product, because the README warns that development may stop or the repository may be deleted at any time.
- Can I use it commercially?
- Yes, with conditions. GPL-3.0 is a copyleft licence: if you distribute software that includes it, you must release that software's source code under the same licence. Running it internally without distributing it does not trigger that obligation.
- Is it still maintained?
- Yes. The repository last received commits 98 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
What Xianyu AutoAgent actually does
Xianyu AutoAgent is a Python program that watches a Xianyu seller's chat and replies automatically, 24/7. It is built for individual sellers on the Chinese second-hand marketplace who cannot sit at a screen all day. The README describes three roles: a default customer service agent, a price negotiation agent, and a technical support agent. It also includes a manual takeover feature: a configurable keyword, defaulting to a full stop, switches the bot to human mode and back. The project does not claim to handle payments or inventory; it only automates conversation. That narrow scope is its strength and its limit.
How the multi-expert system routes messages
The core mechanism is a two-step process. First, an LLM classifies the incoming message using a prompt file named classify_prompt.txt. The classification decides which expert handles the reply. Then the chosen expert, either price_prompt.txt, tech_prompt.txt, or default_prompt.txt, generates the response. The README calls this 'expert routing' and says it is based on 'LLM prompt + rule routing'. The system also stores conversation history and feeds the full history as context to the LLM, which the README labels 'context-aware'. This is not a fine-tuned model; it is a prompt orchestration layer on top of a generic LLM. The practical effect is that the bot can switch from a polite refusal to a stepwise price reduction to a technical explanation without retraining.
Getting it running: cookies, keys, and prompt files
Setup requires Python 3.8 or newer. You clone the repository, install dependencies with pip install -r requirements.txt, then create a .env file. The mandatory keys are API_KEY, COOKIES_STR, MODEL_BASE_URL, and MODEL_NAME. The README says the default model is Tongyi Qianwen, but you can change the model address and name to any OpenAI-compatible API. The trickiest part is COOKIES_STR: you must open Xianyu in a web browser, press F12, go to the Network tab, filter by Fetch/XHR, click any request, and copy the cookie header. That cookie grants the bot access to your account. Optional settings include TOGGLE_KEYWORDS for the takeover phrase and SIMULATE_HUMAN_TYPING to add a delay before replies. Finally, you must create four prompt files in the prompts directory, or rename the provided _example templates. Then run python main.py.
The cookie problem: convenience with real risk
Basing the login on a raw cookie string is convenient for a hobbyist, but it creates a serious failure mode. Cookies expire, and when they do, the bot silently stops working until you manually refresh the string. Worse, the cookie is tied to your Xianyu account, and automating that account may violate the platform's terms of service. The README itself says the project is for learning and communication only, and warns that the development team may stop updating or delete the project at any time. That is not the language of a production-ready tool. If you run this bot on a real seller account, you accept the risk of a ban or a lockout. There is no token refresh mechanism described, no OAuth flow, and no session management beyond the raw cookie.
What the bot can and cannot negotiate
The price negotiation module implements a 'stepwise price reduction strategy', which means the bot can lower the price in stages according to a prompt-defined logic. The README does not specify the exact steps or thresholds; those live in the prompt file. That gives you control, but it also means the bot's bargaining behavior is only as good as the prompt you write. The technical support module integrates web search, so the bot can look up answers to product questions, but the README notes that RAG knowledge base enhancement is still planned, not implemented. Sentiment analysis is also on the roadmap, not in the current build. So the bot handles straightforward haggling and basic tech queries, but it will not remember past buyers across sessions unless the conversation history is long enough, and it cannot detect frustration or sarcasm reliably.
Alternatives: a manual script or a full platform bot
If you do not want to hand over your cookie and chat to an LLM, you could write a simple auto-reply script using the Xianyu web API directly. The README credits the cv-cat/XianYuApis project as the technical foundation, so that library gives you lower-level access to Xianyu endpoints without the LLM layer. That approach gives you full control and no prompt costs, but you lose the natural language understanding and the multi-expert routing. On the other end, you could use a commercial customer service platform that integrates with Xianyu, if one exists, but the README does not mention any. The real difference is that Xianyu AutoAgent brings an LLM into the loop, which is overkill for fixed replies but necessary for open-ended haggling. If your buyers only ask about shipping and price, a rule-based script is cheaper and safer.
License and maintenance reality
The project is licensed under GPL-3.0, which means any derivative work you distribute must also be GPL-3.0. If you modify this bot for your own use, you do not have to share the changes, but if you offer it as a service or sell it, the license obligations apply. The README lists no recent releases, and the last push date is June 2026, which suggests active development at the time of writing, but the author explicitly says the project may be deleted. There is no contribution guide beyond a link to contributing.md, and no issue tracker details beyond a suggestion to open issues. Maintenance cost is therefore entirely on you: you must update cookie strings, adjust prompts when the LLM API changes, and patch any breakage caused by Xianyu's frontend updates. The project has a basic logging feature, but no web UI or DingTalk integration yet, so monitoring means reading log files.
Who should run this bot today
This bot fits a specific user: a technical Xianyu seller who is comfortable editing .env files and prompt templates, and who sells items that generate repetitive questions. For that person, the multi-expert setup can save hours per week. It is not for a non-programmer who expects a plug-and-play assistant, despite the README pointing to a 'nanny-level tutorial'. The cookie acquisition alone requires developer tools. It is also not for a seller who values account safety above all, because the cookie method is fragile and potentially against platform rules. Before you run python main.py, verify that your LLM API key has sufficient quota and that the model you choose can follow the classification prompt reliably. If you cannot handle a broken bot at 2 a.m., this project is not for you.
Editorial conclusion
Adopt Xianyu AutoAgent if you are a Xianyu seller comfortable with Python, willing to handle your own cookies and API keys, and prepared to maintain your own prompt files. Do not adopt it if you need a stable, supported product, because the README warns that development may stop or the repository may be deleted at any time. Before running it, verify that your Xianyu account allows third-party automation, check that your chosen LLM endpoint supports the required prompt structure, and test the cookie string in a staging conversation. The project is a functional prototype that solves a real problem, but its legal and operational risks are yours to manage.
Community notes