Demonstrates managing multiple concurrent sessions for different users, contexts, and conversation types.
Sign in to save downloads to your library and vote.
Preview
Multi Sessions
Demonstrates managing multiple concurrent sessions for different users, contexts, and conversation types.
๐ฏ What This Demonstrates
- Multi-User Sessions: Separate conversations for different users
- Context-Based Sessions: Different session types (support, sales, etc.)
- Shared Sessions: Multiple agents using the same conversation
- Session Organization: Naming strategies and management patterns
๐ Quick Start
-
Install OpenAI Agents SDK:
pip install openai-agents -
Set up environment:
cp ../env.example .env # Edit .env and add your OpenAI API key -
Run the agent:
import asyncio from agent import multi_user_sessions, context_based_sessions # Test multi-user sessions asyncio.run(multi_user_sessions()) # Test context-based sessions asyncio.run(context_based_sessions())
๐ก Key Concepts
- Session Isolation: Keeping conversations separate
- User-Based Sessions: Individual user conversation histories
- Context Switching: Different conversation types and purposes
- Agent Handoffs: Sharing sessions between specialized agents
๐งช Available Patterns
Multi-User Sessions
- Separate sessions for Alice and Bob
- Isolated conversation histories
- User-specific context preservation
Context-Based Sessions
- Support ticket conversations
- Sales inquiry conversations
- Feature-specific sessions
Shared Session Agents
- Customer handoff scenarios
- Multiple agents, single conversation
- Context preservation across agent switches
Session Organization
- User-based naming:
user_123 - Feature-based naming:
chat_feature_user_123 - Thread-based naming:
thread_abc123 - Timestamp-based naming:
user_123_20241215
๐ Next Steps
- Basic Sessions - Session fundamentals
- Memory Operations - Advanced memory manipulation
- Tutorial 8: Handoffs & Delegation - Agent handoffs
Ingestion metadata
- Source catalog
- awesome-llm-apps
- Repository
- Shubhamsaboo/awesome-llm-apps ยท main
- File path
- ai_agent_framework_crash_course/openai_sdk_crash_course/7_sessions/7_3_multi_sessions/README.md
- Last refreshed
- 10/24/2026, 3:00:14 AM (5h ago)
- Refresh schedule
- Daily ยท 03:00 UTC
- Dedupe status
- Unique ยท deduped by (source, url)