
Posted by Jolanda Verhoef, Senior Developer Relations Engineer, Android Developer Relations Welcome back to the blog post series "Build intelligent Android apps" where you take a basic Android app and transform it into a personalized, intelligent, and agentic experience. In our previous post you learned how to connect to the intelligence system using AppFunctions. In this post, you will learn how to build autonomous in-app agentic workflows running in the cloud.
Sometimes a task is too complex for a single device session. For example, booking a complete holiday itinerary involves coordinating flight times, selecting hotel rooms, reserving museum tickets, and planning restaurant reservations. If you run this multi-step process directly on a mobile device, the app might get closed and lose your progress.
Managing all these steps and API credentials on a phone also gets complicated quickly. For these long-running, multi-step workflows, you can use a custom self-hosted backend. The backend executes the booking agents in the background, while the Android app connects to the session, visualizes the progress, and requests user input only when necessary.
Using a cloud-hosted agentic backend offers a few advantages: Background execution: Booking agents run autonomously in the cloud, so progress is never lost if the mobile app goes to the background or loses internet connectivity. Complex multi-agent orchestration: A coordinator agent can delegate bookings to specialized subagents and handle dependencies between them.
Client-agnostic UI rendering: The backend describes the interface structure dynamically, letting you update the UI layout without releasing a new client version. The booking assistant shows all booking progress, organized by event type.
With these benefits in mind, we added a Booking Assistant to Jetpacker that coordinates flights, hotels, museums, and restaurant reservations. Let’s look at how we orchestrated a multi-agent system powered by the Agent Development Kit (ADK), with the Agent-User Interaction protocol(AG-UI) and Agent-to-User Interface protocol (A2UI) to send and display interactive cards natively in Jetpack Compose.
Powering complex workflows with ADK agents Rather than coordinating the orchestration flow manually using custom REST endpoints or complex web sockets, you can use the Agent Development Kit (ADK). With ADK, you can define agents and equip them with python function tools to query databases and execute bookings.
The Android app sends the current trip itinerary data to the server. The coordinator agent chooses which subagents to trigger.
Each subagent provides its results to a shared session queue that streams the results back to the Android app. Here is how to define a simple agent and run it using ADK: # android/booking-server/booking_server.py # Note: ADK supports many different coding languages.
For now, use the Python version as it includes support for A2UI which we’ll use later in this blog post. From google.adk import Agent from google.adk.runners import InMemoryRunner from google.adk.tools import FunctionTool # Define custom tools to interact with database def search_flights(destination: str, date: str) -> list[str]: # In production, here you would query our flight database and return dynamic results return ["10:00 AM", "2:00 PM"] def reserve_flight(flight_time: str) -> str: # In production, here you would save the reservation transaction return "Reserved flight at " + flight_time # Instantiate the booking agent with specialized tools flight_agent = Agent( name="Flight Booker", model="gemini-3.1-flash-lite", instruction="Help the user search for flights and book a reservation.", tools=[ FunctionTool(search_flights), FunctionTool(reserve_flight, require_confirmation=True) ]) # Run the agent in memory using a session ID runner = InMemoryRunner(flight_agent) async for event in runner.run_async(user_id=user_id, session_id=session_id): if event.content: print("Agent said:", event.content) When you run an agent using this setup, ADK manages the execution steps for you.
It automatically tracks the conversation context, routes messages between the user and the model, and executes the registered tools when the model requests them. This allows you to focus on writing clean procedural logic while the framework handles the orchestration in the background.
The ADK web interface shows how you can have a conversation with the multi-agent booking system. To connect this backend agent to our Jetpacker app, the server needs a way to stream updates in real time to the device, which is handled using the AG-UI protocol.
The agent also needs a structured way to describe and update interactive components (like option selectors and seating grids) dynamically on the phone, which is where the A2UI protocol comes in. Standardizing agent-client communication with AG-UI Running agents in the cloud and rendering UI on Android requires a standard communication channel.
For this, you will use the AG-UI protocol. AG-UI is a bidirectional transport layer protocol that standardizes message types between agents and UI clients.
Discover more from ChuckysCarnage
Subscribe to get the latest posts sent to your email.
