> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meetzy.es/llms.txt
> Use this file to discover all available pages before exploring further.

# Playground

> Test your AI agent in real-time with AI streaming, voice commands, and enhanced debugging

## What is the Playground?

The Playground is an enhanced testing environment in the Advanced Editor where you can interact with your agent in real-time. It allows you to simulate conversations, test different scenarios, and validate your agent's behavior before deploying to production, all while leveraging AI streaming capabilities and advanced voice commands.

<Info>
  Testing in the Playground saves time and money by catching issues before they affect real customer calls, with enhanced debugging capabilities through AI streaming and real-time statistics.
</Info>

## Enhanced Editor Integration

The Playground now benefits from the Advanced Editor's improved interface, including:

* **AI Streaming**: Real-time AI responses with streaming capabilities for faster feedback
* **Voice Commands**: Use Cmd+Shift+V for hands-free voice recording and testing
* **Statistics Widgets**: Live performance metrics and real-time debugging information
* **View Controls**: Use outline, indented view, and minimap for better code navigation
* **Diff Mode**: Compare changes with inline/split view options when working with versions
* **Focus Mode**: Minimize distractions while testing
* **Collaborative Testing**: Multiple users can test simultaneously with real-time sync

## Accessing the Playground

The Playground is located in the right panel of the Advanced Editor. Click the "Playground" tab to access it.

<Steps>
  <Step title="Navigate to Advanced Editor">
    Open your agent in the Advanced Editor.
  </Step>

  <Step title="Open Playground">
    Click the "Playground" tab in the right panel.
  </Step>

  <Step title="Configure View">
    Use the editor view controls (outline, minimap, focus mode) to optimize your workspace.
  </Step>

  <Step title="Enable AI Streaming">
    Toggle on AI streaming for real-time responses during testing.
  </Step>
</Steps>

## AI Streaming Capabilities

The Playground now supports advanced AI streaming features:

### Real-time Response Streaming

* **Live Generation**: See AI responses being generated in real-time
* **Token-by-Token Display**: Watch the conversation unfold naturally
* **Interruption Support**: Stop generation mid-stream if needed
* **Performance Metrics**: Monitor response time and token usage

### Statistics Widgets

Real-time widgets display crucial metrics during testing:

<Tabs>
  <Tab title="Performance Metrics">
    * **Response Time**: Live latency measurements
    * **Token Usage**: Input/output token consumption
    * **Memory Usage**: Current conversation context size
    * **Streaming Rate**: Tokens per second generation speed
  </Tab>

  <Tab title="Conversation Stats">
    * **Turn Count**: Number of conversation exchanges
    * **Average Response Length**: Mean response size
    * **Function Calls**: Tool invocation frequency
    * **Context Retention**: Memory usage across turns
  </Tab>

  <Tab title="Quality Metrics">
    * **Coherence Score**: Response consistency rating
    * **Relevance Rating**: Context-appropriate responses
    * **Error Rate**: Failed or incomplete responses
    * **User Satisfaction**: Simulated rating based on flow
  </Tab>
</Tabs>

<Warning>
  Statistics widgets update in real-time and may impact performance during intensive testing sessions. Toggle them off for maximum speed.
</Warning>

## Voice Commands Integration

### Voice Recording (Cmd+Shift+V)

The Playground features enhanced voice input capabilities:

<Steps>
  <Step title="Activate Voice Recording">
    Press `Cmd+Shift+V` (Mac) or `Ctrl+Shift+V` (Windows) to start recording.
  </Step>

  <Step title="Speak Your Input">
    The system will capture and transcribe your voice in real-time.
  </Step>

  <Step title="Review Transcription">
    See live transcription with confidence indicators.
  </Step>

  <Step title="Send or Edit">
    Either send directly or edit the transcribed text before submission.
  </Step>
</Steps>

### Voice Command Features

| Feature         | Description                      | Keyboard Shortcut             |
| --------------- | -------------------------------- | ----------------------------- |
| 🎤 Quick Record | Start/stop voice recording       | `Cmd+Shift+V`                 |
| 🔄 Re-record    | Clear and start new recording    | `Cmd+Shift+R`                 |
| ⏸️ Pause/Resume | Pause recording without stopping | `Spacebar` (during recording) |
| 🔊 Playback     | Hear your recorded audio         | `Cmd+Shift+P`                 |
| 📝 Edit Mode    | Switch to text editing           | `Escape`                      |

<Info>
  Voice commands work with multiple languages and automatically adapt to your agent's language settings.
</Info>

## Call Types with Streaming Support

You can simulate two types of calls with enhanced AI streaming:

| Type        | Description                 | AI Features                   | Voice Commands          |
| ----------- | --------------------------- | ----------------------------- | ----------------------- |
| 📞 Inbound  | Customer calling your agent | Real-time greeting generation | Voice input testing     |
| 📤 Outbound | Agent calling a customer    | Streaming introductions       | Voice script validation |

<Tip>
  Use streaming mode to test how your agent handles interruptions and overlapping speech, crucial for real phone conversations.
</Tip>

## Enhanced Testing Interface

### Monaco Editor with AI Integration

The Playground now features advanced editor capabilities:

<Tabs>
  <Tab title="AI Streaming">
    * **Live Code Analysis**: Real-time syntax validation
    * **Smart Suggestions**: AI-powered completion
    * **Error Detection**: Instant feedback on configuration issues
    * **Performance Hints**: Optimization suggestions
  </Tab>

  <Tab title="Voice Integration">
    * **Speech-to-Code**: Convert voice commands to configuration
    * **Audio Annotations**: Voice notes attached to code sections
    * **Pronunciation Testing**: Validate how text sounds when spoken
    * **Language Detection**: Auto-detect optimal voice settings
  </Tab>

  <Tab title="Collaborative Features">
    * **Live Cursors**: See other users' editing positions
    * **Shared Voice Sessions**: Collaborative voice testing
    * **Real-time Comments**: Voice and text annotations
    * **Change Broadcasting**: Instant updates across sessions
  </Tab>
</Tabs>

## Advanced Message Input

### Text Input with AI Assistance

Type messages with enhanced AI support:

* **Auto-completion**: Smart suggestions based on context
* **Grammar Check**: Real-time language validation
* **Intent Detection**: Preview how the agent will interpret your input
* **Template Suggestions**: Common testing phrases

### Enhanced Voice Input

Click the microphone icon or use `Cmd+Shift+V` for advanced voice features:

<Steps>
  <Step title="Start Voice Recording">
    Activate with keyboard shortcut or button click.
  </Step>

  <Step title="Real-time Transcription">
    See words appear as you speak with confidence indicators.
  </Step>

  <Step title="Language Auto-Detection">
    System automatically detects and switches languages.
  </Step>

  <Step title="Voice Enhancement">
    AI cleans up transcription for better testing accuracy.
  </Step>

  <Step title="Agent Processing">
    Watch streaming response generation in real-time.
  </Step>
</Steps>

## Real-time Conversation Visualization

The enhanced conversation view displays:

| Element          | Description                              | Streaming Features           |
| ---------------- | ---------------------------------------- | ---------------------------- |
| 👤 User Message  | Your inputs with typing indicators       | Live transcription display   |
| 🤖 Agent Message | Streaming AI responses                   | Token-by-token generation    |
| 🎙️ Voice Input  | Audio waveforms and transcription        | Real-time speech recognition |
| 🔧 Tool Call     | Function calls with streaming parameters | Live parameter generation    |
| ✅ Tool Result    | Response with streaming data             | Progressive result display   |

### Audio Playback with AI Enhancement

For each agent response, you can:

* ▶️ Play streaming audio responses
* ⏸️ Pause/resume during playback
* 🔁 Replay with different voice settings
* 📊 Compare audio quality across versions
* 🎛️ Adjust playback speed and tone
* 📈 View audio analytics and clarity metrics

## Statistics Dashboard

### Live Performance Monitoring

The playground features comprehensive real-time statistics:

<AccordionGroup>
  <Accordion title="Response Metrics" icon="chart-line">
    * **Latency Tracking**: Response time distribution
    * **Token Efficiency**: Input/output ratio analysis
    * **Streaming Performance**: Generation speed metrics
    * **Error Rates**: Failed response tracking
  </Accordion>

  <Accordion title="Voice Analytics" icon="microphone">
    * **Recognition Accuracy**: Transcription confidence scores
    * **Audio Quality**: Input clarity measurements
    * **Response Clarity**: Generated audio quality metrics
    * **Language Detection**: Confidence in language identification
  </Accordion>

  <Accordion title="Conversation Flow" icon="comments">
    * **Turn Analysis**: Conversation rhythm tracking
    * **Context Retention**: Memory usage over time
    * **Topic Coherence**: Subject consistency scoring
    * **User Engagement**: Interaction quality metrics
  </Accordion>

  <Accordion title="Resource Usage" icon="server">
    * **Memory Consumption**: Real-time usage tracking
    * **Processing Load**: System resource monitoring
    * **Network Performance**: Connection quality metrics
    * **Cache Efficiency**: Response caching effectiveness
  </Accordion>
</AccordionGroup>

## Context Variables with AI Enhancement

Test dynamic variables with intelligent assistance:

<Steps>
  <Step title="Open Enhanced Context Panel">
    Access context variables with AI-powered validation.
  </Step>

  <Step title="Smart Value Generation">
    Use AI to generate realistic test values for your variables.
  </Step>

  <Step title="Voice Variable Input">
    Speak variable values using voice commands.
  </Step>

  <Step title="Real-time Validation">
    See instant feedback on variable format and content.
  </Step>
</Steps>

### Enhanced Context Management

```json theme={null}
{
  "customer_name": "John Smith",
  "order_number": "ORD-12345", 
  "is_premium_customer": true,
  "account_balance": 1250.50,
  "_ai_context": {
    "streaming_enabled": true,
    "voice_commands_active": true,
    "statistics_level": "detailed",
    "real_time_metrics": true
  },
  "_voice_settings": {
    "input_language": "auto-detect",
    "transcription_confidence": 0.95,
    "voice_enhancement": true
  }
}
```

## Reliability Testing with AI Insights

Run comprehensive tests with AI-powered analysis:

<Steps>
  <Step title="Configure Advanced Scenario">
    Set up test with AI-generated edge cases.
  </Step>

  <Step title="Enable Streaming Mode">
    Test with real-time response generation.
  </Step>

  <Step title="Set Voice Parameters">
    Configure voice input variations for testing.
  </Step>

  <Step title="Run AI-Enhanced Test">
    Execute with streaming metrics and voice analysis.
  </Step>

  <Step title="Analyze AI Insights">
    Review detailed performance analysis and suggestions.
  </Step>
</Steps>

<Warning>
  AI-enhanced reliability tests consume more resources. Consider running during off-peak hours for best results.
</Warning>

## Voice Command Reference

### Global Commands (Available Anywhere)

| Command           | Action                         | Keyboard Shortcut   |
| ----------------- | ------------------------------ | ------------------- |
| "Start recording" | Begin voice input              | `Cmd+Shift+V`       |
| "Stop recording"  | End voice capture              | `Cmd+Shift+V` again |
| "Clear input"     | Reset current input            | `Cmd+Shift+C`       |
| "Send message"    | Submit current input           | `Cmd+Enter`         |
| "Show statistics" | Toggle stats panel             | `Cmd+Shift+S`       |
| "Focus mode"      | Enter distraction-free testing | `Cmd+Shift+F`       |

### Context-Specific Commands

| Context         | Command            | Result                                 |
| --------------- | ------------------ | -------------------------------------- |
| Voice Recording | "Pause"            | Pause recording without losing content |
| Voice Recording | "Resume"           | Continue recording from pause          |
| Voice Recording | "Delete last word" | Remove last spoken word                |
| Voice Recording | "Start over"       | Clear and restart recording            |
| Testing Session | "Run test"         | Execute current test scenario          |
| Testing Session | "Show metrics"     | Display performance dashboard          |

## Advanced Features

### AI-Powered Test Generation

Let AI create test scenarios for you:

<Steps>
  <Step title="Enable AI Test Generator">
    Activate intelligent scenario creation.
  </Step>

  <Step title="Specify Test Goals">
    Describe what you want to test using voice or text.
  </Step>

  <Step title="Review Generated Scenarios">
    AI creates comprehensive test cases with edge conditions.
  </Step>

  <Step title="Execute with Streaming">
    Run tests with real-time monitoring and voice interaction.
  </Step>
</Steps>

### Collaborative Voice Testing

Multiple team members can test together:

* **Shared Voice Sessions**: Multiple users can provide voice input
* **Real-time Transcription Sharing**: See all participants' input
* **Collective Statistics**: Combined performance metrics
* **Voice Queue Management**: Organized turn-taking for voice input

### Intelligent Error Detection

AI continuously monitors for issues:

* **Response Quality**: Automatic coherence checking
* **Performance Degradation**: Real-time slowdown detection
* **Voice Recognition Errors**: Transcription accuracy monitoring
* **Context Loss**: Memory management issue detection

## Best Practices for AI Streaming

<AccordionGroup>
  <Accordion title="Optimize Streaming Performance" icon="zap">
    * Enable streaming only when needed for faster basic testing
    * Use statistics widgets selectively to avoid performance impact
    * Close unnecessary browser tabs during intensive testing
    * Test with realistic network conditions
  </Accordion>

  <Accordion title="Voice Command Efficiency" icon="microphone">
    * Speak clearly and at moderate pace for better recognition
    * Use consistent terminology for reliable command recognition
    * Test in quiet environments for optimal transcription
    * Configure microphone permissions before testing sessions
  </Accordion>

  <Accordion title="Collaborative Testing" icon="users">
    * Establish voice command protocols with team members
    * Use shared statistics to identify performance trends
    * Coordinate testing schedules to avoid resource conflicts
    * Document findings using voice annotations
  </Accordion>

  <Accordion title="Resource Management" icon="server">
    * Monitor system resources during extended testing
    * Use batch testing for high-volume scenarios
    * Cache frequently tested scenarios for faster access
    * Clean up test data regularly to maintain performance
  </Accordion>
</AccordionGroup>

## Troubleshooting Enhanced Features

| Issue                     | Solution                                       | AI Feature                            |
| ------------------------- | ---------------------------------------------- | ------------------------------------- |
| Voice not recognized      | Check microphone permissions and speak clearly | Use voice enhancement settings        |
| Slow streaming            | Disable unnecessary statistics widgets         | Enable performance optimization mode  |
| Statistics not updating   | Refresh statistics panel or restart testing    | AI will auto-detect and suggest fixes |
| Collaborative sync issues | Check network connection and user permissions  | Real-time conflict resolution         |
| Memory usage high         | Clear conversation history and restart session | AI memory management suggestions      |

## Integration with Advanced Systems

### AI Streaming Integration

* **Real-time Sync**: Streaming reflects current version state instantly
* **Change Detection**: Visual indicators for modifications during streaming
* **Performance Optimization**: AI adjusts streaming rate based on system performance
* **Quality Assurance**: Continuous monitoring of stream quality

### Voice Command Integration

* **Cross-Platform Support**: Works across different operating systems
* **Language Adaptation**: Automatically adapts to user's preferred language
* **Context Awareness**: Commands change based on current testing phase
* **Learning System**: AI learns from your voice patterns for better recognition

## Next Steps

<CardGroup cols={2}>
  <Card title="AI Copilot Integration" icon="robot" href="/advanced-editor/copilot">
    Get AI assistance with enhanced prompt analysis and voice-powered coding
  </Card>

  <Card title="Statistics & Analytics" icon="chart-bar" href="/advanced-editor/analytics">
    Deep dive into performance metrics and AI-powered insights
  </Card>

  <Card title="Voice Configuration" icon="microphone" href="/advanced-editor/voice-settings">
    Configure advanced voice commands and speech recognition settings
  </Card>

  <Card title="Collaborative Features" icon="users" href="/advanced-editor/collaboration">
    Set up team testing sessions with shared voice and streaming capabilities
  </Card>
</CardGroup>
