How ys-pundir/cartmind-agentic-ecommerce-support works
Cartmind is an e-commerce support agent: a user submits a question through the chat UI or terminal, the agent guards and classifies it, dispatches to policy retrieval, order lookup, feedback, or human deferral, then generates and validates a structured response. The README documents thread-scoped SQLite checkpointing and API/MCP entry points; sampled HTTP code also shows persisted conversation history and document uploads. The graph follows documented routing where implementation excerpts are absent; those links are not inferred beyond the stated flow.
Main entry points: graph.py LangGraph flow · nodes.py Generate response · main.py HTTP API · agent.py Agent runner
Components 26
User interfaces
- Chat frontend
frontend/app.js - HTTP API
src/agent/main.py - Terminal app
src/agent/terminal_application.py - MCP client
mcp_server/client.py - Order MCP server
mcp_server/server.py
Agent workflow
- Agent runner
src/agent/agent.py - LangGraph flow
src/agent/graph.py - Guard and classify
src/agent/nodes.py - Generate response
src/agent/nodes.py
Policy knowledge
- Policy tool
src/tools/rag_tool.py - Retrieve passages
src/rag/retrieval.py - Embedding model
src/rag/embeddings.py - Policy vectors
src/rag/vector_store.py - Grounded generation
src/rag/generation.py
Support actions
- Order lookup
src/tools/sql_tool.py - Orders database
scripts/seed.py - Feedback tool
src/tools/feedback_tool.py - Human deferral
src/tools/deffered_tool.py
State and safeguards
- PII masking
src/guardrails/pii.py - Injection detection
src/guardrails/injection.py - Ticket validation
src/structured_output/validate_ticket.py - LLM client
src/llm_client.py - Graph checkpoint
src/agent/agent.py - Conversation history
src/memory/conversation.py
Other components
- Customer
- Groq service
Connections 33
- Customer → Chat frontend: sends message
- Chat frontend → HTTP API: HTTP requests
- Customer → Terminal app: enters query
- Terminal app → Agent runner: runs agent
- MCP client → Order MCP server: calls tool
- Order MCP server → Orders database: queries
- HTTP API → Agent runner: runs or resumes
- HTTP API → Conversation history: reads and updates
- Agent runner → LangGraph flow: invokes
- LangGraph flow → Guard and classify: starts at
- Guard and classify → PII masking: masks text
- Guard and classify → Injection detection: checks text
- LangGraph flow → Policy tool: routes policy
- LangGraph flow → Order lookup: routes order
- LangGraph flow → Feedback tool: routes feedback
- LangGraph flow → Human deferral: routes escalation
- Policy tool → Grounded generation: requests answer
- Grounded generation → Retrieve passages: retrieves context
- Retrieve passages → Policy vectors: searches
- Retrieve passages → Embedding model: embeds query
- HTTP API → Embedding model: indexes uploads
- Order lookup → Orders database: queries
- LangGraph flow → Generate response: continues to
- Policy tool → Generate response: returns tool result
- Order lookup → Generate response: returns tool result
- Feedback tool → Generate response: returns tool result
- Human deferral → Generate response: returns tool result
- Generate response → LLM client: requests generation
- LLM client → Groq service: calls when enabled
- Generate response → Ticket validation: validates ticket
- Agent runner → Graph checkpoint: checkpoints state
- Agent runner → Conversation history: persists turns
- HTTP API → Chat frontend: returns answer