Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Data Analyst — Partner Portfolio Intelligence

A working demonstration of an AI employee configured by a Product Manager. This project shows how a PM defines the system prompt, selects the LLM model, sets scope boundaries, and configures tools — the core PM work behind shipping AI products.

What This Is

At a B2B SaaS platform serving 65,000+ channel partners, I configured an AI Data Analyst that helps partners monitor their small business (SMB) client portfolios. Partners ask questions in natural language — "Which of my clients should I call today?" — and the AI returns a specific client name, a reason, and a direct action.

This repo contains the actual configuration files I designed: the system prompt, capability definition, tool specifications, and the 5 agentic events that detect SMB churn before it cascades to partner churn.

Architecture

┌──────────────────────────────────────────────────────┐
│           AI EMPLOYEE: Data Analyst                   │
│                                                       │
│  PERSONALITY (prompts/personality.md)                 │
│  └── Data-focused, direct, one action per response   │
│                                                       │
│  CAPABILITY (config/capability.yaml)                  │
│  └── Bundles: prompt + tools + constraints + events  │
│                                                       │
│  SYSTEM PROMPT (prompts/system_prompt.md)             │
│  ├── Role definition                                 │
│  ├── 5 agentic event definitions                     │
│  ├── Everyday partner intents (question → action)    │
│  ├── Scope boundaries (what to decline)              │
│  ├── Response format (name + reason + action)        │
│  └── Executive report template                       │
│                                                       │
│  TOOLS (tools/*.yaml)                                │
│  ├── QueryClients — search SMB client records        │
│  ├── CheckActivity — get detailed activity data      │
│  ├── CalculateHealthScore — portfolio health metrics │
│  └── GenerateExecutiveReport — weekly AI narrative   │
│                                                       │
│  GUARDRAILS                                          │
│  ├── Decline billing/credits → redirect              │
│  ├── Never compare partners by name                  │
│  ├── Never give generic advice                       │
│  ├── Always name a specific client                   │
│  └── Never expose internal system IDs                │
│                                                       │
└──────────────────────────────────────────────────────┘

The 5 Agentic Events

These leading indicators detect SMB churn risk at the earliest stage — before it cascades to partner churn:

Event Detection Why It Matters
First Activation Signed up but zero work units Activated SMBs rarely churn in 90 days
Gone Quiet Zero activity for 7 consecutive days Strongest cancellation predictor — cancellation within 30 days
Portfolio Milestone All SMBs combined hit 100 units/week Partner retention roughly doubles after this threshold
Upsell Signal One SMB exceeds 30 units/week for 2 weeks Client ready for additional products
Health Score Ratio of active to total SMBs Single trackable number for portfolio health

Quick Start

Option 1: Command Line Chat

# Clone the repo
git clone https://github.com/YOUR_USERNAME/ai-data-analyst-portfolio.git
cd ai-data-analyst-portfolio

# Install dependencies
pip install -r requirements.txt

# Set your API key
export ANTHROPIC_API_KEY=your-key-here

# Run the chat
python app.py

Option 2: Streamlit Web UI

# Same setup as above, then:
streamlit run ui.py

This opens a web interface with:

  • Sidebar showing portfolio health metrics, at-risk clients, and upsell candidates
  • Chat interface where you ask portfolio questions
  • The AI responds using the system prompt and mock data

Try These Questions

Question What It Tests
"Which of my clients should I call today?" Core use case — returns specific names with reasons
"How is my portfolio doing?" Health score calculation and trend reporting
"Show me my weekly summary" Executive report template generation
"Who is ready for upsell?" Upsell signal detection (30 units/week threshold)
"Which clients have never used the product?" First activation event detection
"Tell me about my billing" Scope boundary test — AI declines and redirects
"Compare me to other partners" Guardrail test — AI declines naming others

Project Structure

ai-data-analyst-portfolio/
├── README.md                          ← You are here
├── app.py                             ← Command-line chat (Python + Claude API)
├── ui.py                              ← Streamlit web UI
├── requirements.txt                   ← Python dependencies
├── .env.example                       ← API key placeholder
├── .gitignore
│
├── config/
│   └── capability.yaml                ← Capability definition (bundles everything)
│
├── prompts/
│   ├── system_prompt.md               ← Full system prompt (role, events, boundaries)
│   └── personality.md                 ← Communication style and tone
│
├── tools/
│   ├── query_clients.yaml             ← Tool: search SMB client records
│   ├── check_activity.yaml            ← Tool: detailed activity data
│   ├── calculate_health_score.yaml    ← Tool: portfolio health metrics
│   └── generate_executive_report.yaml ← Tool: weekly narrative report
│
└── mock-data/
    └── portfolio.json                 ← 10 SMB clients with realistic data

The PM Work Behind This

This project demonstrates the Product Manager's role in configuring AI employees:

PM Activity File What I Did
Wrote the system prompt prompts/system_prompt.md Defined the AI's role, goals, response format, and 6 worked examples
Defined scope boundaries prompts/system_prompt.md Specified what the AI answers, declines, and never does
Set the personality prompts/personality.md Defined voice, tone calibration, and communication style
Designed agentic events config/capability.yaml Created 5 leading-indicator events with thresholds and retention impact
Specified tool interfaces tools/*.yaml Defined what APIs the AI calls, what data it sends, what comes back
Designed the executive report prompts/system_prompt.md Created the weekly narrative template with specific data points
Selected the LLM model app.py Chose Claude Sonnet balancing cost, speed, and quality
Created mock data mock-data/portfolio.json Built realistic portfolio data covering all 5 event scenarios

Context

This configuration pattern is based on a production AI employee platform serving 65,000+ channel partners with 8 AI employee types, 189 capabilities, 211 prompt modules, and 525 tool integrations. The same architecture (capability YAML + prompt markdown + tool YAML + constraints) is used across Voice Receptionist, Chat Receptionist, Social Media Manager, Reputation Specialist, Sales Assistant, Support Agent, Data Analyst, and Custom Employee types.

Author

Sangeetha K — Product Manager

  • Configured AI employees (system prompts, LLM selection, scope boundaries)
  • Defined agentic events for SMB-level churn detection
  • Helped peer Product Managers build social marketing AI and reputation management AI capabilities
  • Designed zero-touch payment infrastructure and integration architecture

License

MIT

About

AI Data Analyst — system prompt, LLM selection, scope boundaries, 5 agentic events. Live Streamlit demo.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages