Skip to content

feat(examples): add Chinese text ecommerce customer service demo - #260

Merged
sipercai merged 3 commits into
mainfrom
feat/ecommerce-customer-service-example
Aug 7, 2026
Merged

feat(examples): add Chinese text ecommerce customer service demo#260
sipercai merged 3 commits into
mainfrom
feat/ecommerce-customer-service-example

Conversation

@sipercai

@sipercai sipercai commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR adds a text-only Chinese-language LangGraph e-commerce customer-service example. It targets LangGraph 1.2+ and uses the supported LangChain 1.x create_agent API. An LLM intent router selects a presales or aftersales ReAct agent, each specialist uses a separate synthetic tool set, and a final LLM reviews the response before it is returned.

All customer-facing runtime content is Simplified Chinese, including prompts, fictional product/order/policy values, tool descriptions and errors, CLI output, example questions, and fail-open responses. Stable Python identifiers, graph node names, route enum values, and JSON schema keys remain in English. The Chinese README includes a ready-to-use training walkthrough for the scenario and trace structure.

The example is CLI-only and contains no image input, file upload, browser UI, customer data, or production commerce integration. All products, orders, policies, and tool results are fictional fixtures.

Fixes # (N/A)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • cd examples/ecommerce-customer-service && uv run --isolated --no-project --with-requirements requirements-dev.txt pytest tests -q
  • cd examples/ecommerce-customer-service && uv run --isolated --no-project --with-requirements requirements-dev.txt --with 'langgraph==1.2.10' --with 'langchain==1.3.14' --with 'langchain-openai==1.4.1' pytest tests -q
  • tox -e precommit
  • python3 .github/scripts/detect_loongsuite_changes.py with the pull-request changed-file set

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated (not required for an example-only change; use Skip Changelog)
  • Unit tests have been added
  • Documentation has been updated

Validation Evidence

Spec and Scope

  • Linked issue/spec: direct feature request; no public issue
  • Approved spec/comment: implement a text-only Chinese e-commerce support example without customer data
  • Changed surface: bilingual example documentation, Chinese CLI/runtime content, LangGraph workflow, synthetic tools, training walkthrough, and offline tests under examples/ecommerce-customer-service

Local Checks

Check Command Result Notes
Static readiness pipeline readiness checker and changed-file detector pass Example-only diff; detector reports no LoongSuite package changes
Precommit tox -e precommit pass Fresh pre-commit cache; clean worktree afterward
Focused tests commands listed above pass 10 tests pass with the declared LangGraph 1.2+ requirements and the pinned current stable 1.2.10 stack
Test-first red N/A N/A No instrumentation behavior or bug fix is introduced
VCR replay-only N/A N/A Offline tests use deterministic injected model responses and synthetic tools; no cassette is committed
External review earlier two-round diff review plus LangGraph v1 migration review partial The Chinese localization diff passed two-round review. The v1 delta was checked against the official migration contract and full tests; the external reviewer could not run because its login had expired.
Privacy scan changed example files pass No customer identifiers, credentials, private endpoints, or local paths

Business Isolation

Scenario Status Evidence
prepare/start fault N/A No instrumentation wrapper or callback lifecycle changed
response mapping/stop fault pass Specialist and final-review failures return bounded Chinese fallback responses
fail callback fault N/A No instrumentation callback changed
stream chunk/final callback fault N/A The example uses non-streaming invocation
early close/cancellation/GeneratorExit N/A The example does not expose a stream API
cross-task or cross-Context stream N/A The example does not expose a stream API
clean sibling after fault pass Concurrent workflow test proves route and answer state remains isolated

Real E2E Matrix

Scenario Status Command or Demo Evidence
non-streaming pass Chinese text-only deployed smoke on LangGraph 1.2.10 / LangChain 1.3.14 Eight real Chinese questions returned HTTP 200: presales 3, aftersales 3, clarify 2
streaming N/A N/A The example intentionally exposes a text question/answer invocation only
concurrency pass test_concurrent_invocations_keep_routes_and_answers_isolated Concurrent states retain separate routes and answers
agent/tool/ReAct pass Chinese presales and aftersales deployed smoke Presales and aftersales questions selected different named agents, executed LangGraph v1 model/tool loops, and reached the final reviewer
tool-heavy pass Chinese product/inventory/knowledge flow Product search, product knowledge, and inventory tools returned synthetic Chinese evidence before the reviewed answer
error path pass test_specialist_and_reviewer_fail_open and test_cli_reports_a_chinese_error_for_a_blank_question Specialist/reviewer and invalid-input failures return stable Chinese responses without escaping

Telemetry and Weaver

Check Status Command or Artifact Notes
Span tree / span kinds pass Cloud trace readback from the final LangGraph 1.2.10 Pod Eight fresh business traces were attributed to the final Pod; presales and aftersales samples contain router LLM, selected named AGENT, repeated LLM/TOOL children, and response-review LLM spans
Content capture modes N/A N/A This example does not change instrumentation or content-capture behavior
Concurrency isolation N/A N/A No instrumentation concurrency behavior changed
Weaver live-check blocked Registry live-check The current registry advisor reports a pre-existing duplicated local-variable definition

CI

  • GitHub checks: the previous revision passed all executable CodeQL, LoongSuite, docs, precommit, typecheck, and CLA checks
  • Known unrelated failures: one stale changelog event was created before the Skip Changelog label; subsequent PR events see the label
  • Follow-up needed: inspect the new revision checks after push

@sipercai sipercai added enhancement New feature or request documentation Improvements or additions to documentation Skip Changelog PRs that do not require a CHANGELOG.md entry labels Aug 7, 2026

@ralf0131 ralf0131 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This PR adds a well-structured text-only e-commerce customer service example using LangGraph. The workflow correctly implements intent routing, specialist ReAct agents, and a final review step. Tests provide good coverage with deterministic mock models for offline execution.

Verdict: APPROVED — Clean example code, good test coverage, proper error handling.

Observations (non-blocking)

  • workflow.py:_route_intent — The bare except Exception is intentional (fail-open), which is appropriate for an example. In production code, consider logging the exception for debugging.
  • tools.py — Clean separation of PRESALES_TOOLS and AFTERSALES_TOOLS. The synthetic data is well-structured and clearly fictional.
  • tests/ — The DeterministicToolModel and FixedClassifier patterns are excellent for deterministic testing without external dependencies.

Automated review by github-manager-bot

@sipercai sipercai changed the title feat(examples): add text ecommerce customer service demo feat(examples): add Chinese text ecommerce customer service demo Aug 7, 2026

@ralf0131 ralf0131 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-approved after new commit (localization to Chinese). The changes look good:

  • Clean localization of prompts, tool descriptions, fictional data, and CLI output to Simplified Chinese
  • Python identifiers, graph node names, and route enums remain in English (good practice)
  • All CI checks passing, CLA signed

Automated review by github-manager-bot

@ralf0131 ralf0131 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This PR adds a well-structured Chinese e-commerce customer service demo using LangGraph, showcasing intent routing, specialist ReAct agents with isolated tool sets, and a review step before responding. Code quality is high with solid error handling, comprehensive tests, and clear documentation.

LGTM — nice example that demonstrates the LoongSuite instrumentation capabilities end-to-end.


Automated review by github-manager-bot

@sipercai
sipercai merged commit 22aaa20 into main Aug 7, 2026
22 checks passed
@sipercai
sipercai deleted the feat/ecommerce-customer-service-example branch August 7, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants