<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mahmoud Eraqi on Medium]]></title>
        <description><![CDATA[Stories by Mahmoud Eraqi on Medium]]></description>
        <link>https://medium.com/@mahmouderaqi095?source=rss-18705f3f5855------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FHs-AHXWHzV586km8xUKiQ.png</url>
            <title>Stories by Mahmoud Eraqi on Medium</title>
            <link>https://medium.com/@mahmouderaqi095?source=rss-18705f3f5855------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 11:21:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mahmouderaqi095/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Power of Git Submodule: An Android Example]]></title>
            <link>https://medium.com/@mahmouderaqi095/the-power-of-git-submodule-an-android-example-e7070df34a74?source=rss-18705f3f5855------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7070df34a74</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Mahmoud Eraqi]]></dc:creator>
            <pubDate>Mon, 13 Oct 2025 23:54:19 GMT</pubDate>
            <atom:updated>2025-10-14T00:25:13.657Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F-PfU4y38GkBhLU2bfNTwg.jpeg" /></figure><blockquote>Introduction</blockquote><p>If you’ve worked on a project that uses multiple libraries, that are maintained by your company or your team, you’ve probably ran into issues while managing the code across different repositories.</p><p>Git submodule simply allows you to have a parent-child like relationship between your repositories and at the same time maintain each one of them individually.</p><p>While it sounds straight forward, it could become a little tricky to deal with if you’re not familiar with how it works.</p><p>I’m going to give an example with an Android Project as this is my main stack, but of course this should work for any git repositories.</p><p>Note: Parent-child is not technically accurate to describe the relation between them, because the submodule is completely independent of the super project, I’m just using it here for simplification.</p><blockquote>Main Components</blockquote><p><strong>Parent project (Super Project): </strong>This is the main project/app that is going to be using the libraries, aka the submodules</p><p><strong>Child Project/s (Submodules):</strong> These are the libraries that the parent project depends on</p><p><strong>.gitmodule file</strong>: A file where we define all of our submodules (their paths in the project, their remote URL, their names, and more)</p><blockquote>Repositories</blockquote><p>I’ve created two GitHub repositories for the purpose of explaining this only.</p><p><strong>Parent(Super Project):</strong> <a href="https://github.com/MahmoudEraqi95/submodules_example_parent">MahmoudEraqi95/submodules_example_parent: A parent project for an article about git submodule</a></p><p><strong>Child(Submodule):</strong> <a href="https://github.com/MahmoudEraqi95/submodule_example_child">MahmoudEraqi95/submodule_example_child: A library project for an article about git submodules</a></p><p>Next, we need to add our library as a submodule to the project.</p><p>We can do this by executing the following command in the terminal:</p><pre>git submodule add https://github.com/MahmoudEraqi95/submodule_example_child</pre><p>This will automatically create the .gitmodule file with the following data inside it.</p><pre>[submodule &quot;submodule_example_child&quot;]<br>    path = submodule_example_child<br>    url = https://github.com/MahmoudEraqi95/submodule_example_child</pre><p>You can also add the name of the default branch that you’re keeping track of by adding this, “-b main” to the command, so it looks like this:</p><pre>git submodule add -b main https://github.com/MahmoudEraqi95/submodule_example_child</pre><p>You can also put the branch name manually later.</p><pre>[submodule &quot;submodule_example_child&quot;]<br>    path = submodule_example_child<br>    url = https://github.com/MahmoudEraqi95/submodule_example_child<br>    branch = main</pre><p>Now of we would like to make some changes to the library, I just rename the “app” module in the child module to “library1” and pushed my changes to main.</p><p>We can easily get this update by executing the following git command in the parent repository</p><pre>git submodule update --recursive --remote</pre><p>— recursive tells git to retrieve any submodules that also exists in the submodule itself, and of course, — remote tells it to pull it from the remote repo.</p><p>Once this git command is executed, it returns the latest changes in each submodule, but you have to commit these changes in your parent project in order to keep them</p><p>Another equivialant command would be:</p><pre>git submodule foreach &#39;git checkout main &amp;&amp; git pull origin main&#39;</pre><p>Note: If you didn’t commit the changes in the parent repository, doing a</p><pre>git submodule update</pre><p>will get you back to your last committed changes in the parent repository</p><blockquote>Making changes to a submodule from the parent repo</blockquote><p>Submodules are usually separate projects, and for me personally, I would prefer to treat the library as a separate project, have it opened in another Android Studio tab or something, and develop my feature or fix my bugs there, but you might want to do minor changes while you’re in the parent repo, in this case you need to remember the following, by default the submodules will be on a detached HEAD, this means that submodule will checkout a commit instead of a branch, so if you’re going to do any development work, make sure you checkout a branch.</p><p>You might be thinking, why doesn’t git use the default branch by default and not initialize the submodule with a detached HEAD, but there is a reason for that actually.</p><p>When you checkout a commit instead of a branch, you’re making sure that your parent repository is using a specific version of a the submodule, if you’re checking out a branch and that branch got updated with a breaking changes, your build will fail and if it’s on a pipeline, you will be blocking other developers until you fix that change, so using a detached HEAD makes sense in this case.</p><blockquote>Conclusion</blockquote><p>Using Git submodules can be a powerful way to manage shared libraries across multiple projects, especially in larger teams or organizations. By setting up a parent-child relationship between repositories, submodules allow you to isolate development, maintain version control, and ensure consistency between projects.</p><p>However, they come with a learning curve and a few caveats — like managing detached HEAD states, remembering to commit submodule updates in the parent repo, and using the correct commands to sync changes. With careful setup and discipline, submodules can reduce redundancy and improve modularity in your codebase.</p><p>Whether you’re building Android apps or working in another tech stack, understanding how to effectively integrate and manage submodules will help you maintain cleaner, more scalable projects.</p><blockquote>References:</blockquote><p><a href="https://git-scm.com/book/en/v2/Git-Tools-Submodules">Git — Submodules</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7070df34a74" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic Android Apps]]></title>
            <link>https://proandroiddev.com/agentic-android-apps-231d7a755d50?source=rss-18705f3f5855------2</link>
            <guid isPermaLink="false">https://medium.com/p/231d7a755d50</guid>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Mahmoud Eraqi]]></dc:creator>
            <pubDate>Wed, 06 Aug 2025 00:38:27 GMT</pubDate>
            <atom:updated>2025-12-12T16:42:14.401Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iieOlP7mMvqCRCWFnPt54w.png" /></figure><blockquote>Introduction</blockquote><p>The future of mobile experiences is shifting from static apps to intelligent, proactive agents. As AI continues to evolve, so does our approach to building applications that don’t just wait for user input — but act on behalf of the user, adapt to their needs, and collaborate in meaningful ways. This transformation introduces the concept of agentic applications — apps that possess autonomy, memory, and reasoning.</p><p>In this post, we’ll explore what it means to make an Android application agentic, why it’s an important step forward, and we will create a simple Android Application that simulates money transfer.</p><blockquote>What’s an AI agent and what makes it different from an LLM</blockquote><p>An AI Agent is a system that’s operates in a controlled environment to achieve specific goals within that environment in an autonomous way, it’s a collection of Tools, Models, and a Strategy.</p><p>For instance, it could be a personal assistant that schedule meetings for you by accessing your emails, calendar, and contact list.</p><p>An LLM is a trained AI model that only produces text, it replies to prompts in general, but unlike agents, it doesn’t take action.</p><blockquote>What makes an application agentic</blockquote><p>Simply put, when it can understand user intent and not just respond to user’s inputs and taps.</p><p>For instance, when I tell it “Send $100 to my wife”, it can do this automatically and do all the required steps, which may involves accessing my contacts list, getting my wife’s phone number, and call a function that sends money by phone number.</p><blockquote>Why it’s important</blockquote><p>It’s a great improvement in the user experience as it reduces the user efforts, imagine yourself wanting to order a pizza from a restaurant that has 4+ stars reviews, and within 20 minutes of your location, using one of the meal delivery apps.</p><p>Steps involved if the app is not agentic:</p><ol><li>Go to restaurants listing</li><li>Filter with 4+ reviews and within 20 minutes</li><li>Select the restaurant</li><li>Create your order</li><li>Confirm delivery details</li></ol><p>While the application is agentic, you only do one step.</p><p>“Order a pepperoni pizza from the first 4+ star restaurant and can arrive within 20 minutes. use my usual address for delivery.”</p><blockquote>How can you do it.</blockquote><p>JetBrains recently released a framework for building AI agents that entirely developed in Kotlin, <strong>Koog</strong>, and that’s what we’re going to use to develop our android application.</p><p>Here’s what’s going to happen in the application:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*edHFMM5ssSbPKJlUXemg7w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*goqxuDqyuaqSmyEpD-rSRg.gif" /></figure><p>First, we will need to declare <strong>Koog</strong> dependency in build.gradle(app module).</p><pre>implementation(&quot;ai.koog:koog-agents:0.3.0&quot;)</pre><p>Next, we need to create a ChatScreen:</p><pre>import androidx.compose.foundation.background<br>import androidx.compose.foundation.layout.*<br>import androidx.compose.foundation.lazy.LazyColumn<br>import androidx.compose.foundation.lazy.items<br>import androidx.compose.material.icons.Icons<br>import androidx.compose.material.icons.filled.Send<br>import androidx.compose.material3.*<br>import androidx.compose.runtime.*<br>import androidx.compose.ui.Alignment<br>import androidx.compose.ui.Modifier<br>import androidx.compose.ui.graphics.Color<br>import androidx.compose.ui.text.input.TextFieldValue<br>import androidx.compose.ui.unit.dp<br>import androidx.hilt.navigation.compose.hiltViewModel<br><br>data class ChatMessage(val message: String, val isUser: Boolean)<br>@Composable<br>fun ChatScreen(viewModel: MainViewModel = hiltViewModel()) {<br>    var userInput by remember { mutableStateOf(TextFieldValue(&quot;&quot;)) }<br>    val chatHistory = remember { mutableStateListOf&lt;ChatMessage&gt;() }<br>    val message = viewModel.newMessage.collectAsStateWithLifecycle()<br>    LaunchedEffect(message.value) {<br>        chatHistory.add(ChatMessage(message.value, false))<br>    }<br>    Column(modifier = Modifier<br>        .fillMaxSize()<br>        .padding(8.dp)) {<br>        <br>        LazyColumn(<br>            modifier = Modifier<br>                .weight(1f)<br>                .fillMaxWidth(),<br>            reverseLayout = true<br>        ) {<br>            items(chatHistory.reversed()) { msg -&gt;<br>                ChatBubble(message = msg)<br>                Spacer(modifier = Modifier.height(4.dp))<br>            }<br>        }<br><br>        HorizontalDivider()<br><br>        <br>        Row(<br>            modifier = Modifier<br>                .fillMaxWidth()<br>                .padding(top = 8.dp),<br>            verticalAlignment = Alignment.CenterVertically<br>        ) {<br>            TextField(<br>                value = userInput,<br>                onValueChange = { userInput = it },<br>                modifier = Modifier.weight(1f),<br>                placeholder = { Text(&quot;Type your message...&quot;) }<br>            )<br>            IconButton(<br>                onClick = {<br>                    val input = userInput.text.trim()<br>                    if (input.isNotEmpty()) {<br>                        chatHistory.add(ChatMessage(input, true))<br>                        userInput = TextFieldValue(&quot;&quot;) <br>                        viewModel.runPrompt(input)<br>                    }<br>                }<br>            ) {<br>                Icon(Icons.Default.Send, contentDescription = &quot;Send&quot;)<br>            }<br>        }<br>    }<br>}<br><br>@Composable<br>fun ChatBubble(message: ChatMessage) {<br>    val backgroundColor = if (message.isUser) MaterialTheme.colorScheme.primary else Color.LightGray<br>    val alignment = if (message.isUser) Alignment.TopEnd else Alignment.TopStart<br>    val textColor = if (message.isUser) Color.White else Color.Black<br><br>    Box(<br>        contentAlignment = alignment,<br>        modifier = Modifier.fillMaxWidth()<br>    ) {<br>        Box(<br>            modifier = Modifier<br>                .background(color = backgroundColor, shape = MaterialTheme.shapes.medium)<br>                .padding(12.dp)<br>                .widthIn(max = 280.dp)<br>        ) {<br>            Text(<br>                text = message.message,<br>                color = textColor<br>            )<br>        }<br>    }<br>}</pre><p>Next, setting up our MainViewModel, which for the sake of simplicity, it’ll contains all the logic:</p><pre>import ai.koog.agents.core.agent.AIAgent<br>import ai.koog.agents.core.tools.ToolRegistry<br>import ai.koog.agents.core.tools.reflect.asTools<br>import ai.koog.prompt.executor.clients.openai.OpenAIModels<br>import ai.koog.prompt.executor.llms.all.simpleOpenAIExecutor<br>import androidx.lifecycle.ViewModel<br>import androidx.lifecycle.viewModelScope<br>import com.eraqi.tools.MoneyTransferTool<br>import dagger.hilt.android.lifecycle.HiltViewModel<br>import kotlinx.coroutines.flow.MutableStateFlow<br>import kotlinx.coroutines.launch<br>import javax.inject.Inject<br><br>@HiltViewModel<br>class MainViewModel  @Inject constructor() :ViewModel() {<br>val apiKey = &quot;&quot; // Your OpenApi api key should be put here<br>private val _newMessage = MutableStateFlow(&quot;&quot;)<br>val newMessage = _newMessage.asStateFlow()<br>val moneyTransferTool = MoneyTransferTool()<br>val agent = AIAgent(<br>       executor = simpleOpenAIExecutor(apiKey),<br>       systemPrompt = &quot;You&#39;re a banking assistant, you can send and receive money&quot;,<br>       llmModel = OpenAIModels.Chat.GPT4o,<br>       toolRegistry = ToolRegistry{<br>           tools(moneyTransferTool.asTools())<br>       }<br>   )</pre><p>We need to go through a few concepts here in order for this code to make sense:</p><ul><li><strong>MoneyTransferTool</strong>: This is a class that contains some functions that are visibile for the Agent to execute</li><li><strong>Executer</strong>: Just defines which LLM I’m going to use to execute this specific task</li><li><strong>System Prompt</strong>: This is a definition of the job of the LLM, the one that I have above is kind of generic, for instance, if you asked this Agent for a medical advice, it would advise you, but If I changed the system prompt to the following:</li></ul><pre>systemPrompt = &quot;You&#39;re a banking assistant, you can send and receive money, if you&#39;re asked any question that is unrelated to banking, say I don&#39;t know&quot;</pre><p>It will reply like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*-U4bgFI681eDH3hIGf52ww.jpeg" /></figure><ul><li><strong>Tool Registry</strong>: Evey agent gets access to tools to use, tools are basically functions that do specific job, each of these function gets two important annotations <strong>@Tool</strong> and<strong> @LLMDescription</strong>. <strong>Tool </strong>just declares it as a tool to make it visible to the LLM, and <strong>LLMDescription </strong>describes what this function does, to the LLM</li></ul><p>This is what runPrompt looks like:</p><pre>fun runPrompt(message: String){<br><br>    viewModelScope.launch {<br>        try {<br>            val result = agent.run(message)<br>            _newMessage.value = result<br>        }catch (exception: Exception){<br>            exception.printStackTrace()<br>        }<br>    }<br>}</pre><p>And this what MoneyTransferTools looks like:</p><pre>import ai.koog.agents.core.tools.annotations.LLMDescription<br>import ai.koog.agents.core.tools.annotations.Tool<br>import ai.koog.agents.core.tools.reflect.ToolSet<br>import android.util.Log<br><br><br>@LLMDescription(&quot;Send and receive money&quot;)<br>class MoneyTransferTool: ToolSet {<br><br>    val TAG = &quot;MoneyTransferTool &quot;<br><br>    @Tool<br>    @LLMDescription(&quot;Sending an amount of money to a user&quot;)<br>    fun sendMoney(@LLMDescription(&quot;user name that should receive the money&quot;) user: String,<br>                 @LLMDescription(&quot;The amount of money to be sent&quot;) amount: String):String{<br><br><br>        Log.d(TAG, &quot;Sent $amount to $user&quot;)<br>        return &quot;Done&quot;<br>    }<br><br>}</pre><p>Note that it has to extend the <strong>ToolSet </strong>interface and also annotated with LLMDescription to make it easy for the LLM to know which tools it’s going to use for each request.</p><p>Also remember, what’s returned from the tool is going to be returned to the LLM and based on the value it will understand if it was successfully executed or not, for instance if an error happened, we should return an error message and the LLM will rephrase it in a way that is more readable and understandable for the user.</p><blockquote>Summary</blockquote><p>This was a simple introduction to Agentic Android Apps and Koog, building an AI agent has more challenges that you will need to handle, like history, and memory, Koog has support for that, and many more features.</p><blockquote>References</blockquote><p><a href="https://docs.koog.ai/">Overview — Koog</a></p><p><a href="https://github.com/JetBrains/koog">JetBrains/koog: Koog is the official Kotlin framework for building and running robust, scalable and production-ready AI agents across all platforms — from backend services to Android, JVM, and even in-browser environments. Koog is based on our AI products expertise and provides proven solutions for complex LLM and AI problems</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FO8WQCrdza8E%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DO8WQCrdza8E&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FO8WQCrdza8E%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/da474df6b09dbbfcf023887c5cace484/href">https://medium.com/media/da474df6b09dbbfcf023887c5cace484/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=231d7a755d50" width="1" height="1" alt=""><hr><p><a href="https://proandroiddev.com/agentic-android-apps-231d7a755d50">Agentic Android Apps</a> was originally published in <a href="https://proandroiddev.com/">ProAndroidDev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>