Use this to verify each code example in the documentation works correctly.
- Line 31: Basic agent setup (
my_agent.py) - Line 54: Running the agent (
main.py)
- Line 25: Event flow overview
- Line 60: SDKSystemInitEvent
- Line 71: SDKUserSpeechEvent
- Line 87: SDKAgentTextEvent
- Line 109: SDKAgentEndCallEvent
- Line 123: Custom event handling
- Line 23: Session creation
- Line 42: Session lifecycle
- Line 82: Session state
- Line 30: Node definition
- Line 54: OutputAgentNode
- Line 83: Node types - Logger
- Line 89: Node types - Filter
- Line 96: Node types - Counter
- Line 112-139: Logger, Filter, Counter examples
- Line 160: Node connections
- Line 180: Advanced node example
- Line 32: Graph creation
- Line 45: Node linking
- Line 64-91: Graph patterns (Linear, Fork, Join, Diamond)
- Line 109-176: Graph building examples
- Line 210: Complex graph
- Line 19: Basic streaming
- Line 35: Streaming with LLM
- Line 94: Streaming with tools
- Line 104: Tool execution in stream
- Line 129: Advanced streaming
- Line 156: Error handling in streams
- Line 201: Stream buffering
- Line 20: Context basics
- Line 60: add_message
- Line 85: add_messages
- Line 103: get_messages
- Line 142: Message history
- Line 168: Truncation
- Line 187: State persistence
- Line 219: Complete state example
- Line 17: is_interruptible=True
- Line 30: is_interruptible=False
- Line 49: Interruption in stream
- Line 81: Interruption with tools
- Line 100: Complete interrupt example
- Line 139: Non-interruptible section
- Line 170: Tools and interruptions
- Line 38: Router agent
- Line 90: Specialist agents
- Line 135: Agent handoff
- Line 173: Session routing
- Line 210: Complete multi-agent
- Line 249: Dynamic routing
- Line 267: Context passing
- Line 42: Basic flow
- Line 98: Greeting pattern
- Line 132: Question handling
- Line 175: Confirmation flow
- Line 206: Error recovery
- Line 235: Complete flow example
- Line 21-284: All optimization patterns (13 examples)
- Line 39: Complete tool calling example
- Line 10: @function_tool decorator
- Line 38: Tool with parameters
- Line 60: Tool with return type
- Line 80: Async tool
- Line 98: Tool with validation
- Line 114: Complex tool
- Line 138: Multiple tools
- Line 10: ToolRegistry setup
- Line 34: get_tools_json()
- Line 48: Tool execution
- Line 83: Parallel execution
- Line 133: Adding results to context
- Line 12: from_defaults()
- Line 30: Built-in end_call
- Line 73: Complete SupportAgent example
- Line 15: Configuration structure
- Line 10: System prompt
- Line 43: Role-based prompts
- Line 60: Task prompts
- Line 77: Dynamic prompts
- Line 98-137: Prompt templates
- Line 10: OpenAI setup
- Line 39: Temperature
- Line 51: Max tokens
- Line 69: Stop sequences
- Line 85: Streaming config
- Line 95: Full config
- Line 23: OpenAI client
- Line 53: Groq client
- Line 77: Together client
- Line 93: Ollama client
- Line 35-179: Voice configuration (9 examples)
- Line 54: Step 1 - Basic setup
- Line 102: Step 2 - Add LLM
- Line 196: Step 3 - Add tools
- Line 254: Step 4 - Complete agent
- Line 39: test_tools.py
- Line 70: test_response.py
- Line 102: MockLLMClient
- Line 132: Multi-turn test
- Line 169: Environment setup
- Line 186-196: Debug helpers
- Line 23-183: Issue fixes (8 examples)
- Line 12-241: Logging patterns (11 examples)
- Line 27-184: Rate limit handling (5 examples)
- Line 47: Quick upload example
- Line 11: create_knowledge_base
- Line 38: get_knowledge_bases
- Line 48: get_knowledge_base_by_id
- Line 63: delete_knowledge_base
- Line 72: Agent's global KB
- Line 82: Upload to agent's KB
- Line 13: upload_text_to_knowledge_base
- Line 59: Upload media
- Line 84: Bulk upload
- Line 106: get_knowledge_base_items
- Line 118: delete_knowledge_base_item
- Line 133: Update pattern
- Line 187: Chunking example
- Line 27: SupportAgent with KB
- Line 54: Upload to agent's KB
- Line 76: System prompt for KB
- Line 104: Fallback handling
- Line 119: Testing KB retrieval
- Line 66: Descriptive titles
- Line 80: Include synonyms
- Line 105: Complete answers
- Line 30: Good content example
- Line 53: Bad content example
- Line 72: Categorize content
- Line 93: Synonyms example
- Line 113: Automated sync
- Line 175: Debug retrieval
- Line 197-217: Common patterns (3)
- Line 18: start_outbound_call
- Line 36: create_campaign quick
- Line 11: start_outbound_call
- Line 48: Trigger from user input
- Line 68: Scheduled callback
- Line 88: Error handling
- Line 19: create_campaign
- Line 51: start_campaign
- Line 61: pause_campaign
- Line 71: get_campaigns
- Line 83: get_campaign_by_id
- Line 94: delete_campaign
- Line 116: Complete workflow
- Line 11: get_conversation_logs
- Line 40: Transcript analysis
- Line 75: Export logs
- Line 22: Quick example
- Line 41: Available data fields
- Line 11: Get logs
- Line 29: Duration
- Line 40: Status
- Line 55: Call types
- Line 68: Phone numbers
- Line 80: Transcripts
- Line 91: Recording URL
- Line 102: Batch analysis
- Line 124: Export
- Line 21: Latency data
- Line 53: check_performance
- Line 97: Agent details
- Line 109: Quality report
| Section | Code Examples |
|---|---|
| Introduction | 15 |
| Agent Patterns | 45+ |
| Tools & Functions | 15 |
| Agent Configuration | 20+ |
| Building First Agent | 4 |
| Debugging & Testing | 25+ |
| Knowledge Base | 20+ |
| Calling & Campaigns | 15 |
| Analytics | 10 |
| Total | ~170 |