<?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 Dylan Lu on Medium]]></title>
        <description><![CDATA[Stories by Dylan Lu on Medium]]></description>
        <link>https://medium.com/@dnplus?source=rss-3f19c4edaac4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*igcOG9Ro80o-jLl-MWAHhQ.jpeg</url>
            <title>Stories by Dylan Lu on Medium</title>
            <link>https://medium.com/@dnplus?source=rss-3f19c4edaac4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 18:01:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dnplus/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[Demystifying AI Agents: Why Your LLM Needs a “While Loop” to Actually Work]]></title>
            <link>https://medium.com/@dnplus/demystifying-ai-agents-why-your-llm-needs-a-while-loop-to-actually-work-c2fbd6f77081?source=rss-3f19c4edaac4------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2fbd6f77081</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Dylan Lu]]></dc:creator>
            <pubDate>Tue, 10 Mar 2026 15:09:45 GMT</pubDate>
            <atom:updated>2026-03-10T15:12:11.036Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Understanding the architecture of Agent Loops, from Function Calling to safety hooks and memory management.</em></p><p>I’ve been a bit quiet lately. If you were wondering where I vanished to, the truth is I’ve been spiraling down the rabbit hole of building AI Agents. It’s been an obsessive few weeks of late-night coding and skipped meals — the kind of flow state where your computer becomes your primary social contact and your actual friends start wondering if you’ve joined a cult.</p><p>Everyone is talking about “Agents” right now, but there’s a lot of mystic fog surrounding the term. Is it a specialized model? Is it a new kind of AGI? After building a few, I realized the “secret” is far more mundane and, frankly, more beautiful from an engineering perspective.</p><p>If you want to turn ChatGPT into an Agent, you don’t need a breakthrough in neural physics. You just need a `while` loop.</p><p><strong>The Brutal Simplicity of Programming</strong></p><p>I got my first PC in first grade. Back then, “interacting with a computer” mostly meant a cycle of accidentally downloading malware, watching the system crawl to a halt, and learning how to reinstall Windows from floppy disks. It was a loop of breaking and fixing.</p><p>But the first time I wrote a program that actually <em>*meant*</em> something was in high school. We had a bizarre computer science assignment: write a script to calculate a specific clock frequency that exactly matched our student ID number. Most kids tried to do the math. I didn’t. I wrote a JavaScript snippet that generated a random number, checked it against my ID, and wrapped the whole thing in a `while` loop.</p><p>I ran it, went to grab a snack, and came back to find the answer. It was brute force, it was “stupid,” and it worked so well that half the class ended up using it.</p><p>That’s when I realized a fundamental truth: <strong>The essence of programming is just “trying until you get it right.”</strong> Even at the lowest level — Assembly — everything boils down to comparison (`CMP`) and jumping (`JMP`). If you add a counter, you have a loop. Every fancy framework or complex algorithm you’ve ever used is just a stack of `if-else` statements and loops in a trench coat.</p><p><strong>From Chatbot to Agent</strong></p><p>So, how does this apply to ChatGPT?</p><p>Standard ChatGPT is a “one-shot” machine. You send a prompt, it predicts the next tokens, and the process terminates. It’s a stateless, single-turn interaction.</p><p>An Agent, however, is what happens when you wrap that LLM in a persistent loop. Instead of just answering you, the model is allowed to “think,” decide to take an action, observe the result of that action, and then decide what to do next.</p><pre>// The Core Agent Loop - It really is this simple<br>while (userTaskNotFinished) {<br>  const thought = await llm.generate(messages);<br>  if (thought.requiresTool()) {<br>    const result = await executeTool(thought.toolName, thought.args);<br>    messages.push({ role: &#39;tool&#39;, content: result });<br>    // Loop continues: LLM sees the tool result and thinks again<br>  } else {<br>    return thought.finalAnswer; // The loop breaks only when the goal is met<br>  }<br>}</pre><p>This is the <strong>Agent Loop</strong>. It’s the transition from a chatbot that <em>*talks*</em> to an agent that <em>*does*</em>.</p><p><strong>The “Talking to Yourself” Problem</strong></p><p>A loop by itself is just a hamster wheel. If you give an LLM a loop but no tools, you get a digital schizophrenic.</p><p>You ask: “What’s the weather in London?”</p><p>The LLM thinks: “I should check the weather.”</p><p>Loop restarts.</p><p>The LLM thinks: “Actually, I bet it’s rainy. Or maybe sunny? I’ll guess rainy.”</p><p>Without external tools, the Agent is just a student trying to pass an open-book exam without the book. It just hallucinates more confidently in a circle. To make the loop useful, you need <strong>**Function Calling (FC)**</strong>.</p><p>Function Calling is the “entry ticket” for Agents. It’s the bridge between the LLM’s reasoning and your actual code (APIs, databases, file systems). You provide the model with a list of tools — like a search engine or a calculator — and the model outputs a structured JSON object telling your system which tool to run.</p><p><strong>Why “Entry Level” Models Fail at Being Agents</strong></p><p>Here’s the catch: Function Calling is hard. If a model isn’t specifically fine-tuned for it, the loop breaks almost immediately.</p><p>I’ve seen “weak” models try to call a weather API. Instead of returning a clean `{“tool”: “get_weather”, “city”: “London”}`, they return: <em>*”Sure! I will help you with that. Calling tool: get_weather(‘London’). Hope this helps!”*</em></p><p>Your `JSON.parse()` function explodes, your code crashes, and your Agent dies on its first turn. This is why we pay the “OpenAI tax” or use high-end Claude models; you aren’t just paying for intelligence, you’re paying for the ability to follow a schema without yapping.</p><p><strong>The Real “Secret Sauce” of Agent Design</strong></p><p>Once you have a loop and tools that don’t crash your parser, you’ve reached the starting line. But a “senior-level” Agent requires three more things:</p><p><strong>1. Memory Management (The Context Tax)</strong></p><p>Every time your Agent goes through a loop, the conversation history grows. If it takes 20 turns to solve a complex coding task, your context window is suddenly stuffed with tool outputs, error logs, and “thoughts.” Eventually, the model “forgets” the original goal.</p><p>Great Agents use <strong>**Memory Management**</strong>. They don’t just dump everything into the prompt. They summarize old turns, discard redundant tool data, and keep a “working memory” of the most critical decisions.</p><p><strong>2. Planning vs. Brute Force</strong></p><p>My high school `while` loop was dumb. It just guessed. Modern Agents need to <strong>**Plan**</strong>. A sophisticated Agent starts by breaking a big task into a “To-Do” list. It executes step one, checks it off, and moves to step two. If it hits a wall, it revises the plan. It’s the difference between a junior dev who starts typing code before they understand the PR, and a senior dev who drafts a design doc first.</p><p><strong>3. The Stopping Condition</strong></p><p>The most dangerous thing in software is an infinite loop that costs $0.05 per iteration. An Agent needs to know when to stop.</p><p>- <strong>**Success:**</strong> It actually finished the task.</p><p>- <strong>**Stuck:**</strong> It’s tried the same tool three times and gotten the same error. It needs to give up and ask the human for help.</p><p>- <strong>**Safety Valve:**</strong> It’s been running for 5 minutes and spent $10. Kill the process.</p><p><strong>Safety First: Don’t Let Your Agent Go Rogue</strong></p><p>If you give an Agent access to your file system or your company’s Slack, you are effectively giving a persistent, autonomous loop the keys to your house. You need <strong>**Hooks**</strong>.</p><p>Hooks are security checkpoints within the loop.</p><p>- `before_tool_call`: A “Human-in-the-loop” check. If the Agent wants to `rm -rf /` or `send_email_to_CEO`, the system pauses and asks you to click “Approve.”</p><p>- `after_tool_call`: A sanitization step. If the tool returns a bunch of private user data (PII), the Hook masks it before feeding it back to the LLM.</p><p>Without Hooks, an Agent is a runaway horse. With them, it’s a controlled power tool.</p><p><strong>The Bottom Line</strong></p><p>Next time someone tries to sell you on the “magic” of AI Agents, remember: underneath the hood, it’s just a `while` loop with some very clever engineering around it.</p><p>It’s about managing memory so the model doesn’t get confused, planning tasks so it doesn’t wander, and hanging safety hooks so it doesn’t delete your database. It’s not just about how smart the LLM is; it’s about how robust the loop architecture is.</p><p>AI Agents are basically loops that never want to clock out. And if you build the loop right, they might just do your job for you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2fbd6f77081" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gamma.app: Revolutionizing The Way We Present Ideas With AI]]></title>
            <link>https://medium.com/@dnplus/gamma-app-revolutionizing-the-way-we-present-ideas-with-ai-b607c380d82c?source=rss-3f19c4edaac4------2</link>
            <guid isPermaLink="false">https://medium.com/p/b607c380d82c</guid>
            <category><![CDATA[presentations]]></category>
            <category><![CDATA[ai-tool-review]]></category>
            <category><![CDATA[gamma]]></category>
            <dc:creator><![CDATA[Dylan Lu]]></dc:creator>
            <pubDate>Sat, 09 Mar 2024 08:30:37 GMT</pubDate>
            <atom:updated>2024-03-09T08:30:37.911Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s fast-paced world, effective communication and presentation skills are key to success in any field. Whether in business meetings, academic presentations, or creative pitches, the ability to convey ideas clearly and engagingly is crucial.</p><p>Gamma.app steps in as a game-changer. It’s a new medium for presenting ideas, powered by AI. Here are some highlights:</p><ol><li>AI-Driven Content Creation: Gamma.app understands your content by parsing text and identifying key elements. Once it comprehends your message, it generates beautiful, brand-aligned presentations, documents, or webpages — all without the hassle of formatting and design work.</li><li>Engaging and Interactive: Gamma.app ensures concise, context-rich content that captivates your audience. You can embed various elements, including GIFs, videos, boards, and websites.</li><li>Built-In Analytics and Interaction: Gamma.app provides built-in analytics tools, quick responsiveness, and comment features, allowing seamless interaction with your audience across devices.</li></ol><p>Whether you’re a professional, educator, or creative, Gamma.app streamlines the process of creating compelling content. Say goodbye to tedious formatting and hello to impactful presentations!</p><p>Sign Up for free on Gamma.app <a href="https://try.gamma.app/7jcn98gub3pf">https://try.gamma.app/7jcn98gub3pf</a> and experience AI-powered content creation like never before.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b607c380d82c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking OAuth 2.0 Security: How PKCE Protects Your Online Identity]]></title>
            <link>https://medium.com/@dnplus/unlocking-oauth-2-0-security-how-pkce-protects-your-online-identity-93eb710004f8?source=rss-3f19c4edaac4------2</link>
            <guid isPermaLink="false">https://medium.com/p/93eb710004f8</guid>
            <category><![CDATA[oauth]]></category>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[pkce]]></category>
            <dc:creator><![CDATA[Dylan Lu]]></dc:creator>
            <pubDate>Wed, 31 Jan 2024 06:11:45 GMT</pubDate>
            <atom:updated>2024-01-31T06:11:45.326Z</atom:updated>
            <content:encoded><![CDATA[<p>In the realm of web security, OAuth 2.0 stands as a cornerstone for managing user authentication and authorization. However, despite its widespread adoption, traditional OAuth 2.0 is vulnerable to specific attacks, namely Cross-Site Request Forgery (CSRF) and Authorization Code Injection. These vulnerabilities, if exploited, can lead to unauthorized access and identity theft, posing a significant risk to online users.</p><h3>The Risks in Traditional OAuth: CSRF and Code Injection</h3><p>OAuth 2.0 facilitates user authentication by providing access tokens. In the standard flow, a client application redirects a user to an authorization server, where the user consents to grant access. Upon successful authorization, the server issues an authorization code, which the client exchanges for an access token.</p><p>The problem arises in the redirection phase. CSRF attacks can occur when an attacker tricks a user into visiting a malicious website, which then sends a forged request to the authorization server. Similarly, authorization code injection involves an attacker intercepting or using a stolen authorization code to gain unauthorized access. Both attacks exploit the trust in user-agent-based redirections, a fundamental aspect of OAuth 2.0.</p><h3>PKCE: A Robust Solution</h3><p>To counter these risks, Proof Key for Code Exchange (PKCE) was introduced. PKCE adds an extra layer of security, particularly beneficial for public clients, like mobile and single-page applications, which cannot securely store client secrets.</p><p>The process begins with the client creating a secret, known as the ‘Code Verifier,’ and its transformed version, the ‘Code Challenge.’ When requesting authorization, the client sends the Code Challenge to the authorization server. After the user grants access, the server issues an authorization code and expects the original Code Verifier in the token request. By verifying the Code Verifier against the previously received Code Challenge, the server ensures the authenticity of the request, effectively mitigating CSRF and code injection risks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*MwWR0cvqpuGSYRUxIuhTAA.png" /><figcaption>Authorization Code flow with PKCE</figcaption></figure><h3>Streamlit-OAuth: Empowering with PKCE</h3><p>Recognizing the importance of PKCE in enhancing OAuth 2.0 security, I am excited to introduce the latest update to the streamlit-oauth component. This addition seamlessly integrates PKCE into the authentication flow, ensuring a more secure experience for both developers and users.</p><p>The streamlit-oauth component, now with PKCE support, offers an easy-to-implement solution that fortifies applications against prevalent OAuth vulnerabilities. By using this component, developers can efficiently safeguard user identities and maintain the integrity of their applications.</p><p><a href="https://github.com/dnplus/streamlit-oauth">dnplus/streamlit-oauth: Simple OAuth Component for Streamlit App (github.com)</a></p><p>I invite the community to leverage this enhanced security feature in their projects. Not only does it elevate the security standards of your applications, but it also aligns with the evolving landscape of web security, where user safety is paramount.</p><p>In conclusion, as we continue to navigate through the complex web of online security, tools like PKCE in OAuth 2.0 are vital in protecting our digital identities. The streamlit-oauth component’s latest update is a testament to the ongoing effort to make the web a safer place for everyone. Your feedback and experiences using this enhanced tool are immensely valued and will contribute to the continuous improvement of online security standards.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93eb710004f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Streamlit OAuth: Effortless Authentication for Your Apps]]></title>
            <link>https://medium.com/@dnplus/exploring-streamlit-oauth-effortless-authentication-for-your-apps-e23f18a00d48?source=rss-3f19c4edaac4------2</link>
            <guid isPermaLink="false">https://medium.com/p/e23f18a00d48</guid>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[sso]]></category>
            <category><![CDATA[openid-connect]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[oauth]]></category>
            <dc:creator><![CDATA[Dylan Lu]]></dc:creator>
            <pubDate>Wed, 15 Nov 2023 06:00:35 GMT</pubDate>
            <atom:updated>2023-11-15T06:00:35.764Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever wondered how to seamlessly implement OAuth authentication in your Streamlit applications? Good news! I just released a brand-new Streamlit OAuth component that makes this process incredibly easy. Let’s dive in and see how you can integrate it into your Streamlit app.</p><h3>Features of the Streamlit OAuth Component</h3><p>1. <strong>User-Friendly</strong>: No need to delve into the complexities of OAuth. With just a few lines of code, you can integrate authentication into your Streamlit app effortlessly.</p><p>2. <strong>Multi-Platform Support</strong>: Supports various OAuth providers, including Google, Facebook, GitHub, and more, catering to the needs of different applications.</p><p>3. <strong>Customization Options</strong>: Provides rich customization options, allowing you to adjust the authentication flow according to your requirements.</p><p>4. <strong>Real-Time Feedback</strong>: Utilize Streamlit’s live preview feature to instantly see the effects of the authentication process.</p><h3>How to Use</h3><p>First, you need to install this component. You can find its installation page on <a href="https://pypi.org/project/streamlit-oauth/">PyPI.org</a>, and you can run the following command:</p><pre>pip install streamlit-oauth</pre><p>Once installed, you can import the component into your Streamlit app:</p><pre>import streamlit as st<br>from streamlit_oauth import OAuth2Component<br><br>AUTHORIZATION_URL = &lt;YOUR AUTHORIZATION URL&gt;<br>TOKEN_URL = &lt;YOUR TOKEN URL&gt;<br>REVOKE_URL = &lt;YOUR REVOKE URL&gt;<br>CLIENT_ID = &lt;YOUR CLIENT ID&gt;<br>CLIENT_SECRET = &lt;YOUR CLIENT SECRET&gt;<br>REDIRECT_URI = &lt;YOUR REDIRECT URI&gt;<br>SCOPE = &quot;openid email profile&quot;<br><br>oauth2 = OAuth2Component(CLIENT_ID, CLIENT_SECRET, AUTHORIZATION_URL, TOKEN_URL, TOKEN_URL, REVOKE_URL)<br><br>if &#39;token&#39; not in st.session_state:<br>  result = oauth2.authorize_button(&quot;Continue with Google&quot;, REDIRECT_URI, SCOPE, icon=&quot;data:image/svg+xml;charset=utf-8,%3Csvg xmlns=&#39;http://www.w3.org/2000/svg&#39; xmlns:xlink=&#39;http://www.w3.org/1999/xlink&#39; viewBox=&#39;0 0 48 48&#39;%3E%3Cdefs%3E%3Cpath id=&#39;a&#39; d=&#39;M44.5 20H24v8.5h11.8C34.7 33.9 30.1 37 24 37c-7.2 0-13-5.8-13-13s5.8-13 13-13c3.1 0 5.9 1.1 8.1 2.9l6.4-6.4C34.6 4.1 29.6 2 24 2 11.8 2 2 11.8 2 24s9.8 22 22 22c11 0 21-8 21-22 0-1.3-.2-2.7-.5-4z&#39;/%3E%3C/defs%3E%3CclipPath id=&#39;b&#39;%3E%3Cuse xlink:href=&#39;%23a&#39; overflow=&#39;visible&#39;/%3E%3C/clipPath%3E%3Cpath clip-path=&#39;url(https://medium.com/%23b)&#39; fill=&#39;%23FBBC05&#39; d=&#39;M0 37V11l17 13z&#39;/%3E%3Cpath clip-path=&#39;url(https://medium.com/%23b)&#39; fill=&#39;%23EA4335&#39; d=&#39;M0 11l17 13 7-6.1L48 14V0H0z&#39;/%3E%3Cpath clip-path=&#39;url(https://medium.com/%23b)&#39; fill=&#39;%2334A853&#39; d=&#39;M0 37l30-23 7.9 1L48 0v48H0z&#39;/%3E%3Cpath clip-path=&#39;url(https://medium.com/%23b)&#39; fill=&#39;%234285F4&#39; d=&#39;M48 48L17 24l-4-3 35-10z&#39;/%3E%3C/svg%3E&quot;)<br>  if result:<br>    st.session_state.token = result.get(&#39;token&#39;)<br>    st.rerun()</pre><p>That’s it! These few lines of code are enough to integrate OAuth authentication into your Streamlit app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*QKAMutrRAspIVDPzC8emrA.png" /></figure><h3>Quick Start Guide</h3><p>If you want to delve deeper into using this component, check out my <a href="https://github.com/dnplus/streamlit-oauth">GitHub repository</a>, which includes detailed documentation and example code to help you get started quickly.</p><p>The Streamlit OAuth component is a tool that makes authentication a breeze, aiming to bring more convenience to your app development. If you have any questions, suggestions, or feedback, feel free to raise them in the GitHub repository. Looking forward to seeing your fantastic applications — happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e23f18a00d48" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>