Spaces:
Sleeping
Sleeping
| # π§ͺ Agent Builder Isolation Test Guide | |
| ## What Was Implemented | |
| Each user now has **completely isolated agent storage**: | |
| - User A's agents are invisible to User B | |
| - User B's agents are invisible to User A | |
| - Each user builds and manages their own agents independently | |
| --- | |
| ## π― Quick Test (5 Minutes) | |
| ### Prerequisites: | |
| - β Two different browser windows (or one normal + one incognito) | |
| - β Two different user accounts | |
| ### Test Steps: | |
| #### 1. User A Creates an Agent | |
| **Browser 1 (User A):** | |
| ``` | |
| 1. Login at: https://huggingface.co/spaces/John-jero/IDWeekAgents | |
| 2. Go to "Agent Builder" tab | |
| 3. Create an agent: | |
| - Agent Type: π₯ Clinical Assistant | |
| - Agent Name: "UserA_Agent" | |
| - Mission: "Help User A with medical queries" | |
| - Select any skills | |
| 4. Click "Build Agent" | |
| 5. Wait for "β Agent generated successfully!" | |
| 6. CHECK: "Active Agents" list should show "UserA_Agent" | |
| ``` | |
| #### 2. User B Creates a Different Agent | |
| **Browser 2 (User B):** | |
| ``` | |
| 1. Login with different credentials | |
| 2. Go to "Agent Builder" tab | |
| 3. CHECK: "Active Agents" should show "_(None yet)_" | |
| β User B should NOT see "UserA_Agent" | |
| 4. Create a different agent: | |
| - Agent Type: π¬ Research Assistant | |
| - Agent Name: "UserB_Agent" | |
| - Mission: "Help User B with research" | |
| - Select any skills | |
| 5. Click "Build Agent" | |
| 6. CHECK: "Active Agents" should show ONLY "UserB_Agent" | |
| β Should NOT show "UserA_Agent" | |
| ``` | |
| #### 3. Verify Isolation | |
| **Browser 1 (User A):** | |
| ``` | |
| 1. Refresh the page or check "Active Agents" | |
| 2. CHECK: Should show ONLY "UserA_Agent" | |
| β Should NOT see "UserB_Agent" | |
| ``` | |
| #### 4. Test Chat Panel Isolation | |
| **Browser 1 (User A):** | |
| ``` | |
| 1. Go to "Chat Panel" tab | |
| 2. Agent dropdown should show ONLY "UserA_Agent" | |
| 3. Select "UserA_Agent" and chat with it | |
| ``` | |
| **Browser 2 (User B):** | |
| ``` | |
| 1. Go to "Chat Panel" tab | |
| 2. Agent dropdown should show ONLY "UserB_Agent" | |
| β Should NOT show "UserA_Agent" | |
| 3. Select "UserB_Agent" and chat with it | |
| ``` | |
| --- | |
| ## β Success Criteria | |
| ### PASS if: | |
| - [ ] User A sees only their agents ("UserA_Agent") | |
| - [ ] User B sees only their agents ("UserB_Agent") | |
| - [ ] Chat Panel dropdowns show correct agents per user | |
| - [ ] No cross-contamination between users | |
| - [ ] Both users can build agents simultaneously | |
| ### FAIL if: | |
| - [ ] User B sees "UserA_Agent" | |
| - [ ] User A sees "UserB_Agent" | |
| - [ ] Agents get mixed up | |
| - [ ] Building an agent affects other users | |
| --- | |
| ## π¬ Advanced Tests | |
| ### Test 1: Remove Agent Isolation | |
| **User A:** | |
| ``` | |
| 1. Create agent "TestAgent1" | |
| 2. Go to agent removal dropdown | |
| 3. Select and remove "TestAgent1" | |
| 4. CHECK: Agent removed from User A's list | |
| ``` | |
| **User B:** | |
| ``` | |
| 1. Check if User B was affected | |
| 2. User B's agents should be unchanged | |
| ``` | |
| ### Test 2: Multiple Agents Per User | |
| **User A:** | |
| ``` | |
| 1. Create "AgentA1" | |
| 2. Create "AgentA2" | |
| 3. Create "AgentA3" | |
| 4. CHECK: All three visible to User A only | |
| ``` | |
| **User B:** | |
| ``` | |
| 1. Create "AgentB1" | |
| 2. CHECK: Only "AgentB1" visible, not User A's agents | |
| ``` | |
| ### Test 3: Chat History with Agent Isolation | |
| **User A:** | |
| ``` | |
| 1. Chat with "AgentA1": "Hi from User A" | |
| 2. Go to Chat Panel | |
| 3. Select "AgentA1" | |
| 4. CHECK: Chat history shows "Hi from User A" | |
| ``` | |
| **User B:** | |
| ``` | |
| 1. Chat with "AgentB1": "Hi from User B" | |
| 2. CHECK: Does NOT see User A's conversation | |
| ``` | |
| --- | |
| ## π Test Results Template | |
| ``` | |
| π§ͺ AGENT ISOLATION TEST RESULTS | |
| Date: ___________ | |
| Tester: ___________ | |
| β Quick Test | |
| [ ] User A creates agent β visible only to User A | |
| [ ] User B creates agent β visible only to User B | |
| [ ] No cross-contamination | |
| [ ] Chat Panel dropdowns correct per user | |
| β Advanced Tests | |
| [ ] Remove agent β affects only that user | |
| [ ] Multiple agents β isolated per user | |
| [ ] Chat histories β separate per user | |
| Overall Status: PASS / FAIL | |
| Issues Found: ___________ | |
| ``` | |
| --- | |
| ## π― What Was Changed | |
| ### Files Modified: | |
| 1. **`user_session_manager.py`** | |
| - Added `AGENTS_CONFIG` to SessionKeys | |
| 2. **`session_helpers.py`** | |
| - Added `get_user_agents_config()` | |
| - Added `save_user_agent()` | |
| - Added `get_user_agent()` | |
| - Added `remove_user_agent()` | |
| - Added `get_user_agent_names()` | |
| 3. **`app.py`** | |
| - Updated `load_agent_to_builder()` β per-user | |
| - Updated `remove_selected_agent()` β per-user | |
| - Updated `chat_selected_agent()` β per-user | |
| - Updated `refresh_chat_dropdown()` β per-user | |
| - Updated `handle_generate()` β saves to user's session | |
| - Updated `chatpanel_handle()` β loads from user's session | |
| 4. **`core/ui/ui.py`** | |
| - Updated `refresh_active_agents_widgets()` β per-user | |
| - Updated `build_active_agents_markdown_and_dropdown()` β per-user | |
| --- | |
| ## π Troubleshooting | |
| ### Issue: Both users see the same agents | |
| **Solution:** | |
| 1. Check that you're logged in with DIFFERENT usernames | |
| 2. Verify AUTH_CREDENTIALS is set in HF Spaces | |
| 3. Clear browser cache and re-login | |
| ### Issue: "refresh_active_agents_widgets" error | |
| **Solution:** | |
| 1. Check server logs in HF Spaces | |
| 2. Ensure all functions have `request: gr.Request` parameter | |
| 3. Verify session_helpers is imported correctly | |
| ### Issue: Agents disappear after refresh | |
| **Solution:** | |
| - This is EXPECTED - sessions are in-memory | |
| - Agents are cleared when you close browser or space restarts | |
| - To persist, would need database backend (future enhancement) | |
| --- | |
| ## π Expected Behavior | |
| ### β What Should Work: | |
| - Each user builds their own agents | |
| - Agent lists are completely separate | |
| - Chat Panel shows correct agents per user | |
| - Remove agent affects only that user | |
| - Concurrent agent building works | |
| ### β οΈ Known Limitations: | |
| - Agents lost after browser refresh (in-memory storage) | |
| - No cross-user agent sharing (by design) | |
| - Space restart clears all agents | |
| --- | |
| ## π Quick Validation | |
| **30-Second Test:** | |
| 1. Two browsers, different users | |
| 2. Both go to "Agent Builder" | |
| 3. User A builds "TestA" | |
| 4. User B should see empty list (no agents) | |
| 5. User B builds "TestB" | |
| 6. User A should still see only "TestA" | |
| **If this works β Agent isolation is working! β ** | |
| --- | |
| ## π What to Report | |
| If you find issues, note: | |
| 1. Which user saw the problem | |
| 2. What action was performed | |
| 3. What was expected vs what happened | |
| 4. Screenshot if possible | |
| 5. Browser console errors (F12) | |
| --- | |
| **Ready to test? Start with the Quick Test above!** π | |
| Your app now supports true multi-user agent building! Each workshop participant will work in their own isolated workspace. π | |