Skip to content

Latest commit

 

History

History

README.md

Customer support agent — Python

Runnable CLI that connects to DNotifier, seeds a support knowledge base, and chats with a production-style support agent.

Prerequisites

  • Python 3.9+
  • DNotifier app with AI enabled — app.dnotifier.com
  • DNOTIFIER_APP_ID and DNOTIFIER_SECRET

Run

cd dnotifier-examples/use-cases/customer-support-agent/python
cp .env.example .env
# edit .env — set DNOTIFIER_APP_ID and DNOTIFIER_SECRET

python3 -m venv .venv
source .venv/bin/activate          # Windows: .venv\Scripts\activate
pip install -r requirements.txt
python main.py

Expected startup:

Connected to DNotifier (AI support agent ready)
Seeding sample customer-support knowledge base…
Indexed: Password reset …
…
Ready. user_id=support-agent-demo  use_knowledge_base=True  session_id=(new)
you>

Example session:

you> How do I reset my password?
agent> …

you> /add VIP shipping | VIP orders ship in 1 business day.
Document added: …

you> How fast is VIP shipping?
agent> …

you> /quit

Commands

Command Action
(any text) Ask the support agent (send_ai)
/seed Re-index sample support docs
/add Title | content… Add one knowledge-base document
/kb on / /kb off Toggle useKnowledgeBase
/history Fetch AI history for this user
/help Show commands
/quit Disconnect and exit

What runs on startup

  1. Connects over HTTP with logs=True
  2. If SEED_KB=true, indexes sample FAQs via add_knowledge_base
  3. Opens an interactive prompt

Project layout

prompts.py           SUPPORT_SYSTEM_PROMPT + SUPPORT_KNOWLEDGE_PROMPT
knowledge_base.py    add_knowledge_base + seed_support_knowledge_base
support_agent.py     ask_support / fetch_support_history
client.py            DNotifier client factory
main.py              CLI entry

Key code

await add_knowledge_base(notifier, sender_id, KnowledgeDoc(
    title="Refunds and returns",
    content="Return window: 30 days…",
    type="policy",
    record_id="support-faq-refunds",  # required by Python SDK
))

result = await ask_support(
    notifier,
    question,
    sender_id=sender_id,
    session_id=session_id,
    use_knowledge_base=True,
)

Docs

See the use-case README and DNotifier product docs.