Speaker Notes

Agentic engineering with Claude Code and Android CLI

To make coding agents succeed on Android projects, developers must provide proper environments with emulators and CLI tools, manage context windows carefully, use modular skills and hooks, and implement multi-tiered verification loops.

Android Developers · 30:23 · YouTube ↗

Talk · developer relations and product manager  Intermediate · environment setup and code loops

Highlights

4 clips · 12 min of 30 min
    • Agents need access to accurate documentation, specs, rules, and team context like PR comments.
    • Just as human developers need emulators and profilers, agents must be connected to real devices and backend services.
    • The Android CLI connects agents to the Android SDK manager, emulators, and crash reporting tools without being an AI product itself.
    • Model capabilities continue rising while context windows have plateaued; context remains a fixed budget.
    • Keeping conversations around 150,000 tokens hits the sweet spot to utilize model power without context rot.
    • Verbose logs like full Gradle outputs inflate costs and degrade performance; use quiet modes or truncation.
    • Hooks allow subscribing to agent events like session start/stop and file reads to enforce deterministic scripts and safety limits.
    • Skills load documentation and scripts dynamically only when relevant, saving precious context window space.
    • Avoid blindly installing massive online skill repositories which introduce security risks and bloat descriptions.
    • Giving an agent a failing test suite in advance rather than telling it how to code jumps benchmark pass rates from 22% to 90%.
    • Verification loops can range from prompt additions checking Compose previews to running automated unit and device tests.
    • Tiering validation steps from fastest (JVM/previews) to slowest (remote device labs) ensures efficient iterative fixing.

Questions this video answers

9 · every answer cites the moment it was said
01 How do I set up my agent with the right tools? 2 sources · 4:01

You should provide your agent with an accurate environment including emulators, profilers, and access to backend services. The Android CLI helps interface with various Android tools, manage SDKs, and connect to crash reporting.

02 How do I manage context window limits effectively? 2 sources · 9:12

Keep your conversations around 150,000 tokens to get the full power of the model without context rot. You should also watch out for verbose logs like Gradle output by running them in quiet mode or letting harnesses truncate them.

03 How do I use workflows to structure agent tasks? 2 sources · 10:57

Use structured workflows starting with a skill that grills you for requirements to eliminate ambiguity. This breaks down a project into smaller issues that fit neatly within the context window limit before you begin building and verifying.

04 What kind of information should I put in agent instruction files? 2 sources · 12:34

Keep instructions short and focused on things that always apply, such as architecture rules, module boundaries, and common code review mistakes. Avoid letting agents modify their own instruction files since it degrades performance and increases costs.

05 How can I enforce determinism in agent behavior? 2 sources · 15:35

Use hooks to subscribe to agent events like session start, session stop, or file reading and writing. Instead of relying on prompt instructions to run linters or protect secret files, deterministic scripts executed via hooks reliably enforce these constraints.

06 When should I use skills versus always-on instructions? 2 sources · 16:31

Use skills to add context only when it is relevant, such as documentation for specific libraries, rather than loading everything at once. Be selective about installed skills to avoid bloating your prompt token count and creating security risks.

07 Should I use shell commands or MCP servers for development tools? 2 sources · 19:09

Local shell tools like Android CLI and Gradle are fast, composable, and effectively free to run while having full access to your environment. Reserve Model Context Protocol servers for external services that already host them, like GitHub, Figma, or Slack.

08 How do I ensure my agent completes tasks reliably? 2 sources · 22:50

Implement verification loops by defining up front what done looks like and providing failing tests or rendering checks. This allows the agent to iteratively loop until all criteria are met rather than just accepting a text response claiming completion.

09 How should I structure multi-tiered verification loops? 2 sources · 25:47

Tier your verification loops by running the fastest and least powerful tests first, such as JVM tests and Compose previews. Progress to slower, more powerful emulator and remote device tests only after the earlier tiers pass to harden your application efficiently.

Section-by-section summary

6 parts

Embrace agents as a mindset for development

Development roles are shifting rapidly toward managing teams of autonomous agents rather than writing every line of code manually. Developers should treat agent failures like standard bugs by identifying missing information and refining workflows. This mindset applies universally regardless of which specific coding agent harness is used.

Provide agents with proper environments and tools

Agents cannot succeed in isolation and require access to project specs, team chat histories, pull request feedback, and emulators. The Android CLI bridges this gap by enabling agents to interact directly with SDK managers, emulators, and crash analytics. Using these tools, agents can investigate and resolve production issues on real form factors.

Optimize context windows and structure workflows

Larger context windows do not always yield better results and often suffer from context rot and high costs. Keeping conversations near 150,000 tokens while suppressing verbose build logs keeps models focused and accurate. Structured workflows like starting with scoping questions and breaking work into distinct issues help maintain this budget.

Define permanent architecture rules for the codebase

Global repo instructions should focus on immutable architecture guidelines, module boundaries, and common patterns that apply continuously. While some practices suggest avoiding self-modifying instructions to prevent cost blowouts, maintaining clear repository guidelines saves agents from excessive code traversal.

Enforce determinism with hooks and skills

Deterministic hooks can intercept file operations and execution stops to run linters or block edits to sensitive secret files. Skills package large reference documentation so agents load them only when specific tasks require them. Being selective about installed skills prevents unnecessary token consumption and security vulnerabilities.

Implement tiered verification loops for reliable completion

Agents frequently declare tasks complete prematurely without verifying edge cases or regressions. Providing pre-existing failing test suites or verification prompts dramatically increases task success rates. Running tiered tests from fast JVM checks up to slow device emulators ensures robust application hardening.

0:00 / 30:23
k play/pause · f fullscreen · m mute
n next · p previous clip · t highlights/full
< > slower/faster · / search what was said
  • Android CLI10× · first 0:13

    A command line interface for interacting with various Android tools, managing SDKs, and starting emulators.

  • Android bench2× · first 8:29

    A benchmark that measures the ability of AI to write realistic Android code.

  • MCP3× · first 9:48

    A protocol used to connect external services and tools to your agent as an install-free way to get extra context.

  • TFLite1× · first 5:47

    Custom machine learning models running directly on the Android device.

  • Firebase Crashlytics3× · first 4:52

    A crash reporting tool added to the developer environment to find application errors and unhandled exceptions.

  • Gradle4× · first 10:04

    A build system whose verbose logs can quickly consume context tokens if not truncated or run in quiet mode.