Skip to content

Latest commit

ย 

History

History
208 lines (159 loc) ยท 7.92 KB

File metadata and controls

208 lines (159 loc) ยท 7.92 KB

๐Ÿ›ฐ๏ธ BorderPilot ยท ่ทจๅขƒ็”ตๅ•† AI Agent ๅทฅไฝœๆตๅนณๅฐ

ๅคš Agent ๅทฅไฝœๆต for ่ทจๅขƒๅ‡บๆตท โ€” TrendScout โ†’ MarketAnalyst โ†’ ListingCraft โ†’ QualityCheck๏ผŒ ็”จ LangGraph ็ผ–ๆŽ’ใ€‚

Multi-agent workflow platform for cross-border e-commerce โ€” TrendScout โ†’ MarketAnalyst โ†’ ListingCraft โ†’ QualityCheck, orchestrated with LangGraph.

Python3.9+ License: MIT Built with LangGraph Live demo (HF Spaces)


๐Ÿ‡จ๐Ÿ‡ณ ไธญๆ–‡่ฏดๆ˜Ž

โœจ ่ฟ™ๆ˜ฏไป€ไนˆ๏ผŸ

BorderPilot ๆ˜ฏไธ€ไธช็ซฏๅˆฐ็ซฏ็š„่ทจๅขƒ็”ตๅ•† AI Agent ๅไฝœๅนณๅฐ๏ผŒๅฑ•็คบไบ†ไธ€็ป„ไธ“ไธšๅŒ– LLM Agent ๅฆ‚ไฝ•่ท‘้€šๆ•ดไธชๅ‡บๆตทไธšๅŠก้“พๆก๏ผš

  1. TrendScout๏ผˆ่ถ‹ๅŠฟไพฆๅฏŸ๏ผ‰ โ€”โ€” ๆ นๆฎ็งๅญ่ฏ๏ผˆๅฆ‚ "wireless earbuds"๏ผ‰ๆŒ–ๅ‡บๅ€™้€‰็ˆ†ๅ“ใ€‚
  2. MarketAnalyst๏ผˆๅธ‚ๅœบๅˆ†ๆž๏ผ‰ โ€”โ€” ๅฏนๅคด้ƒจๅ€™้€‰ๅš go/no-go ๅˆคๆ–ญ๏ผˆๅธ‚ๅœบ่ง„ๆจกใ€็ซžๅ“ใ€้ฃŽ้™ฉ๏ผ‰ใ€‚
  3. ListingCraft๏ผˆๅคš่ฏญ่จ€ Listing๏ผ‰ โ€”โ€” ้’ˆๅฏน Amazon / eBay / Shopify ็ญ‰ๅคšๅนณๅฐใ€ๅคš่ฏญ่จ€ ๏ผˆen / en-GB / de / ja๏ผ‰ๆ‰น้‡็”Ÿๆˆๅˆ่ง„ Listingใ€‚
  4. QualityCheck๏ผˆๅˆ่ง„ๆ ก้ชŒ๏ผ‰ โ€”โ€” ่ท‘่ง„ๅˆ™๏ผˆๆ ‡้ข˜้•ฟๅบฆใ€bullet ๆ•ฐ้‡ใ€่ฟ็ฆ่ฏ๏ผ‰+ LLM ๅ…œๅบ•ๅฎกๆ กใ€‚

Orchestrator ็”จ LangGraph ็Šถๆ€ๆœบ็ผ–ๆŽ’๏ผŒๅˆ†ๆžๅธˆ่ฟ”ๅ›ž no-go ๆ—ถ่‡ชๅŠจ็Ÿญ่ทฏ้€€ๅ‡บ โ€”โ€” ่ฟ™ๅฐฑๆ˜ฏ JD ้‡Œๅๅคๆๅˆฐ็š„ "Orchestrator๏ผˆๅๅŒ่€…๏ผ‰"ๆจกๅผใ€‚

๐Ÿงฉ ไธบไป€ไนˆ่ƒฝ็›ดๆŽฅๅฏนๆŽฅ่ฟ™ไธช JD๏ผŸ

่ฆๆฑ‚ ๆœฌ้กน็›ฎๅฏนๅบ”ๅฎž็Žฐ
Python + LangChain/LangGraph src/border_pilot/orchestrator.py๏ผˆLangGraph ็Šถๆ€ๆœบ๏ผ‰
ๅคš Agent / Agentic Workflow src/border_pilot/agents/๏ผˆ4 ไธช็‹ฌ็ซ‹ Agent๏ผ‰
Tool-using Agent ๆฏไธช Agent ้ƒฝ็”จๅทฅๅ…ท๏ผš็›ฎๅฝ•ๆฃ€็ดขใ€JSON ็บฆๆŸ LLM ่พ“ๅ‡บใ€่ง„ๅˆ™ๅผ•ๆ“Ž
่ทจๅขƒๅ‡บๆตท/ERP/CRM ListingCraft ่พ“ๅ‡บๅคšๅธ‚ๅœบๅคš่ฏญ่จ€ Listing๏ผŒ่ฆ†็›– Amazon/eBay/Shopify
้ƒจ็ฝฒ + GitHub ้“พๆŽฅ ๅทฒ้ƒจ็ฝฒ Gradio Demo๏ผŒๅฏๅฏนๆŽฅ HF Spaces
ๆŠ˜่…พๆฌฒ + ่ฐƒไผ˜ ๆฏไธช Agent ็‹ฌ็ซ‹ system prompt + ๆธฉๅบฆ๏ผŒไพฟไบŽๅˆ†่Š‚็‚น่ฐƒไผ˜
็œŸๅฎžไธšๅŠกๅœบๆ™ฏ "้€‰ๅ“ โ†’ ๅˆ†ๆž โ†’ Listing โ†’ ๅˆ่ง„"็ซฏๅˆฐ็ซฏ่ท‘้€š

๐Ÿš€ ไธ€ๅˆ†้’Ÿ่ท‘่ตทๆฅ

git clone https://github.com/hhdhh/border-pilot
cd border-pilot
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
python app.py # ๆต่งˆๅ™จๆ‰“ๅผ€ http://127.0.0.1:7860

ๆ— ้œ€ไปปไฝ• API Key โ€”โ€” ้ป˜่ฎค่ตฐ mock LLM๏ผŒๅ…จๆต็จ‹ๅœจๆœฌๅœฐ / Space ไธŠ้ƒฝ่ƒฝ่ท‘ใ€‚ ่ฎพ็ฝฎ ANTHROPIC_API_KEY ๅŽๅˆ‡ๅˆฐ Claude๏ผ›่ฎพ็ฝฎ HF_TOKEN ๅˆ‡ๅˆฐ HuggingFace ๅ…่ดนๆจกๅž‹ใ€‚

๐Ÿ“Š ๆต‹่ฏ•

PYTHONPATH=src pytest -q

5/5 ๆต‹่ฏ•้€š่ฟ‡๏ผŒๅŒ…ๅซๅฎŒๆ•ดๅทฅไฝœๆต + ๅˆ่ง„่ง„ๅˆ™ + CLIใ€‚


๐Ÿ‡ฌ๐Ÿ‡ง English

โœจ What is BorderPilot?

A recruiting-grade demo of how a team of specialised LLM agents can run an end-to-end cross-border e-commerce workflow:

  1. TrendScout surfaces candidate products from a seed query.
  2. MarketAnalyst turns the top candidate into a go/no-go brief (TAM estimate, sweet spot, competitors, risk flags).
  3. ListingCraft writes marketplace-ready listings in multiple locales (Amazon US/UK/DE/JP, eBay, Shopify, ...).
  4. QualityCheck runs rule-based + LLM-assisted compliance checks and emits an approval decision.

The orchestrator is a LangGraph state machine with conditional edges: when the analyst returns no-go, the pipeline short-circuits to END.

The full workflow runs with the mock LLM and zero API keys, so it boots cleanly on HuggingFace Spaces and in CI. Set ANTHROPIC_API_KEY (Claude) or HF_TOKEN (Mistral / Llama) to swap in a real model at runtime โ€” no code changes required.

๐Ÿงฉ How it maps to the JD

If you came here from the ่ทจๅขƒๅ‡บๆตท AI Agentๅทฅ็จ‹ๅธˆ posting, here is the explicit trace from this repo to the role:

Requirement Where in this repo
Python + LangChain/LangGraph src/border_pilot/orchestrator.py
Multi-agent / Agentic Workflow src/border_pilot/agents/*
Tool-using agents src/border_pilot/tools/*, _parse_json_array in trend_scout
RAG / prompt engineering hooks MockLLM prompts per agent (each agent has its own system prompt + temperature)
Cross-border domain ListingCraft writes per-marketplace drafts in en / en-GB / de / ja with marketplace caps
Shipping a live demo app.py -> HuggingFace Space
Open-source hygiene pyproject.toml, tests, CLI, docs, MIT license

๐Ÿš€ Quickstart

git clone https://github.com/hhdhh/border-pilot
cd border-pilot
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
python app.py # opens Gradio UI on http://127.0.0.1:7860

Or run headless:

PYTHONPATH=src BORDER_PILOT_LLM=mock python -m border_pilot.cli demo

๐Ÿ—๏ธ Architecture

 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” ranked trends โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” decision=go โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
 โ”‚ TrendScout โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ MarketAnalyst โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚ ListingCraft โ”‚
 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ watch / no-go โ”€โ”€โ–บ END โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
 โ”‚
 โ–ผ per-locale drafts
 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
 โ”‚ QualityCheck โ”‚ โ”€โ”€โ–บ END (overall_score + recommendation)
 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • LangGraph wires the nodes; conditional edges branch on analyst decision.
  • Typed state (BorderPilotState) keeps the contract explicit.
  • Tool-using agents: catalogue retrieval, JSON-constrained LLM output, deterministic compliance rules (title length, bullet count, banned words).
  • Pluggable LLM: make_llm() selects anthropic / huggingface / mock from env vars. The mock keeps the demo fully offline.

Full design notes live in docs/architecture.md.

๐Ÿงช Tests

PYTHONPATH=src pytest -q

tests/test_smoke.py exercises the full graph with the mock LLM, plus focused tests for quality_check (banned words, length rules) and the CLI.


๐Ÿ—‚๏ธ Project layout / ้กน็›ฎ็ป“ๆž„

border-pilot/
โ”œโ”€โ”€ app.py # Gradio entrypoint (used by HF Spaces)
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ src/
โ”‚ โ””โ”€โ”€ border_pilot/
โ”‚ โ”œโ”€โ”€ state.py # TypedDict state schema
โ”‚ โ”œโ”€โ”€ orchestrator.py # LangGraph wiring + run() helper
โ”‚ โ”œโ”€โ”€ cli.py # python -m border_pilot.cli
โ”‚ โ”œโ”€โ”€ agents/
โ”‚ โ”‚ โ”œโ”€โ”€ trend_scout.py
โ”‚ โ”‚ โ”œโ”€โ”€ market_analyst.py
โ”‚ โ”‚ โ”œโ”€โ”€ listing_craft.py
โ”‚ โ”‚ โ””โ”€โ”€ quality_check.py
โ”‚ โ””โ”€โ”€ tools/
โ”‚ โ”œโ”€โ”€ llm.py # Anthropic + HF + Mock providers
โ”‚ โ””โ”€โ”€ data.py # Trend catalogue / live-search hook
โ”œโ”€โ”€ tests/
โ”‚ โ””โ”€โ”€ test_smoke.py
โ”œโ”€โ”€ examples/
โ”‚ โ””โ”€โ”€ demo_run.py
โ”œโ”€โ”€ docs/
โ”‚ โ””โ”€โ”€ architecture.md
โ””โ”€โ”€ deploy/
 โ””โ”€โ”€ huggingface/
 โ””โ”€โ”€ README.md

๐Ÿ” Environment variables

Var Effect
BORDER_PILOT_LLM=mock (default) Use the deterministic mock provider
BORDER_PILOT_LLM=anthropic + ANTHROPIC_API_KEY Use Claude (claude-3-5-sonnet-latest)
BORDER_PILOT_LLM=huggingface + HF_TOKEN Use HF Inference API (Mistral-7B-Instruct-v0.3)
BORDER_PILOT_LIVE_SEARCH=1 TrendScout will try a live search before falling back to catalogue

๐Ÿ“ฆ License

MIT โ€” see LICENSE.


Built end-to-end in one session with an AI-native workflow: Cursor + Claude + this agent harness. PRs welcome.

ไธ€ไธชไผš่ฏๅ†…ๅ…จๆ ˆๆญๅ‡บๆฅ๏ผšCursor + Claude + ่ฟ™ไธช Agent ่„šๆ‰‹ๆžถใ€‚ๆฌข่ฟŽๆ PRใ€‚