getCodeExample
Retrieve full Kotlin and Swift code examples for smart-glasses patterns. Get canonical implementations, explanations, gotchas, and SDK features to build or verify your feature end-to-end.
Instructions
Reference library — retrieve a complete SDK code example (Kotlin + Swift) for a use case. For voice-assistant work on any new app, start with assistant_agent_loop — the Phase 4 glasses.assistant.start { tool(name, description) { body -> ToolResult } } API where the model owns wake detection + turn taking + intent parsing + confirmation speech and the customer only writes tool bodies that act on app state. The provider abstraction covers OpenAI Realtime, xAI Grok, and Google Gemini Live (Gemini from SDK 1.8.0+) — the model id picks the vendor. The example pairs the customer code with the agent-driven E2E loop (injectAssistantUtterance → assertToolCalled) that verifies it without humans. For the dedicated agent-side test workflow (explicit two-step wake, multi-tool sweep, four-channel verification: event log + adb logcat + screencap + library state; real-OpenAi capable since iter5.2): agent_driven_e2e_full_loop. For the glasses-display two-view navigation pattern (browse ⇄ detail on the Ray-Ban Display, Neural-Band select + assistant tools driving one state machine): display_browse_detail. Other patterns still ship for apps that need fine-grained control: voice_qa_assistant (manual glasses.voice.onPhrase wake + glasses.audio.recordDiscrete + customer-side AnthropicClient — the pre-Phase-3 composition), barge_in_speak (manual TTS cancel on user interrupt), photo_describe_voice (wake → photo → vision LLM → speak), live_transcription_ui (transcripts into Compose/SwiftUI state), voice_notes (wake → record → persist), connection_page_setup (the minimum bootstrap wiring), byok_anthropic (an Anthropic HTTP client the CUSTOMER'S OWN handler code calls with the customer's own key — used by voice_qa_assistant / photo_describe_voice. It has nothing to do with the assistant runtime, which always runs on the Extentos managed gateway with no key of any kind), agent_test_loop (the legacy three-surface verification recipe — for Phase 4 use agent_driven_e2e_full_loop). USE when you're about to write handler code and want the canonical shape to peel from, OR when you want the agent test driver that asserts the handler works end-to-end. DON'T USE for capability discovery (use getPlatformInfo) or per-feature minimal usage (use getCapabilityGuide).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | Yes | Which compositional pattern to fetch. Each returns full Kotlin + Swift code, an explanation, gotchas, and the SDK features it exercises. |