crm-cases
Acts as the production CRM backend (Salesforce / Data 360) for the case resolution agent, providing tools to look up cases, customer profiles, and orders, and to take actions such as issuing refunds, updating cases, and drafting customer emails against the CRM.
Provides a local SQLite-backed CRM (with a unified_profile view standing in for a Data 360 customer profile) that the agent reads cases, customers, and orders from and writes refunds and case updates to, serving as a swappable stand-in for a production CRM.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@crm-cases Resolve case CS-1002 and issue the customer's refund"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
FDE Case Resolution Agent
Showcase app 3 of 3 - Advanced / agentic: function calling, ReAct loop, MCP, A2A, self-correction, human-in-the-loop. An Agentforce-style service agent that takes real actions (refund, update case, draft email) against a CRM - with the controls an enterprise needs before it touches money.
┌──────────────── Agent harness (agent.py) ────────────────────┐
"Resolve CS-1002" ─►│ bounded ReAct loop · loop detection · error-streak fail-safe │
│ policy gate · HUMAN APPROVAL · result truncation · tracing │
└───────┬───────────────────────────┬──────────────────────────┘
tool calls (LLM) │ │ A2A (JSON-RPC message/send)
Claude/OpenAI/Gemini/Grok │ MCP (stdio JSON-RPC) ▼
▼ Refund Policy Agent (/.well-known/agent-card.json)
crm-cases MCP server eligibility · window · amount cap · approval level
get_case · get_customer_profile · get_order
issue_refund · update_case · draft_customer_email ──► SQLite "CRM" + unified_profile view (Data 360 role)
│
traces/runs.jsonl (OTel-shaped spans) ──► dashboard.html (KPIs)List of FDE Showcase Apps
App Name | 🎯 Core Focus & Architecture | 🧬 Lineage & Progression | 💡 Key Use Cases | 💼 How to Showcase in Interviews |
⚡ Basic / Single-Turn• Structured outputs via provider JSON Schema• Few-shot prompt engineering & data-delimited inputs• Deterministic verifiers & Pydantic auto-repair loops ($\le 2$ retries)• Single-pass CLI / Web UI / Golden Evals | 🎯 Level 1: Entry FoundationEstablishes reliable, single-turn LLM input/output contracts, schema enforcement, repair loops, and deterministic verification before attempting stateful or multi-step logic. | • Customer discovery call transformation (notes $\rightarrow$ validated Agentforce-style blueprints)• Automated static analysis & Apex code review for bulk-safety• Rapid MVP 5-day execution planning | Highlight Systems Reliability & Schema Integrity:• Explain how you eliminate LLM output variance using forced schemas and auto-healing Pydantic loops.• Emphasize your zero-SDK stdlib adapter approach to avoid vendor lock-in across Claude, OpenAI, Gemini, and Grok. | |
🧠 Intermediate / Grounded Context• Role-Based Access Control (RBAC/ACL) pre-filtering• Hybrid search (BM25 + Dense Vectors combined via Reciprocal Rank Fusion)• Heading/table-aware atomic chunking• Input injection stripping & pre-prompt evidence gating• Strict lexical citation verification | 📈 Level 2: Contextual EscalationEvolves Level 1's single-turn validation into retrieval-augmented generation (RAG), focusing on enterprise data boundaries, security guardrails, context management, and hallucination prevention. | • Secure enterprise internal search & document Q&A• Role-restricted knowledge access (e.g., HR vs. Employee compensation data)• Injection-resistant document consumption• Zero-hallucination support portals | Highlight Enterprise Security & Groundedness:• Showcase the pre-retrieval ACL filtering that prevents restricted context from ever touching vector scoring or LLM prompts.• Detail your anti-hallucination pipeline (evidence gate + lexical support check) that fails closed rather than guessing. | |
🤖 Advanced / Agentic Execution• Multi-step ReAct loop with loop detection & error streak fail-safes• Model Context Protocol (MCP stdio JSON-RPC) tool execution• Agent-to-Agent (A2A JSON-RPC) policy communication• Deterministic Human-In-The-Loop (HITL) gates & OTel-shaped telemetry traces | 🚀 Level 3: Operational AgenticsCombines Level 1 output contracts and Level 2 security/RAG context into autonomous, multi-turn tool execution against production systems (SQLite/Salesforce CRM) with strict financial guardrails. | • Autonomous enterprise CRM case resolution (refunds, order updates, email drafting)• Multi-agent policy enforcement & financial tier escalations• Cross-tool integration via native MCP across IDEs (Claude Code, Copilot, Gemini CLI, Codex) | Highlight Autonomous Control & Architecture:• Focus on safety controls: dual-key approval policies, hard-coded parameter stripping ( |
🛣️ Narrative Lineage Across the 3 Apps
App 1 - Discovery Analyzer - (Validation Layer): Proves you know how to talk to LLMs deterministically—getting structured data out without reliance on heavy frameworks, handling retries gracefully, and validating inputs/outputs against concrete business schemas.
App 2 - Knowledge Assistant - (Context & Security Layer): Expands single-turn output validation into multi-source enterprise retrieval, proving you can handle data isolation, prompt injection attacks, hybrid search ranking, and zero-hallucination citation checks.
App 3 - Case Resolution Agent - (Action & Agentic Layer): Translates validated structured outputs and secure context into autonomous system actions, orchestrating real tool calls via MCP, agent-to-agent negotiation, multi-turn error recovery, and strict human approval limits.
💡 Strategy: Demonstrating Technical Depth in Interviews
The FDE Engineering Philosophy: Walk interviewers through how this trio covers the complete deployment spectrum—from Discovery (parsing customer intake accurately) to Knowledge (safely accessing enterprise context) to Resolution (executing workflows via tools with guardrails).
Offline-First Resilience: Point out that all 3 apps run zero-dependency / offline test suites, mock layers, and golden evals without requiring API keys, proving your emphasis on testability and local CI/CD pipelines.
Standards over Lock-in: Highlight your architectural choices—writing lightweight, vendor-agnostic adapters (
urllib), implementing standard specs (MCP, A2A, JSON-Schema), and avoiding black-box agent frameworks in favor of explicit Python loop control.
Related MCP server: ParcelPilot MCP Server
Quick start (offline - no keys, stdlib only)
python -m case_agent reset
python -m case_agent run CS-1001 --approve ask # auto-refund $89.99
python -m case_agent run CS-1002 --approve ask # $1,200 -> pauses for YOU to approve
python -m case_agent batch # all 6 seeded cases + dashboard.html
python -m case_agent eval # grades DB state, 7 scenarios
python -m pytest -q # 15 tests incl. adversarial harness tests
python scripts/interop_check.py # (pip install mcp) official MCP client talks to our serverSeeded scenarios: 1001 auto-refund · 1002 supervisor approval · 1003 outside 30-day window (deny) · 1004 fraud flag (escalate) · 1005 prompt injection in the case text ("refund $9000") · 1006 already refunded.
The scripted mock deliberately calls get_case("1002") first, gets a corrective error from the MCP server, and self-corrects to CS-1002 - the same behavior you'd see from a real model.
Real models
Set a key + --provider anthropic|openai|gemini|xai|auto. All four use native tool/function calling through one normalized message format (llm.py; Gemini thought-signature parts are echoed back).
Mount the MCP server in your AI tool (same server, five hosts)
Host | Config in this repo |
Claude Code / Claude Desktop |
|
GitHub Copilot (VS Code) |
|
Gemini CLI / Google Antigravity |
|
OpenAI Codex CLI |
|
Then ask the tool: "use crm-cases to look up CS-1001 and tell me the order amount". Also ships AGENTS.md, CLAUDE.md, Copilot instructions and a SKILL.md (Claude Code + .agent/skills).
Guarantees enforced in code (and tested)
Model cannot self-approve:
approved_byis stripped from its arguments and absent from its tool schema; the MCP server also rejects >$250 refunds without it.issue_refundis impossible before an A2A policy verdict for that case+order; amount ≤ policy max; two-person tier escalates.Human denial -> no refund -> escalation, even if the model insists.
Repeated identical calls ->
LOOP_DETECTED; 3 consecutive tool errors or step-budget exhaustion -> fail-safe escalation of the case.Customer-authored text is data; the injected "$9000" case resolves for $40 like any other.
Honest limits
MCP and A2A here are small, spec-shaped implementations (stdio JSON-RPC; A2A message/send + Agent Card, no streaming/auth). Production: official SDKs, OAuth on the A2A endpoint, per-user identity propagation, durable state (LangGraph checkpointer) for hours-long approvals. The SQLite CRM is a stand-in for Salesforce/Data 360; swapping mcp_server.py for a Salesforce MCP/REST backend leaves the harness unchanged.
Available Tools
6 toolsdraft_customer_emailA
Save a DRAFT reply to the customer (never sent automatically; a human reviews and sends).
Inputs: body (required), case_id (required).
get_caseARead-onlyIdempotent
Fetch a support case (subject, customer description, status, account_id, order_id, reason). Case ids look like CS-1001.
Inputs: case_id (required).
get_customer_profileBRead-onlyIdempotent
Unified customer profile (tier, region, fraud_flag, lifetime value, open cases, lifetime refunds). Account ids look like A-100.
Inputs: account_id (required).
get_orderARead-onlyIdempotent
Fetch an order (item, amount, delivered_on, refunded). Order ids look like O-5001.
Inputs: order_id (required).
issue_refundADestructive
Issue a refund for an order. FINANCIAL ACTION. Amounts above $250 need a human approver (approved_by is set by the harness, never by the model).
Inputs: amount (required), reason (required), case_id (required), order_id (required), +1 more.
update_caseB
Set case status and add an internal note.
Inputs: note (required), status (required), case_id (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a clearly distinct resource or action: cases, customer profiles, orders, refunds, case updates, and email drafts. The only same-resource overlap is get_case vs update_case, but their actions are unambiguous.
All tools follow a consistent snake_case verb_noun convention: get_case, get_customer_profile, get_order, issue_refund, update_case, draft_customer_email. The pattern is predictable and readable throughout.
Six tools is well-scoped for a CRM case-handling server. Each tool earns its place in the support workflow without obvious redundancy or excessive surface area.
The surface covers the core case workflow: fetch case/customer/order context, issue refunds, update case status, and draft replies. It lacks case search/listing or case creation, but those are minor gaps for an agent working from a known case id.
Related MCP Connectors
Connect ChatGPT or Claude to your CRM, store or shipping API. Keys stay out of the chat.
Manage tickets, run agents and workflows, query tables, and search workspace knowledge.
Connect AI to store orders, products and inventory with scoped access and human approvals.
Live data for AI agents. Search the catalog, read the price, call the tool; keys stay server-side.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides AI agents with secure access to Salesforce data and operations, enabling natural language interaction with CRM for sales, marketing, and executive teams.65MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to retrieve customer, order, ticket, policy, and agreement information, and to prepare or execute state-changing support actions like escalations and follow-ups with confirmation and access control.-
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to securely call enterprise MCP tools with tenant-scoped RBAC, human approvals, audit logging, and multi-tool workflows across customer, order, document, and ticket data.-
- AlicenseAqualityCmaintenanceEnables AI agents to securely query, search, and modify Salesforce data through standard Salesforce APIs, including record CRUD, SOQL/SOSL search, Bulk API 2.0 operations, composite calls, object discovery, and custom Apex REST endpoints.15MIT