Skip to content

feat: Add AI-Powered Agent Performance Scorecard with Gemini Coaching Insights#846

Open
samarthsugandhi wants to merge 2 commits into
ritesh-1918:gssocfrom
samarthsugandhi:feature/agent-scorecard-774
Open

feat: Add AI-Powered Agent Performance Scorecard with Gemini Coaching Insights#846
samarthsugandhi wants to merge 2 commits into
ritesh-1918:gssocfrom
samarthsugandhi:feature/agent-scorecard-774

Conversation

@samarthsugandhi
Copy link
Copy Markdown

Summary

Implements #774 — Real-time agent performance scorecard with AI-generated coaching insights using Gemini.

What's Changed

File Description
backend/agent_scorecard.py get_agent_metrics() queries Supabase, compute_performance_score() weighted formula, get_ai_coaching_tip() via Gemini, get_company_scorecard(), refresh_agent_scorecard()
backend/scorecard_router.py GET /api/scorecard/company/{id}, GET /api/scorecard/agent/{id}, POST /api/scorecard/refresh/{id} — all auth-guarded
backend/main.py +2 lines: import + register scorecard_router
supabase/migrations/20260531_add_agent_scorecards.sql agent_scorecards table + indexes
Frontend/src/components/AgentScorecard.jsx Circular score ring + 4 metric bars + AI coaching tip + skeleton loader
Frontend/src/components/AgentLeaderboard.jsx Color-coded ranked table (🥇🥈🥉) with green/amber/red score bands
backend/tests/test_agent_scorecard.py 8 unit tests for compute_performance_score()

How to Test

  1. Run SQL migration in Supabase dashboard
  2. cd backend && pytest tests/test_agent_scorecard.py -v → 8 tests pass
  3. Open agent profile page → scorecard with circular ring appears
  4. Open admin analytics → leaderboard shows all agents ranked by score
  5. POST /api/scorecard/refresh/{agent_id}?company_id=x → recomputes + returns AI tip

Checklist

  • All endpoints require Authorization: Bearer header
  • Gemini coaching tip has graceful fallback on failure
  • compute_performance_score() returns 0.0 when no ticket data
  • Score ring animates via CSS transition
  • Leaderboard rows color-coded: green ≥75, amber 50–74, red <50
  • Zero changes to existing files except 2 lines in main.py
  • 8 unit tests covering all edge cases

Closes #774

- Add backend/agent_scorecard.py: get_agent_metrics(), compute_performance_score(),
  get_ai_coaching_tip() via Gemini, get_company_scorecard(), refresh_agent_scorecard()
- Add backend/scorecard_router.py: GET /api/scorecard/company/{id},
  GET /api/scorecard/agent/{id}, POST /api/scorecard/refresh/{id}
- Register scorecard_router in backend/main.py
- Add supabase/migrations/20260531_add_agent_scorecards.sql
- Add Frontend/src/components/AgentScorecard.jsx: circular score ring +
  metric bars + AI coaching tip
- Add Frontend/src/components/AgentLeaderboard.jsx: color-coded ranked table
- Add backend/tests/test_agent_scorecard.py: 8 unit tests

Closes ritesh-1918#774
Copilot AI review requested due to automatic review settings May 31, 2026 08:28
@vercel
Copy link
Copy Markdown

vercel Bot commented May 31, 2026

@samarthsugandhi is attempting to deploy a commit to the ritesh Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 31, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 574c5349-fb66-46d6-b52f-8c5ec9a18646

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@samarthsugandhi
Copy link
Copy Markdown
Author

@ritesh-1918 Hi, this issue was originally raised by me, but the PR was submitted by @Daksh7785, who was neither assigned to the issue nor involved in its discussion. It appears that the solution was taken from my reported issue and merged without my contribution being considered.

Could you please review this situation and take appropriate action if it violates the project's contribution guidelines? Thank you.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants