This page describes features extending the AI Gateway, which provides a unified API for accessing multiple AI providers. To learn more, see AI Gateway.
Quick Start
Configuration
| Parameter | Type | Required | Description | 
|---|---|---|---|
| id | string | Yes | Unique thread identifier for grouping requests | 
| tags | string[] | No | Metadata tags for filtering and categorization | 
Use Cases
| Scenario | Thread ID Strategy | Tags Example | 
|---|---|---|
| User Sessions | user-{userId}-{sessionId} | ["user-session", "support"] | 
| Support Tickets | ticket-{ticketId} | ["support", "priority-high"] | 
| A/B Testing | test-{variant}-{userId} | ["experiment", "variant-a"] | 
| Multi-Step Workflows | workflow-{processId} | ["onboarding", "step-2"] | 
Implementation Examples
Session-Based Threading
Multi-Language Support
Advanced Patterns
Dynamic Thread Management
Batch Thread Processing
Thread Analysis
Conversation Flow Tracking
Troubleshooting
**Conversations not grouping- Cause: Different thread IDs used
- Solution: Use consistent thread ID for related requests
- Cause: Thread ID not persistent
- Solution: Store thread ID in session/database
- Cause: Too many tags per thread
- Solution: Limit to 5-10 relevant tags
- Cause: Non-unique thread IDs
- Solution: Use UUID or timestamp-based IDs
Performance Optimization
Thread ID Best Practices
Tag Optimization
Limitations
| Limitation | Description | Workaround | 
|---|---|---|
| Thread ID Length | Maximum 100 characters | Use shorter, meaningful identifiers | 
| Tag Count | Recommended maximum 10 tags | Group related concepts into single tags | 
| Thread Persistence | Threads expire after 30 days of inactivity | Archive important conversations externally | 
| Concurrent Access | No built-in thread locking | Implement application-level synchronization | 
Best Practices
- Consistent Naming: Use predictable thread ID patterns
- Meaningful Tags: Choose tags that aid in filtering and analysis
- Session Management: Tie thread IDs to user sessions
- Cleanup Strategy: Archive or delete old threads regularly
- Error Handling: Validate thread configuration before requests