NewsAI is a sample Android application demonstrating how to build a voice-activated, AI-agentic workflow using the MobileGraph SDK. It allows users to ask for news in a specific genre and provides a summarized, text-to-speech (TTS) readout of the latest articles.
Traditional apps rely on hardcoded logic. NewsAI uses an Agentic Workflow, where autonomous agents collaborate to understand user intent, fetch real-time data, and process it into a user-friendly format.
- Voice Interaction: Leverages Android's Speech-to-Text and Text-to-Speech.
- AI-Driven Orchestration: Uses MobileGraph to manage a multi-step agent workflow.
- Dynamic Summarization: Summarizes multiple news articles using LLMs (OpenAI).
- Personalized Experience: Tailors news based on natural language queries (e.g., "Tell me about tech news").
The heart of the application is the NewsWorkflowBuilder, which defines a state-aware graph of agents and nodes.
The app uses a stateGraph to orchestrate the following steps:
- Genre Identification (Agent): An LLM-powered agent that parses the user's query to identify the requested news category (e.g., "Technology", "Sports").
- News Fetcher (Graph Node): A functional node that calls the
NewsToolto fetch real-back live news articles via a News API. - Summarizer (Agent): An agent that iterates through the fetched articles and generates concise, TTS-friendly summaries.
- State Management:
NewsStateholds the conversation variables (genre, articles, summaries) and is updated immutably as it passes through the graph.
MobileGraph: The entry point for SDK initialization and model configuration.AgentNode: Wraps anAgentto participate in the graph execution.DefaultExecutionEngine&DefaultAgentRuntime: The engines that navigate the graph and handle LLM interactions.StateGraph: Defines the edges and conditional transitions between nodes.
- API Keys:
- Add your API keys to
local.propertiesin the root directory:OPENAI_API_KEY=your_openai_key_here NEWS_API_KEY=your_news_api_key_here
- Add your API keys to
- Build: Run
./gradlew assembleDebugor use Android Studio. The keys are automatically injected into the app viaBuildConfig. - Use: Tap the microphone icon, say a news category (e.g., "Business news"), and listen as the AI agents fetch and summarize the latest updates for you.
- Language: Kotlin
- UI: Jetpack Compose
- AI Framework: MobileGraph SDK
- Model: OpenAI GPT-4o (or configured default)
- TTS: Android Text-to-Speech (Customized for Indian Male Voice)
Built with MobileGraph - Empowering Android Developers with Agentic AI.