What This Example Does
1
Opens the photo gallery
Navigates to the Photos/Gallery app
2
Finds photos from a specific date
Searches for photos taken yesterday
3
Creates an album
Creates a new album with a date-based name
4
Moves photos
Moves the found photos into the new album
Key Concepts
Simple Agent Creation
Uses default configuration with minimal setup
Structured Output
Returns typed Pydantic model for type-safe results
Direct run_task
No builders needed for simple tasks
Error Handling
Proper try/except/finally pattern
Complete Code
simple_photo_organizer.py
Code Breakdown
1. Define Output Structure
2. Create Agent with Default Config
3. Initialize the Agent
Note that
init() is now an async method and must be awaited.4. Run Task with Structured Output
PhotosResult | None.
5. Always Clean Up
Running the Example
1
Ensure Prerequisites
- Device connected with USB debugging enabled
- ADB installed (Android) or idb installed (iOS)
- Python 3.12+
2
Install SDK
3
Set up LLM Config
Create
llm-config.defaults.jsonc and .env file (see Installation)4
Run the Script
Expected Output
Customization Ideas
Change date range
Change date range
Filter by photo type
Filter by photo type
Multiple albums
Multiple albums
Whatβs Next
App Lock - Messaging Example
Learn how to restrict execution to a specific app
Smart Notification Assistant
More advanced example with multiple profiles
SDK Reference
Explore the complete SDK

