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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# π§ͺ Agent Builder Isolation Test Guide
|
| 2 |
+
|
| 3 |
+
## What Was Implemented
|
| 4 |
+
|
| 5 |
+
Each user now has **completely isolated agent storage**:
|
| 6 |
+
- User A's agents are invisible to User B
|
| 7 |
+
- User B's agents are invisible to User A
|
| 8 |
+
- Each user builds and manages their own agents independently
|
| 9 |
+
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
## π― Quick Test (5 Minutes)
|
| 13 |
+
|
| 14 |
+
### Prerequisites:
|
| 15 |
+
- β
Two different browser windows (or one normal + one incognito)
|
| 16 |
+
- β
Two different user accounts
|
| 17 |
+
|
| 18 |
+
### Test Steps:
|
| 19 |
+
|
| 20 |
+
#### 1. User A Creates an Agent
|
| 21 |
+
|
| 22 |
+
**Browser 1 (User A):**
|
| 23 |
+
```
|
| 24 |
+
1. Login at: https://huggingface.co/spaces/John-jero/IDWeekAgents
|
| 25 |
+
2. Go to "Agent Builder" tab
|
| 26 |
+
3. Create an agent:
|
| 27 |
+
- Agent Type: π₯ Clinical Assistant
|
| 28 |
+
- Agent Name: "UserA_Agent"
|
| 29 |
+
- Mission: "Help User A with medical queries"
|
| 30 |
+
- Select any skills
|
| 31 |
+
4. Click "Build Agent"
|
| 32 |
+
5. Wait for "β
Agent generated successfully!"
|
| 33 |
+
6. CHECK: "Active Agents" list should show "UserA_Agent"
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
#### 2. User B Creates a Different Agent
|
| 37 |
+
|
| 38 |
+
**Browser 2 (User B):**
|
| 39 |
+
```
|
| 40 |
+
1. Login with different credentials
|
| 41 |
+
2. Go to "Agent Builder" tab
|
| 42 |
+
3. CHECK: "Active Agents" should show "_(None yet)_"
|
| 43 |
+
β
User B should NOT see "UserA_Agent"
|
| 44 |
+
4. Create a different agent:
|
| 45 |
+
- Agent Type: π¬ Research Assistant
|
| 46 |
+
- Agent Name: "UserB_Agent"
|
| 47 |
+
- Mission: "Help User B with research"
|
| 48 |
+
- Select any skills
|
| 49 |
+
5. Click "Build Agent"
|
| 50 |
+
6. CHECK: "Active Agents" should show ONLY "UserB_Agent"
|
| 51 |
+
β
Should NOT show "UserA_Agent"
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
#### 3. Verify Isolation
|
| 55 |
+
|
| 56 |
+
**Browser 1 (User A):**
|
| 57 |
+
```
|
| 58 |
+
1. Refresh the page or check "Active Agents"
|
| 59 |
+
2. CHECK: Should show ONLY "UserA_Agent"
|
| 60 |
+
β
Should NOT see "UserB_Agent"
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
#### 4. Test Chat Panel Isolation
|
| 64 |
+
|
| 65 |
+
**Browser 1 (User A):**
|
| 66 |
+
```
|
| 67 |
+
1. Go to "Chat Panel" tab
|
| 68 |
+
2. Agent dropdown should show ONLY "UserA_Agent"
|
| 69 |
+
3. Select "UserA_Agent" and chat with it
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
**Browser 2 (User B):**
|
| 73 |
+
```
|
| 74 |
+
1. Go to "Chat Panel" tab
|
| 75 |
+
2. Agent dropdown should show ONLY "UserB_Agent"
|
| 76 |
+
β
Should NOT show "UserA_Agent"
|
| 77 |
+
3. Select "UserB_Agent" and chat with it
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
---
|
| 81 |
+
|
| 82 |
+
## β
Success Criteria
|
| 83 |
+
|
| 84 |
+
### PASS if:
|
| 85 |
+
- [ ] User A sees only their agents ("UserA_Agent")
|
| 86 |
+
- [ ] User B sees only their agents ("UserB_Agent")
|
| 87 |
+
- [ ] Chat Panel dropdowns show correct agents per user
|
| 88 |
+
- [ ] No cross-contamination between users
|
| 89 |
+
- [ ] Both users can build agents simultaneously
|
| 90 |
+
|
| 91 |
+
### FAIL if:
|
| 92 |
+
- [ ] User B sees "UserA_Agent"
|
| 93 |
+
- [ ] User A sees "UserB_Agent"
|
| 94 |
+
- [ ] Agents get mixed up
|
| 95 |
+
- [ ] Building an agent affects other users
|
| 96 |
+
|
| 97 |
+
---
|
| 98 |
+
|
| 99 |
+
## π¬ Advanced Tests
|
| 100 |
+
|
| 101 |
+
### Test 1: Remove Agent Isolation
|
| 102 |
+
|
| 103 |
+
**User A:**
|
| 104 |
+
```
|
| 105 |
+
1. Create agent "TestAgent1"
|
| 106 |
+
2. Go to agent removal dropdown
|
| 107 |
+
3. Select and remove "TestAgent1"
|
| 108 |
+
4. CHECK: Agent removed from User A's list
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
**User B:**
|
| 112 |
+
```
|
| 113 |
+
1. Check if User B was affected
|
| 114 |
+
2. User B's agents should be unchanged
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
### Test 2: Multiple Agents Per User
|
| 118 |
+
|
| 119 |
+
**User A:**
|
| 120 |
+
```
|
| 121 |
+
1. Create "AgentA1"
|
| 122 |
+
2. Create "AgentA2"
|
| 123 |
+
3. Create "AgentA3"
|
| 124 |
+
4. CHECK: All three visible to User A only
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
**User B:**
|
| 128 |
+
```
|
| 129 |
+
1. Create "AgentB1"
|
| 130 |
+
2. CHECK: Only "AgentB1" visible, not User A's agents
|
| 131 |
+
```
|
| 132 |
+
|
| 133 |
+
### Test 3: Chat History with Agent Isolation
|
| 134 |
+
|
| 135 |
+
**User A:**
|
| 136 |
+
```
|
| 137 |
+
1. Chat with "AgentA1": "Hi from User A"
|
| 138 |
+
2. Go to Chat Panel
|
| 139 |
+
3. Select "AgentA1"
|
| 140 |
+
4. CHECK: Chat history shows "Hi from User A"
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
**User B:**
|
| 144 |
+
```
|
| 145 |
+
1. Chat with "AgentB1": "Hi from User B"
|
| 146 |
+
2. CHECK: Does NOT see User A's conversation
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
---
|
| 150 |
+
|
| 151 |
+
## π Test Results Template
|
| 152 |
+
|
| 153 |
+
```
|
| 154 |
+
π§ͺ AGENT ISOLATION TEST RESULTS
|
| 155 |
+
Date: ___________
|
| 156 |
+
Tester: ___________
|
| 157 |
+
|
| 158 |
+
β
Quick Test
|
| 159 |
+
[ ] User A creates agent β visible only to User A
|
| 160 |
+
[ ] User B creates agent β visible only to User B
|
| 161 |
+
[ ] No cross-contamination
|
| 162 |
+
[ ] Chat Panel dropdowns correct per user
|
| 163 |
+
|
| 164 |
+
β
Advanced Tests
|
| 165 |
+
[ ] Remove agent β affects only that user
|
| 166 |
+
[ ] Multiple agents β isolated per user
|
| 167 |
+
[ ] Chat histories β separate per user
|
| 168 |
+
|
| 169 |
+
Overall Status: PASS / FAIL
|
| 170 |
+
Issues Found: ___________
|
| 171 |
+
```
|
| 172 |
+
|
| 173 |
+
---
|
| 174 |
+
|
| 175 |
+
## π― What Was Changed
|
| 176 |
+
|
| 177 |
+
### Files Modified:
|
| 178 |
+
|
| 179 |
+
1. **`user_session_manager.py`**
|
| 180 |
+
- Added `AGENTS_CONFIG` to SessionKeys
|
| 181 |
+
|
| 182 |
+
2. **`session_helpers.py`**
|
| 183 |
+
- Added `get_user_agents_config()`
|
| 184 |
+
- Added `save_user_agent()`
|
| 185 |
+
- Added `get_user_agent()`
|
| 186 |
+
- Added `remove_user_agent()`
|
| 187 |
+
- Added `get_user_agent_names()`
|
| 188 |
+
|
| 189 |
+
3. **`app.py`**
|
| 190 |
+
- Updated `load_agent_to_builder()` β per-user
|
| 191 |
+
- Updated `remove_selected_agent()` β per-user
|
| 192 |
+
- Updated `chat_selected_agent()` β per-user
|
| 193 |
+
- Updated `refresh_chat_dropdown()` β per-user
|
| 194 |
+
- Updated `handle_generate()` β saves to user's session
|
| 195 |
+
- Updated `chatpanel_handle()` β loads from user's session
|
| 196 |
+
|
| 197 |
+
4. **`core/ui/ui.py`**
|
| 198 |
+
- Updated `refresh_active_agents_widgets()` β per-user
|
| 199 |
+
- Updated `build_active_agents_markdown_and_dropdown()` β per-user
|
| 200 |
+
|
| 201 |
+
---
|
| 202 |
+
|
| 203 |
+
## π Troubleshooting
|
| 204 |
+
|
| 205 |
+
### Issue: Both users see the same agents
|
| 206 |
+
**Solution:**
|
| 207 |
+
1. Check that you're logged in with DIFFERENT usernames
|
| 208 |
+
2. Verify AUTH_CREDENTIALS is set in HF Spaces
|
| 209 |
+
3. Clear browser cache and re-login
|
| 210 |
+
|
| 211 |
+
### Issue: "refresh_active_agents_widgets" error
|
| 212 |
+
**Solution:**
|
| 213 |
+
1. Check server logs in HF Spaces
|
| 214 |
+
2. Ensure all functions have `request: gr.Request` parameter
|
| 215 |
+
3. Verify session_helpers is imported correctly
|
| 216 |
+
|
| 217 |
+
### Issue: Agents disappear after refresh
|
| 218 |
+
**Solution:**
|
| 219 |
+
- This is EXPECTED - sessions are in-memory
|
| 220 |
+
- Agents are cleared when you close browser or space restarts
|
| 221 |
+
- To persist, would need database backend (future enhancement)
|
| 222 |
+
|
| 223 |
+
---
|
| 224 |
+
|
| 225 |
+
## π Expected Behavior
|
| 226 |
+
|
| 227 |
+
### β
What Should Work:
|
| 228 |
+
- Each user builds their own agents
|
| 229 |
+
- Agent lists are completely separate
|
| 230 |
+
- Chat Panel shows correct agents per user
|
| 231 |
+
- Remove agent affects only that user
|
| 232 |
+
- Concurrent agent building works
|
| 233 |
+
|
| 234 |
+
### β οΈ Known Limitations:
|
| 235 |
+
- Agents lost after browser refresh (in-memory storage)
|
| 236 |
+
- No cross-user agent sharing (by design)
|
| 237 |
+
- Space restart clears all agents
|
| 238 |
+
|
| 239 |
+
---
|
| 240 |
+
|
| 241 |
+
## π Quick Validation
|
| 242 |
+
|
| 243 |
+
**30-Second Test:**
|
| 244 |
+
|
| 245 |
+
1. Two browsers, different users
|
| 246 |
+
2. Both go to "Agent Builder"
|
| 247 |
+
3. User A builds "TestA"
|
| 248 |
+
4. User B should see empty list (no agents)
|
| 249 |
+
5. User B builds "TestB"
|
| 250 |
+
6. User A should still see only "TestA"
|
| 251 |
+
|
| 252 |
+
**If this works β Agent isolation is working! β
**
|
| 253 |
+
|
| 254 |
+
---
|
| 255 |
+
|
| 256 |
+
## π What to Report
|
| 257 |
+
|
| 258 |
+
If you find issues, note:
|
| 259 |
+
1. Which user saw the problem
|
| 260 |
+
2. What action was performed
|
| 261 |
+
3. What was expected vs what happened
|
| 262 |
+
4. Screenshot if possible
|
| 263 |
+
5. Browser console errors (F12)
|
| 264 |
+
|
| 265 |
+
---
|
| 266 |
+
|
| 267 |
+
**Ready to test? Start with the Quick Test above!** π
|
| 268 |
+
|
| 269 |
+
Your app now supports true multi-user agent building! Each workshop participant will work in their own isolated workspace. π
|