research
Migrate TFLite Android Apps to LiteRT CompiledModel with Agent Skill
This skill helps AI agents migrate Android apps from TFLite to LiteRT CompiledModel API with async, zero-copy, and NPU JIT.
Where this fits
You maintain an Android app that has been running on TensorFlow Lite for years. The team is now eyeing the LiteRT CompiledModel API for its async execution, zero-copy buffers, and NPU acceleration, but the migration feels risky and time‑consuming. Instead of manually reading migration guides and rewriting Interpreter calls, you hand the task to an AI agent armed with litert-compiled-model-migration. The agent inspects your open‑source repository, maps the existing TFLite usage, and produces a verified, like‑for‑like migration in a single pass.
Why agents benefit
- Automated discovery: The skill scans the repo structure, identifies all TFLite artifacts (models, delegates, interpeters), and builds a migration plan without human prompting.
- True async + zero‑copy: It upgrades to
runAsyncand I/O buffer management — not just API swaps — so the agent delivers performance wins without extra manual tuning. - NPU JIT integration: The skill knows how to set up and validate NPU compilation, a step many hand‑rolled migrations miss.
- Self‑verification: A two‑stage test harness runs after the first pass, ensuring the migrated app behaves identically before any third‑party review.
- Like‑for‑like safety: The agent prioritises behaviour parity first; advanced optimisations are introduced only when tests pass.
Practical scenarios
Legacy AR app with custom delegates
Your AR app uses a custom TFLite delegate for edge detection. The agent detects the delegate registration and rewrites it to LiteRT's delegate interface, then confirms the runAsync path works with your native camera loop.
Batch inference on a photo library
Your photo‑sorting app runs multiple models per image. The skill migrates all of them, converts to zero‑copy buffers to avoid memory copies, and verifies batch throughput stays stable under load.
On‑device model update pipeline
The app downloads updated models at runtime. The agent ensures the new CompiledModel API handles dynamic loading and JIT compilation correctly, and runs the two‑stage verification against a sample of old and new models to confirm compatibility.
Add it to your agent workflow
Install the skill directly from the OpenAgentSkill listing or via CLI:
npx skills add google-ai-edge/litert-samples --skill litert-compiled-model-migration
Then point your agent at a repository and run the skill with the typical prompt:
Use litert-compiled-model-migration to migrate the Android app in ./my-android-app to LiteRT CompiledModel API v2.1.6.
The agent will discover the project, present a planning interview, and execute the migration with automated tests.
Compare before adopting
Before committing to this skill, compare it against your baseline. Check that the skill's discovery logic matches your project structure (e.g., Gradle vs. Bazel). Review the README and sample outputs on the skill's GitHub to see if the self‑test quality meets your bar. Also consider whether you need a more conservative, manual migration path or can accept the skill's “like‑for‑like” first pass. The agent's planning interview helps surface these trade‑offs before any code changes.
Why it is worth tracking
With 408 stars and active maintenance by google-ai-edge, this skill is both credible and current. It turns a historically tedious upgrade into a repeatable agent task, and its two‑stage verification gives you confidence in the output. Track it if you regularly modernise Android on‑device inference stacks; it's a strong candidate for your agent's toolkit and worth re‑evaluating whenever LiteRT releases new versions.
Featured Skill
litert-compiled-model-migration
Skill by google-ai-edge